fix: 调整历史聊天记录
This commit is contained in:
parent
5046e31b63
commit
f94738f7e7
|
|
@ -39,6 +39,9 @@ func (f *WithSys) CreatePrompt(ctx context.Context, rec *entitys.Recognize) (mes
|
||||||
// }, api.Message{ // 助手回复无需
|
// }, api.Message{ // 助手回复无需
|
||||||
// Role: "assistant", // 助手角色
|
// Role: "assistant", // 助手角色
|
||||||
// Content: "### 聊天记录:" + pkg.JsonStringIgonErr(rec.ChatHis), // 助手回复内容
|
// Content: "### 聊天记录:" + pkg.JsonStringIgonErr(rec.ChatHis), // 助手回复内容
|
||||||
|
}, api.Message{
|
||||||
|
Role: "user", // 用户角色
|
||||||
|
Content: "历史聊天记录:" + pkg.JsonStringIgonErr(rec.ChatHis), // 用户输入内容
|
||||||
}, api.Message{
|
}, api.Message{
|
||||||
Role: "user", // 用户角色
|
Role: "user", // 用户角色
|
||||||
Content: content.String(), // 用户输入内容
|
Content: content.String(), // 用户输入内容
|
||||||
|
|
@ -63,10 +66,10 @@ func (f *WithSys) getUserContent(ctx context.Context, rec *entitys.Recognize) (c
|
||||||
content.WriteString(rec.UserContent.Tag)
|
content.WriteString(rec.UserContent.Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rec.ChatHis.Messages) > 0 {
|
// if len(rec.ChatHis.Messages) > 0 {
|
||||||
content.WriteString("### 引用历史聊天记录:\n")
|
// content.WriteString("### 引用历史聊天记录:\n")
|
||||||
content.WriteString(pkg.JsonStringIgonErr(rec.ChatHis))
|
// content.WriteString(pkg.JsonStringIgonErr(rec.ChatHis))
|
||||||
}
|
// }
|
||||||
|
|
||||||
if hasFile {
|
if hasFile {
|
||||||
content.WriteString("\n")
|
content.WriteString("\n")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue