Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: AI Agent panel https://github.com/siyuan-note/siyuan/issues/17797

Daniel565d1d0e1709
diff --git a/kernel/agent/agent.go b/kernel/agent/agent.go
index b9e1758b80..8fce19fcf4 100644
--- a/kernel/agent/agent.go
+++ b/kernel/agent/agent.go
@@ -214,9 +214,13 @@ func AgentChat(ctx context.Context, client *openai.Client, model string, history
continue
}
+ content := contentBuilder.String()
+ if content == "" {
+ content = " "
+ }
messages = append(messages, openai.ChatCompletionMessage{
Role: openai.ChatMessageRoleAssistant,
- Content: contentBuilder.String(),
+ Content: content,
})
ch <- AgentEvent{Type: "usage", PromptTokens: totalPrompt, CompletionTokens: totalCompletion}