mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-03 19:25:19 +02:00
Refactor: move model config parsing from renderer to main process via IPC
The renderer was reading config/models.json via workspace:readFile and manually parsing the provider/model structure. This moves that logic into a dedicated models:getConfiguredModels IPC handler backed by a new getAllConfiguredModels() method on the model config repo, matching the existing models:saveConfig pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
16b8975b00
commit
bfb6702dc9
5 changed files with 77 additions and 47 deletions
|
|
@ -2,7 +2,7 @@ import { z } from 'zod';
|
|||
import { RelPath, Encoding, Stat, DirEntry, ReaddirOptions, ReadFileResult, WorkspaceChangeEvent, WriteFileOptions, WriteFileResult, RemoveOptions } from './workspace.js';
|
||||
import { ListToolsResponse } from './mcp.js';
|
||||
import { AskHumanResponsePayload, CreateRunOptions, Run, ListRunsResponse, ToolPermissionAuthorizePayload } from './runs.js';
|
||||
import { LlmModelConfig } from './models.js';
|
||||
import { LlmModelConfig, ConfiguredModelsResult } from './models.js';
|
||||
import { AgentScheduleConfig, AgentScheduleEntry } from './agent-schedule.js';
|
||||
import { AgentScheduleState } from './agent-schedule-state.js';
|
||||
import { ServiceEvent } from './service-events.js';
|
||||
|
|
@ -219,6 +219,10 @@ const ipcSchemas = {
|
|||
success: z.literal(true),
|
||||
}),
|
||||
},
|
||||
'models:getConfiguredModels': {
|
||||
req: z.null(),
|
||||
res: ConfiguredModelsResult,
|
||||
},
|
||||
'oauth:connect': {
|
||||
req: z.object({
|
||||
provider: z.string(),
|
||||
|
|
|
|||
|
|
@ -13,3 +13,17 @@ export const LlmModelConfig = z.object({
|
|||
models: z.array(z.string()).optional(),
|
||||
knowledgeGraphModel: z.string().optional(),
|
||||
});
|
||||
|
||||
export const ConfiguredModelEntry = z.object({
|
||||
flavor: LlmProvider.shape.flavor,
|
||||
model: z.string(),
|
||||
apiKey: z.string().optional(),
|
||||
baseURL: z.string().optional(),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
knowledgeGraphModel: z.string().optional(),
|
||||
});
|
||||
|
||||
export const ConfiguredModelsResult = z.object({
|
||||
models: z.array(ConfiguredModelEntry),
|
||||
activeModelKey: z.string(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue