fix: 调整钉钉机器人场景的提示词

This commit is contained in:
fuzhongyun 2026-01-26 16:37:09 +08:00
parent c74fe839d8
commit 5560e879d0
1 changed files with 7 additions and 3 deletions

View File

@ -138,20 +138,24 @@ func (f *WithDingTalkBot) CreatePrompt(ctx context.Context, rec *entitys.Recogni
mes = append(prompt, api.Message{
Role: "system", // 系统角色
Content: rec.SystemPrompt, // 系统提示内容
// }, api.Message{ // 助手回复无需
// Role: "assistant", // 助手角色
// Content: "### 聊天记录:" + pkg.JsonStringIgonErr(rec.ChatHis), // 助手回复内容
}, api.Message{
Role: "assistant", // 助手角色
Content: "### 聊天记录:" + pkg.JsonStringIgonErr(rec.ChatHis), // 助手回复内容
Role: "assistant", // 助手角色
Content: "用户历史输入:" + pkg.JsonStringIgonErr(rec.ChatHis), // 用户历史输入
}, api.Message{
Role: "user", // 用户角色
Content: content.String(), // 用户输入内容
})
fmt.Printf("[意图识别]最终prompt:%v", mes)
return
}
func (f *WithDingTalkBot) getUserContent(ctx context.Context, rec *entitys.Recognize) (content strings.Builder, err error) {
var hasFile bool
if rec.UserContent.File != nil && len(rec.UserContent.File) > 0 {
if len(rec.UserContent.File) > 0 {
hasFile = true
}
content.WriteString(rec.UserContent.Text)