mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
Fix messageTransformer to normalize HookMessage string content to array
HookMessage.content can be string or array, but LLM Message.content must be an array. This was causing 'messages: at least one message is required' errors when hooks sent string content.
This commit is contained in:
parent
204d27581b
commit
574f1cba3d
1 changed files with 3 additions and 1 deletions
|
|
@ -116,9 +116,11 @@ export function messageTransformer(messages: AppMessage[]): Message[] {
|
|||
}
|
||||
if (isHookMessage(m)) {
|
||||
// Convert hook message to user message for LLM
|
||||
// Normalize string content to array format
|
||||
const content = typeof m.content === "string" ? [{ type: "text" as const, text: m.content }] : m.content;
|
||||
return {
|
||||
role: "user",
|
||||
content: m.content,
|
||||
content,
|
||||
timestamp: m.timestamp,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue