feat(HAI-098): add model selection and configuration support
- Extend Settings type with model provider and model name fields - Add backend API endpoint to list available models - Add frontend API client for fetching models - Add model settings section to SettingsModal with provider/model dropdowns - Update engine executor to use the selected model from settings
This commit is contained in:
@@ -317,6 +317,21 @@ describe("TaskStore", () => {
|
||||
|
||||
// ── Settings tests ────────────────────────────────────────────────
|
||||
|
||||
describe("model settings", () => {
|
||||
it("persists defaultProvider and defaultModelId and returns them via getSettings", async () => {
|
||||
await store.updateSettings({ defaultProvider: "anthropic", defaultModelId: "claude-sonnet-4-5" });
|
||||
const settings = await store.getSettings();
|
||||
expect(settings.defaultProvider).toBe("anthropic");
|
||||
expect(settings.defaultModelId).toBe("claude-sonnet-4-5");
|
||||
});
|
||||
|
||||
it("default settings do not include model fields", async () => {
|
||||
const settings = await store.getSettings();
|
||||
expect(settings.defaultProvider).toBeUndefined();
|
||||
expect(settings.defaultModelId).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("worktreeInitCommand setting", () => {
|
||||
it("persists worktreeInitCommand and returns it via getSettings", async () => {
|
||||
await store.updateSettings({ worktreeInitCommand: "pnpm install" });
|
||||
|
||||
@@ -99,6 +99,14 @@ export interface Settings {
|
||||
* commit scope (e.g. `feat(HAI-001): ...`). When false, the scope is
|
||||
* omitted (e.g. `feat: ...`). Default: true. */
|
||||
includeTaskIdInCommit?: boolean;
|
||||
/** Default AI model provider name (e.g. `"anthropic"`, `"openai"`).
|
||||
* Must be set together with `defaultModelId`. When both are undefined,
|
||||
* the engine uses pi's automatic model resolution. */
|
||||
defaultProvider?: string;
|
||||
/** Default AI model ID within the provider (e.g. `"claude-sonnet-4-5"`).
|
||||
* Must be set together with `defaultProvider`. When both are undefined,
|
||||
* the engine uses pi's automatic model resolution. */
|
||||
defaultModelId?: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: Settings = {
|
||||
@@ -111,6 +119,8 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
recycleWorktrees: false,
|
||||
taskPrefix: undefined,
|
||||
includeTaskIdInCommit: true,
|
||||
defaultProvider: undefined,
|
||||
defaultModelId: undefined,
|
||||
};
|
||||
|
||||
export interface BoardConfig {
|
||||
|
||||
Reference in New Issue
Block a user