feat: XunFei ai mode api implements is ready

This commit is contained in:
RockYang
2023-10-11 18:17:03 +08:00
parent ff349f2edf
commit 12e7837602
4 changed files with 294 additions and 204 deletions

View File

@@ -67,8 +67,10 @@ var ModelToTokens = map[string]int{
"gpt-3.5-turbo-16k": 16384,
"gpt-4": 8192,
"gpt-4-32k": 32768,
"chatglm_pro": 32768,
"chatglm_pro": 32768, // 清华智普
"chatglm_std": 16384,
"chatglm_lite": 4096,
"ernie_bot_turbo": 8192, // 文心一言
"general": 8192, // 科大讯飞
"general2": 8192,
}

View File

@@ -36,6 +36,16 @@ func (wc *WsClient) Send(message []byte) error {
return wc.Conn.WriteMessage(wc.mt, message)
}
func (wc *WsClient) SendJson(value interface{}) error {
wc.lock.Lock()
defer wc.lock.Unlock()
if wc.Closed {
return ErrConClosed
}
return wc.Conn.WriteJSON(value)
}
func (wc *WsClient) Receive() (int, []byte, error) {
if wc.Closed {
return 0, nil, ErrConClosed