Merge 7c42248d4915416e2656982fd864d987f18b7dde into 6b4c24c2e55b5b4013277bd799525086f6a0c40f

This commit is contained in:
sxin 2026-03-21 04:45:11 +00:00 committed by GitHub
commit f3fb87747f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -276,6 +276,10 @@ const saveSessionToMemory: HookHandler = async (event) => {
typeof hookConfig?.messages === "number" && hookConfig.messages > 0
? hookConfig.messages
: 15;
const slugTimeoutMs =
typeof hookConfig?.slugTimeoutMs === "number" && hookConfig.slugTimeoutMs > 0
? hookConfig.slugTimeoutMs
: undefined;
let slug: string | null = null;
let sessionContent: string | null = null;
@ -299,7 +303,7 @@ const saveSessionToMemory: HookHandler = async (event) => {
if (sessionContent && cfg && allowLlmSlug) {
log.debug("Calling generateSlugViaLLM...");
// Use LLM to generate a descriptive slug
slug = await generateSlugViaLLM({ sessionContent, cfg });
slug = await generateSlugViaLLM({ sessionContent, cfg, timeoutMs: slugTimeoutMs });
log.debug("Generated slug", { slug });
}
}

View File

@ -25,6 +25,7 @@ const log = createSubsystemLogger("llm-slug-generator");
export async function generateSlugViaLLM(params: {
sessionContent: string;
cfg: OpenClawConfig;
timeoutMs?: number;
}): Promise<string | null> {
let tempSessionFile: string | null = null;
@ -61,7 +62,7 @@ Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design",
prompt,
provider,
model,
timeoutMs: 15_000, // 15 second timeout
timeoutMs: params.timeoutMs ?? 15_000,
runId: `slug-gen-${Date.now()}`,
});