-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加Feishu通道 #1336
base: browser-version
Are you sure you want to change the base?
添加Feishu通道 #1336
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,21 @@ class WecomBot(BaseModel): | |
"""企业微信应用 API 令牌 的 EncodingAESKey""" | ||
|
||
|
||
class FeishuBot(BaseModel): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (complexity): Consider refactoring common bot configuration properties into a base class. The addition of the One approach could be to refactor common properties among bot configurations into a base class. This base class could encapsulate properties like Here's a simplified example of how this could be structured: class BaseBotConfig(BaseModel):
port: int
debug: bool = False
token: str
app_id: Optional[str] = None
app_secret: Optional[str] = None
encrypt_key: Optional[str] = None
class FeishuBot(BaseBotConfig):
port: int = 9880
app_id: str
app_secret: str
# Inherits debug, token, and encrypt_key from BaseBotConfig
class Config(BaseModel):
# Other platform settings...
feishu: Optional[FeishuBot] = None
# Account Settings... This approach could make the codebase easier to maintain and extend, especially as more configurations are added. It's a suggestion to consider how the current implementation might evolve and how to manage complexity effectively. |
||
port: int = 9880 | ||
"""飞书回调端口号, 默认9880""" | ||
debug: bool = False | ||
"""是否开启debug,错误时展示日志""" | ||
app_id: str | ||
"""飞书应用 的 App ID""" | ||
app_secret: str | ||
"""飞书应用 的 Secret""" | ||
token: str | ||
"""飞书应用 API 加密策略 的 Verification Token""" | ||
encrypt_key: Optional[str] = None | ||
Comment on lines
+81
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (code_refinement): Consider adding type hints for clarity and consistency. Adding type hints for the class attributes would enhance code readability and maintain consistency with the rest of the codebase. |
||
"""飞书应用的加密策略 encrypt_key""" | ||
|
||
|
||
class OpenAIParams(BaseModel): | ||
temperature: float = 0.5 | ||
max_tokens: int = 4000 | ||
|
@@ -560,6 +575,7 @@ class Config(BaseModel): | |
discord: Optional[DiscordBot] = None | ||
http: Optional[HttpService] = None | ||
wecom: Optional[WecomBot] = None | ||
feishu: Optional[FeishuBot] = None | ||
|
||
# === Account Settings === | ||
openai: OpenAIAuths = OpenAIAuths() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ class BotPlatform(Enum): | |
TelegramBot = "telegram" | ||
HttpService = "http" | ||
WecomBot = "wecom" | ||
FeishuBot = "feishu" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Duplicate task creation for bots may lead to unintended behavior.
It appears that
start_task()
is being called and appended tobots
twice in succession without any conditional checks in between. This might result in the same task being started twice unintentionally.