mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
refactor: move nested debugmessage and slashcommand hooks outside of useGeminiStream (#341)
This commit is contained in:
parent
c4c11f1d65
commit
d3303fd3a0
5 changed files with 42 additions and 49 deletions
|
|
@ -24,7 +24,7 @@ interface HandleAtCommandParams {
|
|||
query: string;
|
||||
config: Config;
|
||||
addItem: UseHistoryManagerReturn['addItem'];
|
||||
setDebugMessage: React.Dispatch<React.SetStateAction<string>>;
|
||||
onDebugMessage: (message: string) => void;
|
||||
messageId: number;
|
||||
signal: AbortSignal;
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ export async function handleAtCommand({
|
|||
query,
|
||||
config,
|
||||
addItem,
|
||||
setDebugMessage,
|
||||
onDebugMessage,
|
||||
messageId: userMessageTimestamp,
|
||||
signal,
|
||||
}: HandleAtCommandParams): Promise<HandleAtCommandResult> {
|
||||
|
|
@ -109,7 +109,7 @@ export async function handleAtCommand({
|
|||
|
||||
// If the atPath is just "@", pass the original query to the LLM
|
||||
if (atPath === '@') {
|
||||
setDebugMessage('Lone @ detected, passing directly to LLM.');
|
||||
onDebugMessage('Lone @ detected, passing directly to LLM.');
|
||||
return { processedQuery: [{ text: query }], shouldProceed: true };
|
||||
}
|
||||
|
||||
|
|
@ -144,18 +144,18 @@ export async function handleAtCommand({
|
|||
const stats = await fs.stat(absolutePath);
|
||||
if (stats.isDirectory()) {
|
||||
pathSpec = pathPart.endsWith('/') ? `${pathPart}**` : `${pathPart}/**`;
|
||||
setDebugMessage(`Path resolved to directory, using glob: ${pathSpec}`);
|
||||
onDebugMessage(`Path resolved to directory, using glob: ${pathSpec}`);
|
||||
} else {
|
||||
setDebugMessage(`Path resolved to file: ${pathSpec}`);
|
||||
onDebugMessage(`Path resolved to file: ${pathSpec}`);
|
||||
}
|
||||
} catch (error) {
|
||||
// If stat fails (e.g., not found), proceed with original path.
|
||||
// The tool itself will handle the error during execution.
|
||||
if (isNodeError(error) && error.code === 'ENOENT') {
|
||||
setDebugMessage(`Path not found, proceeding with original: ${pathSpec}`);
|
||||
onDebugMessage(`Path not found, proceeding with original: ${pathSpec}`);
|
||||
} else {
|
||||
console.error(`Error stating path ${pathPart}:`, error);
|
||||
setDebugMessage(
|
||||
onDebugMessage(
|
||||
`Error stating path, proceeding with original: ${pathSpec}`,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue