fix(hooks): slug generator respects configured default model
The slug generator was always using the hardcoded DEFAULT_MODEL (Opus) because it never passed provider/model to runEmbeddedPiAgent. Now it resolves the user's configured primary model via resolveConfiguredModelRef. Closes #4315
This commit is contained in:
parent
6af205a13a
commit
2f361e0e65
@ -5,6 +5,8 @@
|
|||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
|
||||||
|
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
||||||
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
||||||
import type { OpenClawConfig } from "../config/config.js";
|
import type { OpenClawConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
@ -38,6 +40,13 @@ ${params.sessionContent.slice(0, 2000)}
|
|||||||
|
|
||||||
Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design", "bug-fix"`;
|
Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design", "bug-fix"`;
|
||||||
|
|
||||||
|
// Respect the user's configured default model instead of always using Opus.
|
||||||
|
const modelRef = resolveConfiguredModelRef({
|
||||||
|
cfg: params.cfg,
|
||||||
|
defaultProvider: DEFAULT_PROVIDER,
|
||||||
|
defaultModel: DEFAULT_MODEL,
|
||||||
|
});
|
||||||
|
|
||||||
const result = await runEmbeddedPiAgent({
|
const result = await runEmbeddedPiAgent({
|
||||||
sessionId: `slug-generator-${Date.now()}`,
|
sessionId: `slug-generator-${Date.now()}`,
|
||||||
sessionKey: "temp:slug-generator",
|
sessionKey: "temp:slug-generator",
|
||||||
@ -46,6 +55,8 @@ Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design",
|
|||||||
agentDir,
|
agentDir,
|
||||||
config: params.cfg,
|
config: params.cfg,
|
||||||
prompt,
|
prompt,
|
||||||
|
provider: modelRef.provider,
|
||||||
|
model: modelRef.model,
|
||||||
timeoutMs: 15_000, // 15 second timeout
|
timeoutMs: 15_000, // 15 second timeout
|
||||||
runId: `slug-gen-${Date.now()}`,
|
runId: `slug-gen-${Date.now()}`,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user