mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 13:00:14 +09:00
fix claude system message
This commit is contained in:
parent
12f497a655
commit
1b161f9264
@ -60,6 +60,12 @@ func (c *ChatInstance) ConvertMessages(props *adaptercommon.ChatProps) []globals
|
||||
result := make([]globals.Message, 0)
|
||||
|
||||
for _, message := range props.Message {
|
||||
|
||||
// System message is set when constructing Chatbody
|
||||
if message.Role == globals.System {
|
||||
continue
|
||||
}
|
||||
|
||||
// if is first message, set it to user message
|
||||
if !start {
|
||||
start = true
|
||||
@ -70,11 +76,6 @@ func (c *ChatInstance) ConvertMessages(props *adaptercommon.ChatProps) []globals
|
||||
continue
|
||||
}
|
||||
|
||||
// if is system message, set it to user message
|
||||
if message.Role == globals.System {
|
||||
continue
|
||||
}
|
||||
|
||||
// anthropic api does not allow multi-same role messages
|
||||
if len(result) > 0 && result[len(result)-1].Role == message.Role {
|
||||
result[len(result)-1].Content += "\n" + message.Content
|
||||
|
Loading…
Reference in New Issue
Block a user