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.

feat(reply): add reply_enhancements toggle to config and Web UI

cyh979f163d5266
diff --git a/config/v2_config.py b/config/v2_config.py
index d184c1fb4..b87e7365b 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -148,6 +148,7 @@ class V2Config:
ack_mode: str = "reaction"
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
language: str = "en" # Global language setting (see vibe/i18n)
@classmethod
@@ -266,6 +267,10 @@ class V2Config:
if not isinstance(include_user_info, bool):
include_user_info = True
+ reply_enhancements = payload.get("reply_enhancements", True)
+ if not isinstance(reply_enhancements, bool):
+ reply_enhancements = True
+
language = normalize_language(payload.get("language"), default="en")
return cls(
@@ -283,6 +288,7 @@ class V2Config:
ack_mode=ack_mode,
show_duration=show_duration,
include_user_info=include_user_info,
+ reply_enhancements=reply_enhancements,
language=language,
)
@@ -312,6 +318,7 @@ class V2Config:
"ack_mode": self.ack_mode,
"show_duration": self.show_duration,
"include_user_info": self.include_user_info,
+ "reply_enhancements": self.reply_enhancements,
"language": self.language,
}
path.write_text(json.dumps(payload, indent=2), encoding="utf-8")
diff --git a/core/controller.py b/core/controller.py
index 40543e4a4..e0481cb83 100644
--- a/core/controller.py
+++ b/core/controller.py
@@ -135,7 +135,7 @@ class Controller:
Called on every ``_t()`` invocation (guarded by mtime check).
Refreshes: language, show_duration, ack_mode, include_user_info,
- require_mention (global).
+ reply_enhancements, require_mention (global).
"""
try:
config_path = paths.get_config_path()
@@ -150,6 +150,7 @@ class Controller:
self.config.show_duration = v2_config.show_duration
self.config.ack_mode = v2_config.ack_mode
self.config.include_user_info = v2_config.include_user_info
+ self.config.reply_enhancements = v2_config.reply_enhancements
# Sync global require_mention into the IM client's platform config
platform = getattr(self.config, "platform", "")
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.py
index 55aec0f8f..c79af6327 100644
--- a/core/handlers/session_handler.py
+++ b/core/handlers/session_handler.py
@@ -155,21 +155,25 @@ class SessionHandler(BaseHandler):
effective_model = explicit_model or agent_model or self.config.claude.default_model
# Determine final system prompt: agent prompt takes precedence over config.
- # When neither is set, use the claude_code preset with our enhancements
- # appended so the built-in tools/instructions remain intact.
- from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT
-
+ # When reply_enhancements is enabled and no explicit prompt is set,
+ # use the claude_code preset with our enhancements appended so the
+ # built-in tools/instructions remain intact.
base_prompt = agent_system_prompt or self.config.claude.system_prompt
- if base_prompt:
- # Agent file or config already specifies a full prompt – append ours
- final_system_prompt = f"{base_prompt}\n\n{REPLY_ENHANCEMENTS_PROMPT}"
+ reply_enhancements_on = getattr(self.config, "reply_enhancements", True)
+
+ if reply_enhancements_on:
+ from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT
+
+ if base_prompt:
+ final_system_prompt = f"{base_prompt}\n\n{REPLY_ENHANCEMENTS_PROMPT}"
+ else:
+ final_system_prompt = {
+ "type": "preset",
+ "preset": "claude_code",
+ "append": REPLY_ENHANCEMENTS_PROMPT,
+ }
else:
- # No explicit prompt – use the claude_code preset + append
- final_system_prompt = {
- "type": "preset",
- "preset": "claude_code",
- "append": REPLY_ENHANCEMENTS_PROMPT,
- }
+ final_system_prompt = base_prompt
# Create extra_args for CLI passthrough (fallback for model)
extra_args: Dict[str, str | None] = {}
diff --git a/core/message_dispatcher.py b/core/message_dispatcher.py
index 569ff49a7..ed5a84d60 100644
--- a/core/message_dispatcher.py
+++ b/core/message_dispatcher.py
@@ -145,11 +145,16 @@ class ConsolidatedMessageDispatcher:
target_context = self._get_target_context(context)
# --- Reply enhancements: extract file links & quick-reply buttons ---
- enhanced = process_reply(text)
- display_text = enhanced.text or text
+ reply_enhancements_on = getattr(self.controller.config, "reply_enhancements", True)
+ if reply_enhancements_on:
+ enhanced = process_reply(text)
+ display_text = enhanced.text or text
+ else:
+ enhanced = None
+ display_text = text
if len(display_text) <= self._get_result_max_chars():
- if enhanced.buttons:
+ if enhanced and enhanced.buttons:
await self._send_with_quick_replies(
im_client,
target_context,
@@ -182,7 +187,7 @@ class ConsolidatedMessageDispatcher:
)
# Upload extracted file attachments
- if enhanced.files:
+ if enhanced and enhanced.files:
await self._upload_file_links(im_client, target_context, enhanced.files)
return
diff --git a/modules/agents/codex/agent.py b/modules/agents/codex/agent.py
index 35b57560d..af975a832 100644
--- a/modules/agents/codex/agent.py
+++ b/modules/agents/codex/agent.py
@@ -254,15 +254,17 @@ class CodexAgent(BaseAgent):
request: AgentRequest,
) -> str:
"""Create a new Codex thread and return its threadId."""
- from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT
-
params: Dict[str, Any] = {
"cwd": request.working_path,
"approvalPolicy": "never",
"sandbox": "danger-full-access",
- "developerInstructions": REPLY_ENHANCEMENTS_PROMPT,
}
+ if getattr(self.controller.config, "reply_enhancements", True):
+ from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT
+
+ params["developerInstructions"] = REPLY_ENHANCEMENTS_PROMPT
+
resp = await transport.send_request("thread/start", params)
# thread/start returns Thread directly OR may nest under "thread"
thread_id = resp.get("id", "")
diff --git a/modules/agents/opencode/agent.py b/modules/agents/opencode/agent.py
index f3a750a86..a2e9b81d6 100644
--- a/modules/agents/opencode/agent.py
+++ b/modules/agents/opencode/agent.py
@@ -226,7 +226,11 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):
prompt_text = self._prepare_message_with_files(request)
# Inject reply-enhancement instructions via the system field (appended by OpenCode)
- from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT
+ reply_system: Optional[str] = None
+ if getattr(self.controller.config, "reply_enhancements", True):
+ from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT
+
+ reply_system = REPLY_ENHANCEMENTS_PROMPT
await server.prompt_async(
session_id=session_id,
@@ -235,7 +239,7 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):
agent=agent_to_use,
model=model_dict,
reasoning_effort=reasoning_effort,
- system=REPLY_ENHANCEMENTS_PROMPT,
+ system=reply_system,
)
logger.info(
diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsx
index 1b0004fc6..ec0fbdbbc 100644
--- a/ui/src/components/Dashboard.tsx
+++ b/ui/src/components/Dashboard.tsx
@@ -447,6 +447,37 @@ export const Dashboard: React.FC = () => {
: t('common.disabled')}
</button>
</div>
+ <div className="flex justify-between items-center">
+ <span className="text-muted flex items-center gap-1">
+ {t('dashboard.replyEnhancements')}
+ <span className="relative group">
+ <Info size={12} className="text-muted/50 cursor-help" />
+ <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
+ {t('dashboard.replyEnhancementsHint')}
+ </span>
+ </span>
+ </span>
+ <button
+ onClick={() => {
+ setSettingsMessage(null);
+ const newConfig = {
+ ...config,
+ reply_enhancements: !config.reply_enhancements,
+ };
+ setConfig(newConfig);
+ autoSaveMessageConfig(newConfig);
+ }}
+ className={`px-2 py-1 rounded text-xs font-semibold border ${
+ config.reply_enhancements !== false
+ ? 'bg-success/10 text-success border-success/20'
+ : 'bg-neutral-100 text-muted border-border'
+ }`}
+ >
+ {config.reply_enhancements !== false
+ ? t('common.enabled')
+ : t('common.disabled')}
+ </button>
+ </div>
<div className="flex justify-between items-center">
<span className="text-muted">{t('dashboard.allowedChannels')}</span>
<Link to="/channels" className="text-xs text-accent hover:underline font-medium">{t('common.manageChannels')}</Link>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 34dfc1b50..84aa84c2f 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -361,6 +361,8 @@
"showDurationHint": "Display task elapsed time in result messages",
"includeUserInfo": "Include User Info",
"includeUserInfoHint": "Prepend [username<user_id>] to messages sent to agents",
+ "replyEnhancements": "Reply Enhancements",
+ "replyEnhancementsHint": "Enable file attachments and quick-reply buttons in agent responses",
"allowedChannels": "Allowed Channels",
"consoleServer": "Console Server",
"host": "Host",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index e323e0655..cffbdc79d 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -361,6 +361,8 @@
"showDurationHint": "在结果消息中显示任务耗时",
"includeUserInfo": "携带用户信息",
"includeUserInfoHint": "在发给 Agent 的消息前添加 [用户名<用户ID>]",
+ "replyEnhancements": "增强回复",
+ "replyEnhancementsHint": "启用 Agent 回复中的文件附件和快捷回复按钮",
"allowedChannels": "允许的频道",
"consoleServer": "控制台服务器",
"host": "主机",
diff --git a/vibe/api.py b/vibe/api.py
index edfe49fc2..9f1f41a7e 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -99,6 +99,7 @@ def config_to_payload(config: V2Config) -> dict:
"language": config.language,
"show_duration": config.show_duration,
"include_user_info": config.include_user_info,
+ "reply_enhancements": config.reply_enhancements,
}
return payload