|
|
@@ -4,13 +4,26 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
|
|
|
## Project Overview
|
|
|
|
|
|
-This is a Vue 3 + TypeScript + Vite project for a policy application with virtual human/AI features. It includes 3D avatar rendering (Three.js), real-time chat with streaming responses, document viewing, and audio processing capabilities.
|
|
|
+青浦区营商智能助手前端。Vue 3 + TypeScript + Vite,面向企业的**政策匹配与办事指引**:
|
|
|
+用户自然语言提问,助手检索政策知识库,以「开场概述 + 政策卡片 + 综合说明 + 参考资料」
|
|
|
+的形式给出有原文依据的回答;涉及具体企业时先引导用户确认公司主体,再结合工商信息作答。
|
|
|
+
|
|
|
+关键事实(避免误判):
|
|
|
+
|
|
|
+- **对话走新接口** `POST /api/chat`(SSE)。前端不直接渲染新协议,而是经适配层
|
|
|
+ `src/components/api-chat-coordinator.ts` 翻译成既有渲染组件可识别的内容标记。
|
|
|
+ 详见下方「Core Systems」与根 README 的「对话接口的关键约束」。
|
|
|
+- **没有 3D 虚拟人渲染**。`three` 仅用于粒子背景(`business-assistant-particle.ts`);
|
|
|
+ `src/three-libs/asr` 用于**语音识别**;`src/three-libs/metamaker` 是一份未被引用的 SDK 包。
|
|
|
+- **没有状态管理库**(无 Vuex / Pinia)。对话状态在 `useBusinessAssistantChat` 内,
|
|
|
+ 会话与消息持久化到 `localStorage`。
|
|
|
+- 接口契约见 `docs/reference/`(现行 `api-chat.md`;`legacy/API.md` 仅为交接快照)。
|
|
|
|
|
|
## Common Commands
|
|
|
|
|
|
```bash
|
|
|
# Development
|
|
|
-npm run dev # Start dev server on port 8082
|
|
|
+npm run dev # Start dev server on port 8083 (HTTPS, self-signed)
|
|
|
npm run preview # Preview production build
|
|
|
|
|
|
# Building
|
|
|
@@ -30,22 +43,32 @@ npm run test # Run Jest tests
|
|
|
|
|
|
### Main Entry
|
|
|
- `src/main.ts` - Application entry point, creates Vue app
|
|
|
-- `src/App.vue` - Root component, renders the招商助手
|
|
|
-- `src/components/BusinessAssistant.vue` - Main招商助手 desktop shell
|
|
|
+- `src/App.vue` - Root component, renders the 招商助手
|
|
|
+- `src/components/BusinessAssistant.vue` - 只做 PC / 移动端切换,不是主壳
|
|
|
+- `src/components/BusinessAssistantPC.vue` / `BusinessAssistantMobile.vue` - 真正的页面主壳
|
|
|
+ (输入区、消息列表、滚动与打字机联动都在这里)
|
|
|
|
|
|
### Key Directories
|
|
|
-- `src/components/Chat/` - Chat UI and message handling (streaming support)
|
|
|
-- `src/components/Common/` - Shared UI components (MediaViewer, etc.)
|
|
|
-- `src/network/api/` - API endpoints (chat, faq, finance, group, human, project)
|
|
|
-- `src/types/` - TypeScript type definitions for events, audio, human, project configs
|
|
|
-- `src/hooks/` - Custom Vue hooks (window resize, recording)
|
|
|
-- `src/utils/` - Utilities and constants
|
|
|
+- `src/components/Chat/` - 消息渲染与政策卡片(BusinessRecord、PolicyMatch、QuestionCard…)
|
|
|
+- `src/components/Common/` - 通用 UI 组件(MediaViewer、ScrollList、Toast…)
|
|
|
+- `src/components/business-assistant/` - 对话编排(`useBusinessAssistantChat`、上传、滚动等)
|
|
|
+- `src/network/api/` - 接口封装:`chat-sessions.ts`、`enterprise.ts`、
|
|
|
+ `assistant-statistics.ts`、`card/`(**没有** chat / faq / finance / group / human / project 这些文件)
|
|
|
+- `src/types/` - TypeScript 类型定义
|
|
|
+- `src/utils/` - 工具(`runtime-config`、`stream-xml-filter`、`scope-record-rows`…)
|
|
|
+- `src/three-libs/asr/` - 语音识别(Three.js 相关代码只在这里和粒子背景中用到)
|
|
|
+
|
|
|
+> 注意:**没有 `src/hooks/` 目录。**
|
|
|
|
|
|
### Core Systems
|
|
|
-- **Streaming**: `stream-message-coordinator.ts` and `stream-message-coordinator-v2.ts` - Handle streaming message responses
|
|
|
-- **State Management**: Vuex 4
|
|
|
+- **对话协议适配(现行)**: `src/components/api-chat-coordinator.ts` —— 新接口 `POST /api/chat`
|
|
|
+ 的客户端。把 SSE 事件翻译成 `<scope>` / `<!-- POLICY_TABLE -->` / `<ref_links>` /
|
|
|
+ `<question-cards>` 等标记,交给既有渲染组件;渲染层不感知新协议。
|
|
|
+- **旧协议实现(保留未用,勿改)**: `src/components/stream-message-coordinator.ts`。
|
|
|
+ **没有 `stream-message-coordinator-v2.ts` 这个文件。**
|
|
|
+- **State Management**: 无状态管理库(无 Vuex / Pinia);状态在组合式函数 + `localStorage`
|
|
|
- **UI Library**: Ant Design Vue 4.x
|
|
|
-- **3D Rendering**: Three.js 0.143.0
|
|
|
+- **Three.js**: 0.143.0(粒子背景 + 语音识别相关,非 3D 虚拟人)
|
|
|
|
|
|
### Build Configuration
|
|
|
- Vite build config: `vite.config.ts`
|
|
|
@@ -53,12 +76,13 @@ npm run test # Run Jest tests
|
|
|
- Uses unplugin-vue-components for auto-importing Ant Design Vue components
|
|
|
|
|
|
### CI/CD
|
|
|
-- GitLab CI (`.gitlab-ci.yml`)
|
|
|
-- Branches matching `card*` trigger test build to demo OSS
|
|
|
-- Tags matching `tag_release*` trigger production build with CDN flush
|
|
|
+仓库内**没有** `.gitlab-ci.yml` 等流水线配置文件;构建入口就是上面的 npm scripts。
|
|
|
+若存在服务端流水线(GitLab / Gitea 后台配置),其规则请在服务端查看,不要以旧描述为准。
|
|
|
|
|
|
### API Proxies (dev mode)
|
|
|
- `/api/*` → `http://aixq.shqp.gov.cn`
|
|
|
+- `/chat-api/*` → `http://192.168.2.23:8000`(**新对话接口**;`rewrite` 去掉 `/chat-api` 前缀,
|
|
|
+ 最终请求 `…/api/chat`。仅 dev server 生效,生产需 nginx 等价转发)
|
|
|
- `/asr/*` → `https://human-screen-v3.metamaker.cn`
|
|
|
- `/stream/*` → `https://flv-enc.metamaker.cn`
|
|
|
|