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.

merge(master): resolve PR conflicts

cyhhao66efeb9c28d3
diff --cc ui/src/components/steps/ChannelList.tsx
index 44b8aad3c,d73e06aad..8ce92d06a
--- a/ui/src/components/steps/ChannelList.tsx
+++ b/ui/src/components/steps/ChannelList.tsx
@@@ -88,51 -81,21 +90,57 @@@ export const ChannelList: React.FC<Chan
}
}, [isPage]);
- const botToken = config.slack?.bot_token || config.slackBotToken || '';
+ const platform = config.platform || data.platform || 'slack';
+ const botToken = platform === 'discord'
+ ? (config.discord?.bot_token || data.discord?.bot_token || '')
+ : (config.slack?.bot_token || config.slackBotToken || '');
+
+ useEffect(() => {
+ if (platform !== 'discord') return;
+ if (selectedGuild) return;
+ const preferredGuild = config.discord?.guild_allowlist?.[0] || data.discord?.guild_allowlist?.[0] || '';
+ if (preferredGuild) {
+ setSelectedGuild(preferredGuild);
+ }
+ }, [platform, config.discord?.guild_allowlist, data.discord?.guild_allowlist, selectedGuild]);
+
+ const loadGuilds = async () => {
+ if (!botToken) return;
+ try {
+ const result = await api.discordGuilds(botToken);
+ if (result.ok) {
+ setGuilds(result.guilds || []);
+ }
+ } catch (e) {
+ console.error('Failed to load guilds:', e);
+ }
+ };
- const loadChannels = async () => {
+ const loadChannels = async (all?: boolean) => {
if (!botToken) return;
- setLoading(true);
+ const isAll = all ?? browseAll;
+ if (isAll) {
+ setLoadingAll(true);
+ } else {
+ setLoading(true);
+ }
try {
- const result = await api.slackChannels(botToken, isAll);
- if (result.ok) {
- setChannels(result.channels || []);
- if (isAll) setBrowseAll(true);
+ if (platform === 'discord') {
+ if (!selectedGuild) {
+ setLoading(false);
+ return;
+ }
+ const result = await api.discordChannels(botToken, selectedGuild);
+ if (result.ok) {
+ const filtered = (result.channels || []).filter((c: any) => c.type === 0 || c.type === 5);
+ setChannels(filtered);
+ }
+ } else {
- const result = await api.slackChannels(botToken);
++ const result = await api.slackChannels(botToken, isAll);
+ if (result.ok) {
+ setChannels(result.channels || []);
++ if (isAll) setBrowseAll(true);
+ }
}
} catch (e) {
console.error('Failed to load channels:', e);
diff --cc ui/src/context/ApiContext.tsx
index d1055d212,3fc03897b..fec699fac
--- a/ui/src/context/ApiContext.tsx
+++ b/ui/src/context/ApiContext.tsx
@@@ -9,11 -9,8 +9,11 @@@ export type ApiContextType =
detectCli: (binary: string) => Promise<any>;
installAgent: (name: string) => Promise<InstallResult>;
slackAuthTest: (botToken: string) => Promise<any>;
- slackChannels: (botToken: string) => Promise<any>;
+ slackChannels: (botToken: string, browseAll?: boolean) => Promise<any>;
slackManifest: () => Promise<{ ok: boolean; manifest?: string; manifest_compact?: string; error?: string }>;
+ discordAuthTest: (botToken: string) => Promise<any>;
+ discordGuilds: (botToken: string) => Promise<any>;
+ discordChannels: (botToken: string, guildId: string) => Promise<any>;
doctor: () => Promise<any>;
opencodeOptions: (cwd: string) => Promise<any>;
opencodeSetupPermission: () => Promise<{ ok: boolean; message: string; config_path: string }>;
@@@ -119,11 -116,8 +119,11 @@@ export const ApiProvider: React.FC<{ ch
detectCli: (binary) => getJson(`/cli/detect?binary=${encodeURIComponent(binary)}`),
installAgent: (name) => postJson(`/agent/${encodeURIComponent(name)}/install`, {}),
slackAuthTest: (botToken) => postJson('/slack/auth_test', { bot_token: botToken }),
- slackChannels: (botToken) => postJson('/slack/channels', { bot_token: botToken }),
+ slackChannels: (botToken, browseAll) => postJson('/slack/channels', { bot_token: botToken, browse_all: browseAll || false }),
slackManifest: () => getJson('/slack/manifest'),
+ discordAuthTest: (botToken) => postJson('/discord/auth_test', { bot_token: botToken }),
+ discordGuilds: (botToken) => postJson('/discord/guilds', { bot_token: botToken }),
+ discordChannels: (botToken, guildId) => postJson('/discord/channels', { bot_token: botToken, guild_id: guildId }),
doctor: () => postJson('/doctor', {}),
opencodeOptions: (cwd) => postJson('/opencode/options', { cwd }),
opencodeSetupPermission: () => postJson('/opencode/setup-permission', {}),
diff --cc ui/src/i18n/en.json
index 3a34af33a,24218b3ff..cccc7a7b0
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@@ -184,13 -128,10 +184,15 @@@
"title": "Channel Settings",
"subtitle": "Enable channels and configure per-channel routing.",
"refreshList": "Refresh List",
+ "browseAll": "Browse All Channels",
+ "showingAll": "Showing all workspace channels",
"cantFindChannel": "Can't find your channel?",
"inviteBotHint": "Invite the bot to your channel first:\n1. Open the channel, click ⚙️ Settings → Integrations → Add apps\n2. Or type /invite @YourBotName in the channel",
+ "discordInviteBotHint": "Add the bot to your guild and grant access to the channel.",
+ "guild": "Guild",
+ "guildPlaceholder": "Select a guild",
+ "discordText": "Text",
+ "discordNews": "News",
"enabledCount": "{{count}} enabled",
"accessPolicy": "Access Policy",
"accessPolicyHint": "Channels are enabled only when checked below.",
diff --cc ui/src/i18n/zh.json
index 1c420a4c7,6aebe71e6..9ca5671a7
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@@ -184,13 -128,10 +184,15 @@@
"title": "频道设置",
"subtitle": "启用频道并配置每个频道的路由",
"refreshList": "刷新列表",
+ "browseAll": "浏览所有频道",
+ "showingAll": "已显示工作区所有频道",
"cantFindChannel": "找不到你想要的频道?",
"inviteBotHint": "请先将 Bot 邀请到频道:\n1. 打开频道,点击 ⚙️ 设置 → 集成 → 添加应用\n2. 或在频道中输入 /invite @你的Bot名称",
+ "discordInviteBotHint": "请确保机器人已加入服务器并具备访问频道的权限。",
+ "guild": "服务器",
+ "guildPlaceholder": "选择服务器",
+ "discordText": "文本",
+ "discordNews": "公告",
"enabledCount": "已启用 {{count}} 个",
"accessPolicy": "访问策略",
"accessPolicyHint": "只有勾选的频道才会启用",
diff --cc vibe/ui_server.py
index d8642dc61,ecea3c41a..146b369ed
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@@ -263,34 -263,14 +263,39 @@@ def slack_channels()
from vibe import api
payload = request.json or {}
- return jsonify(api.list_channels(payload.get("bot_token", "")))
+ return jsonify(
+ api.list_channels(
+ payload.get("bot_token", ""),
+ browse_all=payload.get("browse_all", False),
+ )
+ )
[email protected]("/discord/auth_test", methods=["POST"])
+def discord_auth_test():
+ from vibe import api
+
+ payload = request.json or {}
+ result = api.discord_auth_test(payload.get("bot_token", ""))
+ return jsonify(result)
+
+
[email protected]("/discord/guilds", methods=["POST"])
+def discord_guilds():
+ from vibe import api
+
+ payload = request.json or {}
+ return jsonify(api.discord_list_guilds(payload.get("bot_token", "")))
+
+
[email protected]("/discord/channels", methods=["POST"])
+def discord_channels():
+ from vibe import api
+
+ payload = request.json or {}
+ return jsonify(api.discord_list_channels(payload.get("bot_token", ""), payload.get("guild_id", "")))
+
+
@app.route("/doctor", methods=["POST"])
def doctor_post():
from vibe.cli import _doctor