Browse Source

Update claude_ai_bot.py

master
resphina GitHub 1 year ago
parent
commit
f7cd348912
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      bot/claude/claude_ai_bot.py

+ 3
- 2
bot/claude/claude_ai_bot.py View File

@@ -70,10 +70,10 @@ class ClaudeAIBot(Bot, OpenAIImage):
uuid = res[0]['uuid'] uuid = res[0]['uuid']
except: except:
if "App unavailable" in response.text: if "App unavailable" in response.text:
logger.warn("The IP is not allowed to be used on Claude")
logger.error("IP error: The IP is not allowed to be used on Claude")
self.error = "ip所在地区不被claude支持" self.error = "ip所在地区不被claude支持"
elif "Invalid authorization" in response.text: elif "Invalid authorization" in response.text:
logger.warn("Cookie error: Invalid authorization of claude, check cookie please.")
logger.error("Cookie error: Invalid authorization of claude, check cookie please.")
self.error = "无法通过claude身份验证,请检查cookie" self.error = "无法通过claude身份验证,请检查cookie"
return None return None
return uuid return uuid
@@ -192,6 +192,7 @@ class ClaudeAIBot(Bot, OpenAIImage):
reply_content = ''.join(completions) reply_content = ''.join(completions)


if "rate limi" in reply_content: if "rate limi" in reply_content:
logger.error("rate limit error: 对话达到系统速率限制,与cladue同步,请进入官网查看解除限制时间")
return Reply(ReplyType.ERROR, "对话达到系统速率限制,与cladue同步,请进入官网查看解除限制时间") return Reply(ReplyType.ERROR, "对话达到系统速率限制,与cladue同步,请进入官网查看解除限制时间")
logger.info(f"[CLAUDE] reply={reply_content}, total_tokens=invisible") logger.info(f"[CLAUDE] reply={reply_content}, total_tokens=invisible")
self.sessions.session_reply(reply_content, session_id, 100) self.sessions.session_reply(reply_content, session_id, 100)


Loading…
Cancel
Save