Skip to content

[WIP] Render Console Chatbot only when AI service is available#1166

Closed
Claude wants to merge 1 commit intomainfrom
claude/implement-console-chatbot-rendering
Closed

[WIP] Render Console Chatbot only when AI service is available#1166
Claude wants to merge 1 commit intomainfrom
claude/implement-console-chatbot-rendering

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 1, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>Console Chatbot 仅在检测到 AI 服务可用时渲染:基于 discovery.services.ai 动态控制</issue_title>
<issue_description>## 背景
随着 objectstack-ai/spec#1029 推进,服务端 discovery 响应(/.well-known/objectstack 或 /api/v1/discovery)已标准暴露 services.ai.enabledservices.ai.route。前端可以基于该状态智能显示/隐藏 AI Chatbot 按钮(FAB),避免因服务端未安装 AI 插件导致无用界面。


实现方案

  • 使用 useDiscovery() 获取最新 discovery 信息。
  • 仅当 discovery.services.ai.enabled === truestatus === 'available' 时,渲染 。
  • 动态拼接 api 地址:discovery.services.ai.route + '/chat'
  • 未检测到 AI 服务(或 disabled/unavailable/route 丢失时),不渲染 chatbot FAB,也不挂载 useObjectChat(无多余弹窗/代码)。
  • 支持 MSW/mock 模式,local 模式下可选择不显示 chatbot。

技术要点

  • 无需 hardcode API 路径,完全由 discovery 返回结构驱动。
  • 兼容未来服务端 route 调整(如 /ai → /ai/v1)。
  • 降低误判/死逻辑风险,UI 能自动感知后端能力变化。
  • 除 FAB 按钮外不影响其它功能。

改动建议

  • apps/console/src/components/ConsoleLayout.tsx
    • 用 useDiscovery() 检测 AI
    • 条件渲染 ,传递 api 参数
  • (可选)完善 DiscoveryInfo typings 补充 ai 定义
  • 更新相关单元&集成测试,确保未安装 AI 插件时无 FAB

验证方式

  • 关闭 service-ai 插件 → chatbot 消失
  • 启用 service-ai 并保证协议标准 → chatbot 自动显示且 SSO 到真正的 AI 聊天</issue_description>

Comments on the Issue (you are @claude[agent] in this section)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui-demo Ready Ready Preview, Comment Apr 1, 2026 9:00am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Apr 1, 2026 9:00am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console Chatbot 仅在检测到 AI 服务可用时渲染:基于 discovery.services.ai 动态控制

3 participants