66 Commits
Author SHA1 Message Date
xiaohei 4ec6f8befd chore: sync latest pages + docs updates 2026-01-11 12:13:00 +00:00
xiaohei 5e97eb40cb feat: 添加自定义Agent管理功能
- 在工具注册表下方添加自定义Agent管理卡片
- 支持查看自定义Agent列表(名称、模板、状态、CPU、内存、运行时间)
- 支持停止运行中的Agent
- 支持重启/启动Agent
- 支持删除Agent(带确认提示)
- 添加刷新按钮手动更新列表
- 添加API方法:getUserCustomAgents, deleteCustomAgent, stopCustomAgent, restartCustomAgent
2026-01-09 16:17:21 +00:00
xiaohei c87dc658f0 feat: 在部署Agent对话框中添加使用工具选择
- 在'使用的模型'右边添加'使用工具'下拉选择
- 工具选项基于数据模板(已注册的工具)
- 更新配置摘要显示使用的工具
2026-01-09 16:13:08 +00:00
xiaohei fc0d8b253f fix: 修复渠道资源分配输入框逻辑
- 修改 CPU 和内存输入框 min 从 0.5 改为 0
- 使用 ?? 替代 || 正确处理 0 值显示
- 改进 onChange 处理,允许清空输入
- 更新提示文字,说明输入0表示不分配
- 修复摘要显示逻辑,正确判断是否有资源配置
2026-01-09 15:05:22 +00:00
xiaohei 7cbacebef1 feat: 对接代理工厂和服务网关接口
- 添加代理工厂相关API接口方法 (api-client.ts)
  - getUserAvailablePlatformAgents: 获取可用平台Agent列表
  - getUserPlatformAgentQuota: 查看配额使用情况
  - deployUserAgent: 部署Agent
  - getUserPlatformAgentInstances: 获取已部署实例列表
  - startUserPlatformAgent: 启动Agent实例
  - stopUserPlatformAgent: 停止Agent实例
  - getUserCustomAgentQuota: 获取CPU/内存配额

- 修改代理工厂页面 (agent-factory/page.tsx)
  - 对接新的后端接口获取Agent列表和配额信息
  - 添加配额使用进度条显示
  - 资源配置根据接口返回参数动态显示
  - 配额满时禁用部署按钮

- 修改服务网关页面 (model-gateway/page.tsx)
  - 平均延迟复用 model_gateway 组件的 latency 值
  - 今日调用复用 requests24h 参数

- 修改布局组件 (dashboard-layout.tsx)
  - API延迟复用 mcp_server 组件的 latency 值
2026-01-09 15:01:45 +00:00
xiaohei 85a3425420 fix: 修正系统组件默认名称 agent-manager 为 agent_manager(与后端一致) 2026-01-08 17:03:37 +00:00
xiaohei 4d23852b72 fix: 修复仪表板显示问题
1. 修改系统组件默认加载状态名称:database改为agent-manager,mode改为model_gateway
2. 修复模型分布图在没有数据时显示黑色的问题,改为显示'暂无模型使用数据'提示
2026-01-08 10:07:29 +00:00
xiaohei cae7e779a2 feat: 将供应商配置对话框的可调用模型输入框改为多选复选框
- 在 api-client.ts 中添加 getLiteLLMModels 和 getLiteLLMModelIds 方法
- 改为调用后端接口 /api/admin/resources/litellm-models 获取模型列表
- 移除前端直接调用 LiteLLM API 的敏感配置(API 密钥)
- 将 providerForm.models 类型从 string 改为 string[]
- 修改添加供应商对话框的 models 输入框为多选复选框列表
- 修改配置供应商对话框的 models 输入框为多选复选框列表
- 在打开对话框时自动加载 LiteLLM 模型列表
2026-01-08 06:42:41 +00:00
xiaohei 92e4a3fd93 feat: 将供应商配置对话框的可调用模型输入框改为多选复选框
- 在 api-client.ts 中添加 LiteLLM 模型列表获取方法
- 将 providerForm.models 类型从 string 改为 string[]
- 修改添加供应商对话框的 models 输入框为多选复选框列表
- 修改配置供应商对话框的 models 输入框为多选复选框列表
- 在打开对话框时自动加载 LiteLLM 模型列表
2026-01-08 06:36:21 +00:00
xiaohei 9f4783787c feat: 更新UI文案和API接口
- 数据与工具页面: 总API数→总工具数, 活跃Pod数→活跃的工具数, 生成新工具→部署Agent
- 代理工厂页面: 可用Agent→可用Agent类型
- api-client.ts: 修复接口路径差异, 添加deleteWorkflow和runWorkflow方法
2026-01-07 09:37:06 +00:00
xiaohei 62b680a6cf feat: 渠道合作伙伴平台功能完善
- 完善设置页面的权限配置功能
- 添加管理员列表显示
- 添加后端接口需求文档
2026-01-06 18:05:16 +00:00
xiaohei 7f66c70112 fix: 修复Agent分配功能中选择一个Agent时所有Agent都被选中的问题
- 使用 agent.id || agent.name 作为唯一标识符 (agentKey)
- 后端返回的 Agent 模板数据中 name 是唯一的,id 可能为 undefined
- 修复 handleResourceManagement 函数中加载已分配 Agent 的映射逻辑
- 确保加载和选择使用一致的标识符
2026-01-06 16:01:55 +00:00
xiaohei fd23f5d222 feat: 更新前端接口以匹配后端API文档v1.2.1
主要更新:
- 更新api-client.ts中的allocateTenantResources方法,支持customAgentQuota参数
- 修复渠道平台租户资源分配对话框的传参问题
- 添加Agent勾选框功能,只有选中的Agent才会被分配
- 添加调试日志输出请求数据

API对照:
- PUT /api/channel/tenants/{tenant_id}/resources
- agents数组元素包含agentId和quantity
- customAgentQuota包含cpuQuota和memoryQuota
2026-01-05 11:31:52 +00:00
xiaohei f43306a7b5 fix: 根据后端API文档v1.2.1更新前端接口
- 修复渠道平台模型授权状态显示逻辑(使用hasAccess字段判断)
- 修复changeTenantPassword接口参数名(new_password -> newPassword)
- 修复createAdmin接口channelId参数改为可选
- 修复渠道申请审批表格的状态显示和按钮逻辑
2026-01-05 06:56:46 +00:00
xiaohei ffb09fee13 fix: 修复资源申请弹窗Agent类型使用假数据问题
- 将硬编码的Agent类型列表替换为从API获取的真实Agent列表
- 使用agentResourcesData动态渲染Agent选项
- 当无可用Agent时显示友好提示信息
2026-01-04 11:21:57 +00:00
xiaohei f56147bbbe feat: 优化创建数据模板弹窗 - 添加上传JSON勾选框切换输入模式
- 添加勾选框控制输入模式(上传JSON文件 vs 手动输入)
- 勾选后显示文件上传界面,带APILLAMA自动识别提示
- 不勾选时显示手动输入表单(URL、密钥Key、查询参数)
- 数据接口URL改为可输入状态
2026-01-04 10:56:31 +00:00
xiaohei 1bceab125a fix: 修复渠道仪表板假数据问题
- 修复租户计费统计:使用billingStatsData.tenantStats替换硬编码数据
- 修复调用记录明细:使用billingStatsData.callRecords替换硬编码数据
- 添加加载状态和空数据提示
- 支持多种字段名兼容(timestamp/time, tenantName/tenant等)
2026-01-04 09:36:48 +00:00
xiaohei 553f41daf5 feat: 增强超级管理员监控页面Agent显示功能
- 新增agentSummary状态变量保存Agent监控汇总统计
- 更新监控页面显示Agent统计卡片(总数、健康、警告/异常)
- 优化Agent卡片显示,包含名称、类型、健康状态、资源配置等信息
- 支持healthStatus字段判断健康状态(兼容旧status字段)
2026-01-04 09:23:53 +00:00
xiaohei e4ee876f57 fix: 修复最近登录租户功能的数据加载逻辑
- 优化数据加载逻辑,优先使用 data.recentTenants 字段
- 兼容 data.tenants 字段(向后兼容)
- 支持直接数组格式
- 移除调试日志,保持代码整洁

测试验证:后端API返回正确的租户登录记录
2026-01-04 05:24:27 +00:00
xiaohei 8279de706f feat: 在概览页面增加最近登录的租户列表功能
- 在loadDashboardData中添加加载最近登录数据的代码
- 修改概览页面的'最近租户'部分为'最近登录的租户'
- 使用recentLogins数据展示租户登录信息
- 展示租户名称、邮箱、所属渠道、最后登录时间和状态
- 只展示租户登录,不展示渠道登录
2026-01-04 04:59:39 +00:00
xiaohei 521daf6527 fix: 将系统指标中的API请求/分钟改为活跃Agent
- 修改翻译文本:apiRequests -> activeAgents
- 英文:'Active Agents'
- 中文:'活跃Agent'
- 使用后端API字段:services.active_agents
- 调整max值从5000改为100
2025-12-31 10:42:33 +00:00
xiaohei f044360293 fix: 修复超级管理员控制台概览页面接口问题
1. 修复统计数据字段名与后端API不匹配问题
   - total_channels → totalChannels
   - total_tenants → totalTenants
   - total_revenue → totalRevenue

2. 修复系统指标使用正确的监控接口
   - 从 getAdminDashboardStats 改为 getMonitoringMetrics
   - 使用正确的字段: system.cpu_usage_percent, system.memory_usage_percent, system.disk_usage_percent
   - API请求数使用 services.total_executions_24h

3. 添加监控接口错误处理,避免页面崩溃
2025-12-31 10:31:37 +00:00
xiaohei eb2a88861b feat: 添加租户管理和K8s Agent API,更新文档 2025-12-31 09:11:28 +00:00
xiaohei 8c4284d38d feat: 统一API端点、增强权限系统和渠道管理员功能
- 统一所有API基础URL指向MCP服务器
- 超级管理员创建租户时支持channelId参数
- 修复硬编码localhost URL问题
- HTTP方法修正:PATCH改为PUT
- 租户状态修正:disabled改为suspended
- 新增渠道管理员列表功能(可折叠展开)
- 新增角色卡片UI(计费管理员、运营管理员)
- 新增channel_admin角色支持
- 增强错误处理显示后端具体错误信息
2025-12-30 14:07:32 +00:00
xiaohei 9374a83cab fix: 修复超级管理员创建租户功能,根据系统权限选择正确的后端接口
- 租户(tenant): 调用 /api/channel/tenants/create
- 计费管理员(billing-admin): 调用 /api/admin/admins/create
- 运营管理员(operations-admin): 调用 /api/admin/admins/create
- 删除无效的'管理员'选项
2025-12-30 06:58:46 +00:00
xiaohei d9f940db71 前端API连接相关更新 2025-12-29 19:18:59 +00:00
xiaohei 64a14f7041 更新 lib/api-client.ts 2025-12-29 19:03:04 +00:00
xiaohei f71975b392 合并并同步云端 API_BASE_URLS 2025-12-29 18:36:10 +00:00
xiaohei 484f4a1445 fix(azure): remove skip_deploy_on_missing_secrets
Token is now configured, enable full deployment.
2025-12-29 10:29:02 +00:00
xiaohei 5afd8d423b fix(azure): set app_location to /out where static files are
Since we use skip_app_build: true and is_static_export: true,
Azure SWA looks for static files directly in app_location.

Next.js static export outputs to 'out/' directory, so we point
app_location directly to '/out' where index.html exists.
2025-12-29 09:27:22 +00:00
xiaohei 0b388ce82b fix(azure): add skip_deploy_on_missing_secrets for token handling
Azure SWA recommends this parameter to gracefully handle missing
deployment tokens. When secrets are not configured, the workflow
will continue without deployment.
2025-12-29 09:23:53 +00:00
xiaohei d275a08c39 fix(azure): use correct action parameter names
- Remove invalid 'skip_deploy_on_missing_secrets' parameter
- Use 'is_static_export: true' instead of IS_STATIC_EXPORT env var
- All parameters now match Azure static-web-apps-deploy@v1 action spec
2025-12-29 09:12:43 +00:00
xiaohei c9a78c657c fix(azure): set output_location to empty string for IS_STATIC_EXPORT
When IS_STATIC_EXPORT=true, Azure SWA expects output_location to be
an empty string ('') to auto-detect Next.js static export files.

Azure will look for the app source in app_location='/' and auto-discover
the 'out' directory where Next.js static export outputs files by default.

Fixes: Cannot find default file in artifacts folder (/) error
2025-12-29 08:45:10 +00:00
xiaohei 5209a8cefe fix(azure): explicitly set output_location to 'out' for static export
When IS_STATIC_EXPORT=true, SWA needs to know where to find the
built static files. Next.js static export outputs to 'out/' directory.

Configuration:
- app_location: '/' (repository root - where source is)
- output_location: 'out' (where Next.js static export files are)
- IS_STATIC_EXPORT: true (skip Oryx build, use pre-built files)
- skip_app_build: true (we already built in npm run build step)

This tells SWA to look for index.html in the 'out' directory.
2025-12-29 08:39:43 +00:00
xiaohei 7c1eea53b7 fix(azure): set output_location to empty string when using IS_STATIC_EXPORT
When IS_STATIC_EXPORT=true is set, Azure SWA automatically detects
Next.js static export output at 'out/' directory. Explicitly setting
output_location causes artifact detection to fail.

Per Azure official documentation:
https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-static-export
2025-12-29 08:36:43 +00:00
xiaohei ca537c971e fix(azure): apply official Azure SWA static export configuration
Per Microsoft official documentation:
https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-static-export

Key changes:
- Set IS_STATIC_EXPORT=true environment variable (required for static Next.js)
- Set output_location to 'out' (Next.js static export default)
- Set api_location to empty string (no API for static export)
- Keep skip_app_build=true (we build in previous step)

This is the official Azure recommended configuration for Next.js static sites.
2025-12-29 08:31:08 +00:00
xiaohei 4511fe5694 fix(azure): apply correct Azure SWA approach for Next.js
BREAKING CHANGES:
- Switch to static export mode (output: 'export') per Azure SWA best practices
- Remove staticwebapp.config.json to avoid routes.json conflict
- Convert server-side layouts to client-side only (remove cookies() usage)
- Auth now handled entirely by client-side AuthGuard component
- Output directory changed from .next/standalone to 'out'
- Remove redirects from next.config (not supported in static export)

This aligns with Azure Static Web Apps' official recommendation for Next.js.
Server-side features (SSR, API routes, server actions) are not supported.
All authentication and routing is client-side via React components.
2025-12-29 08:05:05 +00:00
xiaohei 351512dbc9 docs: add Azure deployment guide and env example 2025-12-29 07:59:22 +00:00
xiaohei 00aef0bea8 feat(azure): apply Azure SWA best practices for Next.js
- Add standalone output mode in next.config.mjs
- Configure environment variables with .env.example
- Update staticwebapp.config.json with proper routing and fallback
- Optimize GitHub Actions workflow with npm cache and env vars
- Set output_location to .next/standalone for SWA deployment
- Preserve all business logic in API client, auth, and components
2025-12-29 07:58:24 +00:00
xiaohei 1b6c528be0 fix(swa): apply Azure best practices - remove config, use standalone Next.js build 2025-12-29 07:53:07 +00:00
xiaohei e706021329 fix(swa): simplify staticwebapp.config.json to avoid routes.json conflict 2025-12-29 07:49:19 +00:00
xiaohei bd982a83ce chore(swa): remove duplicate auto-generated workflow; keep unified azure-static-web-apps.yml 2025-12-29 07:47:36 +00:00
xiaohei a184653c82 ci(swa): skip deploy when token missing; align Next.js output to .next 2025-12-29 07:45:39 +00:00
xiaohei 2c4d606aba fix(swa): set output_location to .next and add app_build_command for Next.js 2025-12-29 07:41:18 +00:00
xiaohei 0c7693833f feat(auth): replace middleware with server-side layouts; add redirects; build verified 2025-12-29 07:28:25 +00:00
xiaohei 66c700442e feat(auth): migrate from middleware to server-side layouts; add redirects for /admin and /channel 2025-12-29 07:22:26 +00:00
xiaohei 18118c90ea merge: integrate remote SWA workflow commit 2025-12-29 07:16:15 +00:00
xiaohei 5c8cfd6c54 chore(swa): add Azure Static Web Apps CI/CD workflow for Next.js (.next output, Node 20.11.1) 2025-12-29 07:10:25 +00:00
xiaohei 1aae986f7e chore: add setup script for consistent node version 2025-12-29 06:46:38 +00:00
xiaohei f2323f5dc5 chore: add azure static web apps config with node 20.11.1 2025-12-29 06:41:43 +00:00
xiaohei d19e994fd7 chore: set node engine >=20.9 and add .nvmrc 2025-12-29 05:41:27 +00:00
xiaohei 43fd6bbf13 chore: remove admin management section in channel editor 2025-12-29 05:36:35 +00:00
xiaohei 884e2a4cfc chore: update api endpoints and lock tenant role 2025-12-29 05:26:29 +00:00
xiaohei 8372183d01 feat: 添加删除租户和管理员功能
- 在渠道管理页面添加删除租户按钮和确认对话框
- 在渠道设置页面添加删除管理员按钮和确认对话框
- 在渠道编辑对话框中添加删除管理员功能
- 添加完整的删除确认流程,包含警告提示
- 删除成功后自动刷新列表
- 添加API调用调试日志,便于排查问题
- 支持中英文双语显示
2025-12-28 16:35:05 +00:00
xiaohei 7247258e19 Update channel dashboard page 2025-12-28 15:45:31 +00:00
xiaohei 05ec0fa8e2 修复登录跳转问题并删除编辑功能
- 修复登录后不跳转问题:使用 window.location.href 替代 router.push,确保完整页面跳转
- 在登录页面显式设置 cookie,确保中间件能正确检查认证状态
- 删除租户编辑功能:移除编辑菜单项、编辑对话框和相关状态
- 移除管理用户对话框中的用户数字段,改为显示租户ID
- 在设置页面添加当前渠道管理员列表显示功能
- 添加获取和创建渠道管理员的 API 方法
2025-12-28 13:58:27 +00:00
xiaohei 4448468157 优化代码:修复重复文件、统一认证函数、添加租户角色管理和管理员列表功能
- 删除重复文件:components/ui/use-toast.ts 和 components/ui/use-mobile.tsx
- 统一 getAuthToken() 函数,在 api-client.ts 中导入并删除重复定义
- 创建 clearAllTokens() 工具函数,统一 token 清除逻辑
- 修复 Toast 延迟时间(从 1000000ms 改为 5000ms)
- 修复 TypeScript 类型错误:在 applicationForm 中添加 providerId 字段
- 修复登录路径:使用 super_admin 角色登录超级管理员
- 移除登录前的后端可达性检查(避免浏览器环境问题)
- 在管理用户对话框中添加租户角色修改功能(租户/计费管理员/运营管理员)
- 移除管理用户对话框中的用户数字段(用户层面不应显示用户数)
- 在设置页面添加当前渠道管理员列表显示功能
- 添加获取和创建渠道管理员的 API 方法
- 更新登录方法的角色类型定义,支持所有角色类型
2025-12-28 13:43:07 +00:00
xiaohei e11464ec29 feat: 将Agent框架模板MCP改为LangChain
- 更新Agent框架模板选项,将MCP改为LangChain
- 保持其他框架选项(A2A、API)不变
2025-12-28 08:38:25 +00:00
xiaohei ae20ff6b47 feat: 在设置页面添加管理员列表管理功能
- 引入 SettingsTab 组件显示管理员列表
- 支持查看管理员详细信息(姓名、邮箱、角色、状态、创建时间)
- 支持创建新管理员(计费管理员/运维管理员)
- 支持删除管理员(带确认对话框)
- 保留原有的角色权限配置功能
- 调整设置页面布局,分为管理员管理和角色权限配置两部分
2025-12-28 08:37:21 +00:00
xiaohei 86fb3346d3 feat: 完整恢复渠道管理功能到ChannelsTab组件
- ✅ 创建ChannelsTab.tsx组件(1984行)
- ✅ 实现12个Dialog: 渠道CRUD、佣金管理、资源分配、租户管理、审批流程
- ✅ 恢复租户管理功能(查看、添加、权限分配)
- ✅ 恢复审批流程(供应商申请、Agent申请)
- ✅ 更新Channel类型定义
- ✅ 集成到page.tsx主页面
- ✅ 完整的中英文国际化支持
- ✅ 无TypeScript编译错误

功能完整度: 100%
参考源码: page_old.tsx lines 1459-2909
2025-12-26 15:50:33 +00:00
xiaohei 353205db20 Merge branch 'main' into gzy 2025-12-26 09:40:10 +00:00
xiaohei 809e25b1fa feat: 更新前端代码 - 优化各模块页面和API客户端 2025-12-26 09:37:44 +00:00
xiaohei 1a2f001e6f feat: 更新多个页面的API集成和功能优化
- 更新admin/dashboard页面:完善API集成,删除假数据
- 更新admin/login和channel/login:优化登录流程
- 更新agent-factory、billing、data-tools、model-gateway、orchestration页面:API集成优化
- 更新channel/dashboard:渠道管理功能完善
- 更新lib/api-client.ts:API客户端功能增强
- 更新lib/auth.ts:认证功能优化
- 删除过时的API文档文件
2025-12-25 11:24:11 +00:00
xiaohei 23c0b4e930 feat: 完善超级管理员控制台API集成
- 删除资源管理中的假数据,改为从API获取
- 添加删除Agent和模型供应商功能
- 完善创建渠道、资源管理、审批申请等功能的API集成
- 修复计费统计功能,接入后端API
- 添加缺失API接口清单文档
- 优化API响应格式处理,支持多种响应结构
- 修复审批申请对话框,添加供应商申请审批功能
2025-12-25 09:31:26 +00:00
xiaohei d30a0c34ae 合并远程更新到gzy分支,保留本地API对接代码 2025-12-25 08:07:33 +00:00
xiaohei f982a07b55 初始提交:完整的API客户端对接和前端项目 2025-12-25 07:58:59 +00:00