Update everything server to sampling output (can now be array of content)

This commit is contained in:
Olivier Chafik
2025-11-22 18:51:57 +00:00
parent 33e029f1d9
commit 5f1820233c

View File

@@ -619,9 +619,13 @@ export const createServer = () => {
maxTokens,
extra.sendRequest
);
const content = Array.isArray(result.content) ? result.content : [result.content];
const textResult = content.every((c) => c.type === "text")
? content.map(c => c.text).join("\n")
: JSON.stringify(result.content);
return {
content: [
{ type: "text", text: `LLM sampling result: ${result.content.text}` },
{ type: "text", text: `LLM sampling result: ${textResult}` },
],
};
}