An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: AI Agent https://github.com/siyuan-note/siyuan/issues/17797
Daniele32bc2fa7cef
diff --git a/kernel/agent/agent.go b/kernel/agent/agent.goindex 898dc1c219..48705e407e 100644--- a/kernel/agent/agent.go+++ b/kernel/agent/agent.go@@ -499,11 +499,11 @@ func AgentChat(ctx context.Context, client *openai.Client, model string, sessionreturn ch}-func GenerateTitle(client *openai.Client, model string, userMsg string, language string) string {+func GenerateTitle(client *openai.Client, model string, userMsg string) string {resp, err := client.CreateChatCompletion(context.Background(), openai.ChatCompletionRequest{Model: model,Messages: []openai.ChatCompletionMessage{- {Role: openai.ChatMessageRoleSystem, Content: "You are a title generator. Below is the first message of a conversation. Write a concise title (under 12 words) that summarizes the topic. Output ONLY the title, no other text."},+ {Role: openai.ChatMessageRoleSystem, Content: "You are a title generator. Below is the first message of a conversation. Write a concise title (under 12 words) that summarizes the topic. Output ONLY the title, no other text. Reply in the same language as the user's message."},{Role: openai.ChatMessageRoleUser, Content: "Conversation starts with: " + userMsg},},MaxCompletionTokens: 50,diff --git a/kernel/api/agent.go b/kernel/api/agent.goindex 5d464db6da..e52b493052 100644--- a/kernel/api/agent.go+++ b/kernel/api/agent.go@@ -198,7 +198,7 @@ func agentChatTitle(c *gin.Context) {selectedProvider.APIProvider,)- title := agent.GenerateTitle(client, selectedProvider.APIModel, req.Message, model.Conf.Lang)+ title := agent.GenerateTitle(client, selectedProvider.APIModel, req.Message)ret := gulu.Ret.NewResult()ret.Data = titlec.JSON(http.StatusOK, ret)