79 lines
2.0 KiB
TypeScript
79 lines
2.0 KiB
TypeScript
import {
|
|
buildAgentToolImageMarkdown,
|
|
buildAgentToolVideoMarkdown,
|
|
prependImageModelBadge,
|
|
} from "@/lib/ai/runtime/agent-media-markdown";
|
|
import {
|
|
getDirectAgentToolLabel,
|
|
getDirectAgentToolSuccessMessage,
|
|
type DirectAgentToolCapability,
|
|
} from "@/lib/ai/runtime/direct-agent-execution";
|
|
|
|
export function buildDirectAgentAnalysisAssistantText(params: {
|
|
summary: string;
|
|
answer?: string | null;
|
|
}) {
|
|
const answer = String(params.answer || "").trim();
|
|
return prependImageModelBadge(
|
|
[
|
|
getDirectAgentToolSuccessMessage("analyze"),
|
|
`图像观察:\n${String(params.summary || "").trim()}`,
|
|
answer ? `分析结论:\n${answer}` : "",
|
|
]
|
|
.filter(Boolean)
|
|
.join("\n\n"),
|
|
getDirectAgentToolLabel("analyze"),
|
|
);
|
|
}
|
|
|
|
export function buildDirectAgentImageGenerationAssistantText(params: {
|
|
imageMarkdown: string;
|
|
modelDisplayName?: string | null;
|
|
}) {
|
|
return prependImageModelBadge(
|
|
[
|
|
getDirectAgentToolSuccessMessage("generate_image"),
|
|
params.imageMarkdown,
|
|
]
|
|
.filter(Boolean)
|
|
.join("\n\n"),
|
|
params.modelDisplayName,
|
|
);
|
|
}
|
|
|
|
export function buildDirectAgentVideoGenerationAssistantText(params: {
|
|
videoUrl: string;
|
|
modelDisplayName?: string | null;
|
|
}) {
|
|
return prependImageModelBadge(
|
|
[
|
|
getDirectAgentToolSuccessMessage("generate_video"),
|
|
buildAgentToolVideoMarkdown(params.videoUrl),
|
|
]
|
|
.filter(Boolean)
|
|
.join("\n\n"),
|
|
params.modelDisplayName,
|
|
);
|
|
}
|
|
|
|
export function buildDirectAgentImageEditAssistantText(params: {
|
|
capability: DirectAgentToolCapability;
|
|
originalUrl: string;
|
|
thumbnailUrl?: string | null;
|
|
imageSize?: string;
|
|
}) {
|
|
return prependImageModelBadge(
|
|
[
|
|
getDirectAgentToolSuccessMessage(params.capability),
|
|
buildAgentToolImageMarkdown({
|
|
originalUrl: params.originalUrl,
|
|
thumbnailUrl: params.thumbnailUrl,
|
|
imageSize: params.imageSize,
|
|
}),
|
|
]
|
|
.filter(Boolean)
|
|
.join("\n\n"),
|
|
getDirectAgentToolLabel(params.capability),
|
|
);
|
|
}
|