mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Add @ command handling to useGeminiStream (#217)
* First integration of at commands into useGeminiStream.ts * feat: Integrate @ command for file/directory reading - Adds support for `@<path>` commands in the CLI UI to read file or directory contents using the `read_many_files` tool. - Refactors `useGeminiStream` hook to handle slash, passthrough, and @ commands before sending queries to the Gemini API. - Improves history item ID generation to prevent React duplicate key warnings. * fix: Handle additional text after @ command path - Modifies the `@` command processor to parse text following the file/directory path (e.g., `@README.md explain this`). - Includes both the fetched file content and the subsequent text in the query sent to the Gemini API. - Resolves the TODO item in `atCommandProcessor.ts`. * feat: Allow @ command anywhere in query and fix build - Update `atCommandProcessor` to correctly parse `@<path>` commands regardless of their position in the input string using regex. This enables queries like "Explain @README.md to me". - Fix build error in `useGeminiStream` by importing the missing `findSafeSplitPoint` function. * rename isPotentiallyAtCommand to isAtCommand * respond to review comments.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* @param query The input query string.
|
||||
* @returns True if the query looks like an '@' command, false otherwise.
|
||||
*/
|
||||
export const isPotentiallyAtCommand = (query: string): boolean =>
|
||||
export const isAtCommand = (query: string): boolean =>
|
||||
// Check if starts with @ OR has a space, then @, then a non-space character.
|
||||
query.startsWith('@') || /\s@\S/.test(query);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user