捕获缺少依赖时的异常
This commit is contained in:
parent
c43e22bc41
commit
77a2d62ef6
@ -6,19 +6,19 @@ import importlib
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from toolbox import get_conf
|
from toolbox import get_conf
|
||||||
from slack_sdk.errors import SlackApiError
|
|
||||||
from slack_sdk.web.async_client import AsyncWebClient
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
load_message = "正在加载Claude组件,请稍候..."
|
||||||
|
|
||||||
|
try:
|
||||||
"""
|
"""
|
||||||
========================================================================
|
========================================================================
|
||||||
第一部分:Slack API Client
|
第一部分:Slack API Client
|
||||||
https://github.com/yokonsan/claude-in-slack-api
|
https://github.com/yokonsan/claude-in-slack-api
|
||||||
========================================================================
|
========================================================================
|
||||||
"""
|
"""
|
||||||
load_message = "正在加载Claude组件,请稍候..."
|
|
||||||
|
|
||||||
|
from slack_sdk.errors import SlackApiError
|
||||||
|
from slack_sdk.web.async_client import AsyncWebClient
|
||||||
|
|
||||||
class SlackClient(AsyncWebClient):
|
class SlackClient(AsyncWebClient):
|
||||||
"""SlackClient类用于与Slack API进行交互,实现消息发送、接收等功能。
|
"""SlackClient类用于与Slack API进行交互,实现消息发送、接收等功能。
|
||||||
@ -69,7 +69,8 @@ class SlackClient(AsyncWebClient):
|
|||||||
else:
|
else:
|
||||||
yield True, msg["text"]
|
yield True, msg["text"]
|
||||||
break
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
"""
|
"""
|
||||||
========================================================================
|
========================================================================
|
||||||
@ -87,6 +88,7 @@ class ClaudeHandle(Process):
|
|||||||
self.success = True
|
self.success = True
|
||||||
self.local_history = []
|
self.local_history = []
|
||||||
self.check_dependency()
|
self.check_dependency()
|
||||||
|
if self.success:
|
||||||
self.start()
|
self.start()
|
||||||
self.threadLock = threading.Lock()
|
self.threadLock = threading.Lock()
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ class ClaudeHandle(Process):
|
|||||||
self.info = "依赖检测通过,等待Claude响应。注意目前不能多人同时调用Claude接口(有线程锁),否则将导致每个人的Claude问询历史互相渗透。调用Claude时,会自动使用已配置的代理。"
|
self.info = "依赖检测通过,等待Claude响应。注意目前不能多人同时调用Claude接口(有线程锁),否则将导致每个人的Claude问询历史互相渗透。调用Claude时,会自动使用已配置的代理。"
|
||||||
self.success = True
|
self.success = True
|
||||||
except:
|
except:
|
||||||
self.info = "缺少的依赖,如果要使用Claude,除了基础的pip依赖以外,您还需要运行`pip install -r request_llm/requirements_claude.txt`安装Claude的依赖。"
|
self.info = "缺少的依赖,如果要使用Claude,除了基础的pip依赖以外,您还需要运行`pip install -r request_llm/requirements_slackclaude.txt`安装Claude的依赖。"
|
||||||
self.success = False
|
self.success = False
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user