-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
107 lines (87 loc) · 2.29 KB
/
types.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package edge
import (
"fmt"
"sync"
)
type Options struct {
headers map[string]string // 默认请求头
temperature float32 // 温度调节:通过不同温度调节对话模式
kievRPSSecAuth string //
rwBf string //
topicToE bool // topic警告是否作为错误返回
notebook bool // 文档模式
plugins []string // 插件
model string // 对话模式
retry int // 重试次数
proxies string // 本地代理
middle string // 中间转发地址
muId string // 设备Id?
wss string // 对话链接
create string // 创建会话链接
}
type Chat struct {
Options
mu sync.Mutex
session *Conversation
}
type KBlob struct {
BlobId string `json:"blobId"`
ProcessedBlobId string `json:"processedBlobId"`
}
type Conversation struct {
ConversationId string `json:"conversationId"`
ClientId string `json:"clientId"`
Result struct {
Value string `json:"value"`
Message interface{} `json:"message"`
} `json:"result"`
traceId string
invocationId int
accessToken string
}
type partialResponse struct {
Error string `json:"error"`
Type int `json:"type"`
InvocationId string `json:"invocationId"`
Args []struct {
RequestId string `json:"requestId"`
Messages *[]struct {
Text string `json:"text"`
HiddenText string `json:"hiddenText"`
MessageType string `json:"messageType"`
} `json:"messages"`
} `json:"arguments"`
Item *struct {
Result struct {
Message string `json:"message"`
Value string `json:"value"`
} `json:"result"`
Messages *[]struct {
Author string `json:"author"`
Text string `json:"text"`
Type string `json:"messageType"`
SpokenText string `json:"spokenText"`
} `json:"messages"`
T *struct {
Max int `json:"maxNumUserMessagesInConversation"`
Used int `json:"numUserMessagesInConversation"`
} `json:"throttling"`
} `json:"item"`
}
type ChatMessage = map[string]string
type ChatResponse struct {
Text string
Error *ChatError
RawData []byte
T *struct {
Max int
Used int
}
}
type ChatError struct {
Action string
Message error
}
func (c ChatError) Error() string {
return fmt.Sprintf("[EDGE-API::%s] %v", c.Action, c.Message)
}