feat: Show model thoughts while loading (#992)

This commit is contained in:
Asad Memon
2025-06-15 11:19:05 -07:00
committed by GitHub
parent b3d89a1075
commit 123ad20e9b
7 changed files with 153 additions and 24 deletions

View File

@@ -38,6 +38,11 @@ import {
import { ProxyAgent, setGlobalDispatcher } from 'undici';
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
function isThinkingSupported(model: string) {
if (model.startsWith('gemini-2.5')) return true;
return false;
}
export class GeminiClient {
private chat: Promise<GeminiChat>;
private contentGenerator: Promise<ContentGenerator>;
@@ -164,14 +169,21 @@ export class GeminiClient {
try {
const userMemory = this.config.getUserMemory();
const systemInstruction = getCoreSystemPrompt(userMemory);
const generateContentConfigWithThinking = isThinkingSupported(this.model)
? {
...this.generateContentConfig,
thinkingConfig: {
includeThoughts: true,
},
}
: this.generateContentConfig;
return new GeminiChat(
this.config,
await this.contentGenerator,
this.model,
{
systemInstruction,
...this.generateContentConfig,
...generateContentConfigWithThinking,
tools,
},
history,