-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathai_flow.go
44 lines (39 loc) · 868 Bytes
/
ai_flow.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
)
func flow(ai Ai, client *resty.Client, prompt string) AiReqBodyMessage {
var flowPrompts = getFlowPrompt()
log.Info("开启AI-FLOW......")
var userMsgs = []AiReqBodyMessage{
{
Role: "system",
Content: flowPrompts[0],
},
{
Role: "user",
Content: prompt,
},
}
var msgs1 = ai.request(client, userMsgs)
var messagesBoss = []AiReqBodyMessage{
{
Role: "system",
Content: flowPrompts[1],
},
{
Role: "user",
Content: msgs1.Content,
},
}
var msgs2 = ai.request(client, messagesBoss)
userMsgs = append(userMsgs, msgs1)
userMsgs = append(userMsgs, AiReqBodyMessage{
Role: "user",
Content: flowPrompts[2] + msgs2.Content,
})
var res = ai.request(client, userMsgs)
log.Info("已关闭AI-FLOW......")
return res
}