fix: finalize inbound contexts
This commit is contained in:
@@ -81,6 +81,8 @@ describe("applyMediaUnderstanding", () => {
|
||||
expect(ctx.Body).toBe("[Audio]\nTranscript:\ntranscribed text");
|
||||
expect(ctx.CommandBody).toBe("transcribed text");
|
||||
expect(ctx.RawBody).toBe("transcribed text");
|
||||
expect(ctx.BodyForAgent).toBe(ctx.Body);
|
||||
expect(ctx.BodyForCommands).toBe("transcribed text");
|
||||
});
|
||||
|
||||
it("handles URL-only attachments for audio transcription", async () => {
|
||||
@@ -254,6 +256,8 @@ describe("applyMediaUnderstanding", () => {
|
||||
expect(ctx.Body).toBe("[Image]\nUser text:\nshow Dom\nDescription:\nimage description");
|
||||
expect(ctx.CommandBody).toBe("show Dom");
|
||||
expect(ctx.RawBody).toBe("show Dom");
|
||||
expect(ctx.BodyForAgent).toBe(ctx.Body);
|
||||
expect(ctx.BodyForCommands).toBe("show Dom");
|
||||
});
|
||||
|
||||
it("uses shared media models list when capability config is missing", async () => {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import type { MsgContext } from "../auto-reply/templating.js";
|
||||
import { applyTemplate } from "../auto-reply/templating.js";
|
||||
import { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js";
|
||||
import { resolveApiKeyForProvider } from "../agents/model-auth.js";
|
||||
import { ensureClawdbotModelsJson } from "../agents/models-config.js";
|
||||
import { minimaxUnderstandImage } from "../agents/minimax-vlm.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../globals.js";
|
||||
import { runExec } from "../process/exec.js";
|
||||
import type {
|
||||
@@ -449,6 +452,7 @@ export async function applyMediaUnderstanding(params: {
|
||||
ctx.RawBody = originalUserText;
|
||||
}
|
||||
ctx.MediaUnderstanding = [...(ctx.MediaUnderstanding ?? []), ...outputs];
|
||||
finalizeInboundContext(ctx, { forceBodyForAgent: true, forceBodyForCommands: true });
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user