debug: add responsePrefix template logging
This commit is contained in:
@@ -127,6 +127,9 @@ export async function runAgentTurnWithFallback(params: {
|
|||||||
run: (provider, model) => {
|
run: (provider, model) => {
|
||||||
// Notify that model selection is complete (including after fallback).
|
// Notify that model selection is complete (including after fallback).
|
||||||
// This allows responsePrefix template interpolation with the actual model.
|
// This allows responsePrefix template interpolation with the actual model.
|
||||||
|
logVerbose(
|
||||||
|
`[responsePrefix] onModelSelected callback exists: ${!!params.opts?.onModelSelected}, provider=${provider}, model=${model}`,
|
||||||
|
);
|
||||||
params.opts?.onModelSelected?.({
|
params.opts?.onModelSelected?.({
|
||||||
provider,
|
provider,
|
||||||
model,
|
model,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { logVerbose } from "../../globals.js";
|
||||||
import { stripHeartbeatToken } from "../heartbeat.js";
|
import { stripHeartbeatToken } from "../heartbeat.js";
|
||||||
import { HEARTBEAT_TOKEN, isSilentReplyText, SILENT_REPLY_TOKEN } from "../tokens.js";
|
import { HEARTBEAT_TOKEN, isSilentReplyText, SILENT_REPLY_TOKEN } from "../tokens.js";
|
||||||
import type { ReplyPayload } from "../types.js";
|
import type { ReplyPayload } from "../types.js";
|
||||||
@@ -43,9 +44,17 @@ export function normalizeReplyPayload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve template variables in responsePrefix if context is provided
|
// Resolve template variables in responsePrefix if context is provided
|
||||||
|
if (opts.responsePrefix?.includes("{")) {
|
||||||
|
logVerbose(
|
||||||
|
`[responsePrefix] normalizing: prefix="${opts.responsePrefix}", context=${JSON.stringify(opts.responsePrefixContext)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
const effectivePrefix = opts.responsePrefixContext
|
const effectivePrefix = opts.responsePrefixContext
|
||||||
? resolveResponsePrefixTemplate(opts.responsePrefix, opts.responsePrefixContext)
|
? resolveResponsePrefixTemplate(opts.responsePrefix, opts.responsePrefixContext)
|
||||||
: opts.responsePrefix;
|
: opts.responsePrefix;
|
||||||
|
if (opts.responsePrefix?.includes("{") && effectivePrefix !== opts.responsePrefix) {
|
||||||
|
logVerbose(`[responsePrefix] resolved to: "${effectivePrefix}"`);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
effectivePrefix &&
|
effectivePrefix &&
|
||||||
|
|||||||
@@ -163,10 +163,14 @@ export const dispatchTelegramMessage = async ({
|
|||||||
disableBlockStreaming,
|
disableBlockStreaming,
|
||||||
onModelSelected: (ctx) => {
|
onModelSelected: (ctx) => {
|
||||||
// Mutate the object directly instead of reassigning to ensure the closure sees updates
|
// Mutate the object directly instead of reassigning to ensure the closure sees updates
|
||||||
|
logVerbose(
|
||||||
|
`[responsePrefix] telegram onModelSelected fired: provider=${ctx.provider}, model=${ctx.model}, thinkLevel=${ctx.thinkLevel}`,
|
||||||
|
);
|
||||||
prefixContext.provider = ctx.provider;
|
prefixContext.provider = ctx.provider;
|
||||||
prefixContext.model = extractShortModelName(ctx.model);
|
prefixContext.model = extractShortModelName(ctx.model);
|
||||||
prefixContext.modelFull = `${ctx.provider}/${ctx.model}`;
|
prefixContext.modelFull = `${ctx.provider}/${ctx.model}`;
|
||||||
prefixContext.thinkingLevel = ctx.thinkLevel ?? "off";
|
prefixContext.thinkingLevel = ctx.thinkLevel ?? "off";
|
||||||
|
logVerbose(`[responsePrefix] telegram prefixContext updated: ${JSON.stringify(prefixContext)}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user