fixed bug for markmap

This commit is contained in:
RockYang 2024-04-23 20:47:06 +08:00
parent 90f5275201
commit 2933c057a2
2 changed files with 4 additions and 3 deletions

View File

@ -190,8 +190,10 @@ func (h *MarkMapHandler) doRequest(req types.ApiRequest, chatModel model.ChatMod
res = h.DB.Where("id", chatModel.KeyId).Find(apiKey)
}
// use the last unused key
if res.Error != nil {
res = h.DB.Where("platform = ?", types.OpenAI).Where("type = ?", "chat").Where("enabled = ?", true).Order("last_used_at ASC").First(apiKey)
if apiKey.Id == 0 {
res = h.DB.Where("platform", types.OpenAI).
Where("type", "chat").
Where("enabled", true).Order("last_used_at ASC").First(apiKey)
}
if res.Error != nil {
return nil, errors.New("no available key, please import key")

View File

@ -230,7 +230,6 @@ const connect = (userId) => {
const _socket = new WebSocket(host + `/api/markMap/client?user_id=${userId}&model_id=${modelID.value}`);
_socket.addEventListener('open', () => {
socket.value = _socket;
//
sendHeartbeat()
});