More linting fixes

This commit is contained in:
2025-06-28 16:08:23 -05:00
parent 10a6502f73
commit 6f3fbe2a6a
4 changed files with 17 additions and 19 deletions

View File

@@ -1 +1,2 @@
PORT=11434 PORT=11434
VERBOSE=false

1
.prettierignore Normal file
View File

@@ -0,0 +1 @@
*.*

View File

@@ -1,5 +1,11 @@
{ {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": [
"source.fixAll.eslint"
],
"eslint.validate": ["javascript", "typescript"],
"prettier.singleQuote": true,
"cSpell.ignorePaths" : [ "cSpell.ignorePaths" : [
"src" "src"
], ]
} }

View File

@@ -7,12 +7,7 @@ import { ToolRegistry }
from '@google/gemini-cli-core/dist/src/tools/tool-registry.js'; from '@google/gemini-cli-core/dist/src/tools/tool-registry.js';
import { Config } from '@google/gemini-cli-core/dist/src/config/config.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 { Tool } from '@google/gemini-cli-core/dist/src/tools/tools.js';
import { import { Part, RequestBody, GeminiResponse, GeminiStreamChunk } from './types';
Part,
RequestBody,
GeminiResponse,
GeminiStreamChunk,
} from './types';
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
async function callLocalFunction(/*_name: string, _args: unknown*/) { async function callLocalFunction(/*_name: string, _args: unknown*/) {
@@ -52,8 +47,8 @@ export async function mapRequest(body: RequestBody) {
...(body.generationConfig ?? {}), // copy anything ST already merged ...(body.generationConfig ?? {}), // copy anything ST already merged
}; };
if (body.include_reasoning === true) { if (body.include_reasoning === true) {
generationConfig.enable_thoughts = true; // ← current flag generationConfig.enable_thoughts = true; // ← current flag
generationConfig.thinking_budget ??= 2048; // optional limit generationConfig.thinking_budget ??= 2048; // optional limit
} }
/* ---- auto-enable reasoning & 1 M context ----------------------- */ /* ---- auto-enable reasoning & 1 M context ----------------------- */
@@ -80,15 +75,12 @@ export async function mapRequest(body: RequestBody) {
name: fn.name, name: fn.name,
displayName: fn.name, displayName: fn.name,
description: fn.description ?? '', description: fn.description ?? '',
schema: z.object( schema: z.object((fn.parameters?.properties as ZodRawShape) ?? {}),
(fn.parameters?.properties as ZodRawShape) ?? {},
),
isOutputMarkdown: false, isOutputMarkdown: false,
canUpdateOutput: false, canUpdateOutput: false,
validateToolParams: () => null, validateToolParams: () => null,
getDescription: (params: unknown) => getDescription: (params: unknown) =>
`Executing ${fn.name} with parameters: ` + `Executing ${fn.name} with parameters: ` + JSON.stringify(params),
JSON.stringify(params),
shouldConfirmExecute: () => Promise.resolve(false), shouldConfirmExecute: () => Promise.resolve(false),
execute: () => callLocalFunction(), execute: () => callLocalFunction(),
} as Tool); } as Tool);
@@ -136,11 +128,9 @@ export function mapStreamChunk(chunk: GeminiStreamChunk) {
const delta: { role: 'assistant', content?: string } = { role: 'assistant' }; const delta: { role: 'assistant', content?: string } = { role: 'assistant' };
if (part.thought === true) { if (part.thought === true) {
delta.content = `<think>${part.text ?? ''}`; // ST renders grey bubble delta.content = `<think>${part.text ?? ''}`; // ST renders grey bubble
} else if (typeof part.text === 'string') { } else if (typeof part.text === 'string') {
delta.content = part.text; delta.content = part.text;
} }
return { choices: [ { delta, index: 0 } ] }; return { choices: [{ delta, index: 0 }] };
} }