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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user