Skip to content

Commit 5df1cf8

Browse files
committed
🤖 refactor: cleanup and consistency improvements
- Remove unused modelString import from ollama.test.ts - Use consistent indexOf() pattern for provider extraction in streamMessage() Ensures model IDs with colons are handled uniformly throughout codebase
1 parent 6d48ecf commit 5df1cf8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/services/aiService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,9 @@ export class AIService extends EventEmitter {
468468
log.debug_obj(`${workspaceId}/1_original_messages.json`, messages);
469469

470470
// Extract provider name from modelString (e.g., "anthropic:claude-opus-4-1" -> "anthropic")
471-
const [providerName] = modelString.split(":");
471+
// Use indexOf to handle model IDs with colons (e.g., "ollama:gpt-oss:20b")
472+
const colonIndex = modelString.indexOf(":");
473+
const providerName = colonIndex !== -1 ? modelString.slice(0, colonIndex) : modelString;
472474

473475
// Get tool names early for mode transition sentinel (stub config, no workspace context needed)
474476
const earlyRuntime = createRuntime({ type: "local", srcBaseDir: process.cwd() });

tests/ipcMain/ollama.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
sendMessageWithModel,
44
createEventCollector,
55
assertStreamSuccess,
6-
modelString,
76
extractTextFromEvents,
87
} from "./helpers";
98

0 commit comments

Comments
 (0)