Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ack): use discord.py v2 typing API and default ack_mode to typing

cyhhaoc32e7e78b1d9
diff --git a/config/v2_config.py b/config/v2_config.py
index c39e4d22c..18b5d70db 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -193,7 +193,7 @@ class V2Config:
gateway: Optional[GatewayConfig] = None
ui: UiConfig = field(default_factory=UiConfig)
update: UpdateConfig = field(default_factory=UpdateConfig)
- ack_mode: str = "reaction"
+ ack_mode: str = "typing"
show_duration: bool = True # Show task duration in result messages
include_user_info: bool = True # Prepend user identity to agent messages
reply_enhancements: bool = True # Enable file sending & quick-reply buttons
@@ -327,7 +327,7 @@ class V2Config:
raise ValueError("Config 'update' must be an object")
update = UpdateConfig(**_filter_dataclass_fields(UpdateConfig, update_payload))
- ack_mode = payload.get("ack_mode", "reaction")
+ ack_mode = payload.get("ack_mode", "typing")
if ack_mode not in {"reaction", "message", "typing"}:
raise ValueError("Config 'ack_mode' must be 'reaction', 'message', or 'typing'")
diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.py
index 4db0b036f..f7ccfd757 100644
--- a/core/handlers/message_handler.py
+++ b/core/handlers/message_handler.py
@@ -52,7 +52,7 @@ class MessageHandler(BaseHandler):
platform = self._get_context_platform(context)
if platform == "wechat":
return True
- return getattr(self.config, "ack_mode", "reaction") == "typing"
+ return getattr(self.config, "ack_mode", "typing") == "typing"
async def _typing_keepalive_loop(self, context: MessageContext) -> None:
im_client = self._get_im_client(context)
@@ -215,7 +215,7 @@ class MessageHandler(BaseHandler):
composite_key = f"{base_session_id}:{working_path}"
ack_message_id = None
- ack_mode = getattr(self.config, "ack_mode", "reaction")
+ ack_mode = getattr(self.config, "ack_mode", "typing")
effective_ack_mode = "typing" if self._get_context_platform(context) == "wechat" else ack_mode
if effective_ack_mode == "message":
ack_context = self._get_target_context(context)
@@ -503,7 +503,7 @@ class MessageHandler(BaseHandler):
logger.debug(f"Failed to send quick-reply echo message: {err}")
# Add ack reaction on the echo message before dispatching.
- if quick_reply_echo_id and getattr(self.config, "ack_mode", "reaction") == "reaction":
+ if quick_reply_echo_id and getattr(self.config, "ack_mode", "typing") == "reaction":
try:
await im_client.add_reaction(
self._get_target_context(context),
diff --git a/modules/im/discord.py b/modules/im/discord.py
index e33b5ed0d..918675991 100644
--- a/modules/im/discord.py
+++ b/modules/im/discord.py
@@ -449,32 +449,21 @@ class DiscordBot(BaseIMClient):
if context.thread_id:
target = await self._fetch_channel(context.thread_id)
if not isinstance(target, discord.Thread):
- logger.info(
- "Discord typing: thread_id %s resolved to %s (not Thread), falling back to channel_id",
- context.thread_id,
- type(target).__name__ if target else None,
- )
target = None
if target is None:
target = await self._fetch_channel(context.channel_id)
if target is None:
- logger.info(
- "Discord typing: could not fetch channel (channel_id=%s, thread_id=%s)",
- context.channel_id,
- context.thread_id,
- )
return False
- trigger = getattr(target, "trigger_typing", None)
- if not callable(trigger):
- logger.info("Discord typing: %s has no trigger_typing method", type(target).__name__)
+ typing_method = getattr(target, "typing", None)
+ if not callable(typing_method):
return False
try:
- await trigger()
+ await typing_method()
return True
except Exception as err:
- logger.info("Discord typing: trigger_typing failed: %s", err)
+ logger.debug("Failed to trigger Discord typing indicator: %s", err)
return False
async def clear_typing_indicator(self, context: MessageContext) -> bool:
diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsx
index 5c7493bba..e314c1252 100644
--- a/ui/src/components/Dashboard.tsx
+++ b/ui/src/components/Dashboard.tsx
@@ -291,9 +291,9 @@ export const Dashboard: React.FC = () => {
</span>
</span>
<select
- value={config.ack_mode || 'reaction'}
+ value={config.ack_mode || 'typing'}
onChange={(e) => {
- const mode = e.target.value || 'reaction';
+ const mode = e.target.value || 'typing';
setSettingsMessage(null);
const newConfig = {
...config,
@@ -304,8 +304,8 @@ export const Dashboard: React.FC = () => {
}}
className="w-36 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono"
>
- <option value="reaction">{t('dashboard.ackReaction')}</option>
<option value="typing">{t('dashboard.ackTyping')}</option>
+ <option value="reaction">{t('dashboard.ackReaction')}</option>
<option value="message">{t('dashboard.ackMessage')}</option>
</select>
</div>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index cbdc2b8c2..77306d41c 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -396,10 +396,10 @@
"requireMention": "Require Mention",
"requireMentionHint": "Bot only responds when @mentioned",
"ackMode": "Ack Mode",
- "ackModeHint": "How bot acknowledges received messages",
+ "ackModeHint": "How bot acknowledges received messages. Falls back to the next mode if the current one is unavailable.",
"ackReaction": "👀 Reaction",
- "ackTyping": "Typing",
- "ackMessage": "Message",
+ "ackTyping": "✏️ Typing...",
+ "ackMessage": "💬 Message",
"errorRetryLimit": "Error Retry Limit",
"errorRetryLimitHint": "Auto-retry with 'continue' when LLM stream errors occur (0 = no retry)",
"showDuration": "Show Duration",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 264bf4275..de70ec8cc 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -396,10 +396,10 @@
"requireMention": "需要 @提及",
"requireMentionHint": "机器人仅在被 @提及时响应",
"ackMode": "确认模式",
- "ackModeHint": "机器人如何确认收到的消息",
+ "ackModeHint": "机器人如何确认收到消息。当前模式不可用时,会自动降级到下一个模式。",
"ackReaction": "👀 表情回应",
- "ackTyping": "Typing 指示",
- "ackMessage": "消息回复",
+ "ackTyping": "✏️ 正在输入...",
+ "ackMessage": "💬 消息回复",
"errorRetryLimit": "错误重试次数",
"errorRetryLimitHint": "当 LLM 流式响应出错时,自动发送 'continue' 重试(0 = 不重试)",
"showDuration": "显示耗时",