Skip to content

Commit c223b80

Browse files
committed
fix(playground/server): fix chat-template with templateSchema when content is array(image-upload) schemaJsonContext append error
1 parent e7c0123 commit c223b80

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sites/playground/server/src/chat-template.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ export const createChatTemplate = () => {
124124
\`\`\`
125125
`;
126126
if (messages.length > 0 && messages[messages.length - 1].role === 'user') {
127-
messages[messages.length - 1].content += schemaJsonContext;
127+
if (Array.isArray(messages[messages.length - 1].content)) {
128+
messages[messages.length - 1].content.push({
129+
type: 'text',
130+
text: schemaJsonContext,
131+
});
132+
} else {
133+
messages[messages.length - 1].content += schemaJsonContext;
134+
}
128135
} else {
129136
messages.push({
130137
role: 'user',

0 commit comments

Comments
 (0)