mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
opt: add tip message when no available key
This commit is contained in:
parent
5037df744f
commit
a868a8a8b7
@ -197,6 +197,10 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session types.ChatSession
|
||||
if strings.Contains(err.Error(), "context canceled") {
|
||||
logger.Info("用户取消了请求:", prompt)
|
||||
return nil
|
||||
} else if strings.Contains(err.Error(), "no available key") {
|
||||
replyMessage(ws, "抱歉😔😔😔,系统已经没有可用的 API KEY🔑,您可以导入自己的 API KEY🔑 继续使用!🙏🙏🙏")
|
||||
replyMessage(ws, "")
|
||||
return nil
|
||||
} else {
|
||||
logger.Error(err)
|
||||
}
|
||||
@ -414,7 +418,7 @@ func (h *ChatHandler) doRequest(ctx context.Context, user vo.User, apiKey *strin
|
||||
var key model.ApiKey
|
||||
res := h.db.Where("user_id = ?", 0).Order("last_used_at ASC").First(&key)
|
||||
if res.Error != nil {
|
||||
return nil, errors.New("no available key, please import key")
|
||||
return nil, errors.New("no available key")
|
||||
}
|
||||
*apiKey = key.Value
|
||||
// 更新 API KEY 的最后使用时间
|
||||
|
@ -31,7 +31,7 @@ const sendMsg = () => {
|
||||
httpGet('/api/verify/token').then(res => {
|
||||
httpPost('/api/verify/sms', {token: res.data, mobile: props.mobile}).then(() => {
|
||||
ElMessage.success('短信发送成功')
|
||||
let time = 10
|
||||
let time = 120
|
||||
btnText.value = time
|
||||
const handler = setInterval(() => {
|
||||
time = time - 1
|
||||
|
Loading…
Reference in New Issue
Block a user