From 71872171c9b712ada91120210b470c5346569dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=E8=8F=8C?= Date: Sat, 16 Sep 2023 19:39:42 +0800 Subject: [PATCH] update --- pkg/claude/claude.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/claude/claude.go b/pkg/claude/claude.go index 8e99647..5036eab 100644 --- a/pkg/claude/claude.go +++ b/pkg/claude/claude.go @@ -243,12 +243,12 @@ func TransReq(chatreq *openai.ChatCompletionRequest) (*bytes.Buffer, error) { var prompt string for _, msg := range chatreq.Messages { switch msg.Role { + case "system": + prompt += fmt.Sprintf("\n\nHuman:%s", msg.Content) case "user": prompt += fmt.Sprintf("\n\nHuman:%s", msg.Content) case "assistant": prompt += fmt.Sprintf("\n\nAssistant:%s", msg.Content) - case "system": - prompt += fmt.Sprintf("\n\nSystem:%s", msg.Content) } } transReq.Prompt = prompt + "\n\nAssistant:" @@ -294,6 +294,7 @@ func TransRsp(c *gin.Context, isStream bool, reader *bufio.Reader) { dataChan = make(chan string) stopChan = make(chan bool) ) + wg.Add(2) go func() { defer wg.Done() for {