This commit is contained in:
c菌
2023-09-16 19:39:42 +08:00
parent 69cd825180
commit 71872171c9

View File

@@ -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 {