mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
fix(cli): add model guard and explicit tools:[] for /btw command
Explicitly pass tools:[] to generateContent to prevent tool invocation in side questions. Add model undefined guard for defensive safety. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d285c4409a
commit
ed9a4edc40
2 changed files with 32 additions and 2 deletions
|
|
@ -87,6 +87,28 @@ describe('btwCommand', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should return error when model is not configured', async () => {
|
||||
const noModelContext = createMockCommandContext({
|
||||
services: {
|
||||
config: {
|
||||
getGeminiClient: () => ({
|
||||
getHistory: mockGetHistory,
|
||||
generateContent: mockGenerateContent,
|
||||
}),
|
||||
getModel: () => '',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const result = await btwCommand.action!(noModelContext, 'test question');
|
||||
|
||||
expect(result).toEqual({
|
||||
type: 'message',
|
||||
messageType: 'error',
|
||||
content: 'No model configured.',
|
||||
});
|
||||
});
|
||||
|
||||
describe('interactive mode', () => {
|
||||
it('should set pending item and add completed item on success', async () => {
|
||||
mockGenerateContent.mockResolvedValue({
|
||||
|
|
@ -149,7 +171,7 @@ describe('btwCommand', () => {
|
|||
],
|
||||
},
|
||||
],
|
||||
{},
|
||||
{ tools: [] },
|
||||
expect.any(AbortSignal),
|
||||
'test-model',
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue