diff --git a/.env.example b/.env.example index c9921c2..7791e53 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -PORT=11434 \ No newline at end of file +PORT=11434 +VERBOSE=false \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..dee5695 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.* \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 6f61c4f..af9c3c2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,11 @@ { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": [ + "source.fixAll.eslint" + ], + "eslint.validate": ["javascript", "typescript"], + "prettier.singleQuote": true, "cSpell.ignorePaths" : [ "src" - ], + ] } \ No newline at end of file diff --git a/src/mapper.ts b/src/mapper.ts index f917560..6776a2d 100644 --- a/src/mapper.ts +++ b/src/mapper.ts @@ -7,12 +7,7 @@ import { ToolRegistry } from '@google/gemini-cli-core/dist/src/tools/tool-registry.js'; import { Config } from '@google/gemini-cli-core/dist/src/config/config.js'; import { Tool } from '@google/gemini-cli-core/dist/src/tools/tools.js'; -import { - Part, - RequestBody, - GeminiResponse, - GeminiStreamChunk, -} from './types'; +import { Part, RequestBody, GeminiResponse, GeminiStreamChunk } from './types'; /* ----------------------------------------------------------------- */ async function callLocalFunction(/*_name: string, _args: unknown*/) { @@ -52,8 +47,8 @@ export async function mapRequest(body: RequestBody) { ...(body.generationConfig ?? {}), // copy anything ST already merged }; if (body.include_reasoning === true) { - generationConfig.enable_thoughts = true; // ← current flag - generationConfig.thinking_budget ??= 2048; // optional limit + generationConfig.enable_thoughts = true; // ← current flag + generationConfig.thinking_budget ??= 2048; // optional limit } /* ---- auto-enable reasoning & 1 M context ----------------------- */ @@ -80,15 +75,12 @@ export async function mapRequest(body: RequestBody) { name: fn.name, displayName: fn.name, description: fn.description ?? '', - schema: z.object( - (fn.parameters?.properties as ZodRawShape) ?? {}, - ), + schema: z.object((fn.parameters?.properties as ZodRawShape) ?? {}), isOutputMarkdown: false, canUpdateOutput: false, validateToolParams: () => null, getDescription: (params: unknown) => - `Executing ${fn.name} with parameters: ` + - JSON.stringify(params), + `Executing ${fn.name} with parameters: ` + JSON.stringify(params), shouldConfirmExecute: () => Promise.resolve(false), execute: () => callLocalFunction(), } as Tool); @@ -136,11 +128,9 @@ export function mapStreamChunk(chunk: GeminiStreamChunk) { const delta: { role: 'assistant', content?: string } = { role: 'assistant' }; if (part.thought === true) { - delta.content = `${part.text ?? ''}`; // ST renders grey bubble + delta.content = `${part.text ?? ''}`; // ST renders grey bubble } else if (typeof part.text === 'string') { delta.content = part.text; } - return { choices: [ { delta, index: 0 } ] }; + return { choices: [{ delta, index: 0 }] }; } - -