docs(personal-assistant): define confirmed memory and simpler UX
This commit is contained in:
+39
-22
@@ -52,7 +52,7 @@
|
||||
| 文件 | 职责 |
|
||||
|---|---|
|
||||
| mobile-uni/src/services/personal-assistant.ts | API 客户端和类型归一化 |
|
||||
| mobile-uni/src/pages/user/assistant/index.vue | 提问、范围切换、答案与引用 |
|
||||
| mobile-uni/src/pages/user/sop/index.vue | 复用既有微信式会话,作为工作助手主入口;内部来源默认自动路由 |
|
||||
| mobile-uni/src/pages/user/assistant/library.vue | 个人资料列表和筛选 |
|
||||
| mobile-uni/src/pages/user/assistant/capture.vue | 文字、文件、网页收藏 |
|
||||
| mobile-uni/src/pages/user/assistant/item.vue | 资料详情、状态、重试、删除 |
|
||||
@@ -180,7 +180,8 @@ Expected: FAIL,提示 aihr_personal_knowledge_mysql8.sql 不存在。
|
||||
tenant_id varchar(20) NOT NULL,
|
||||
owner_user_id bigint NOT NULL,
|
||||
title varchar(200) NOT NULL,
|
||||
default_scope varchar(50) NOT NULL DEFAULT 'PERSONAL',
|
||||
default_scope_mode varchar(20) NOT NULL DEFAULT 'AUTO',
|
||||
default_scope_json json,
|
||||
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
@@ -305,10 +306,13 @@ Expected: FAIL,PersonalAssistantDto 不存在。
|
||||
|
||||
public record ItemCreatedResponse(long itemId, String status, Long duplicateOf) {}
|
||||
|
||||
public enum SearchScope { PERSONAL, ENTERPRISE }
|
||||
public enum ScopeMode { AUTO, MANUAL }
|
||||
|
||||
public enum SearchScope { PERSONAL, PROJECT_SERVICE, ENTERPRISE }
|
||||
|
||||
public record AskRequest(
|
||||
Long sessionId, String queryText, java.util.List<SearchScope> scope,
|
||||
Long sessionId, String queryText, ScopeMode scopeMode,
|
||||
java.util.List<SearchScope> scope,
|
||||
java.time.LocalDate dateFrom, java.time.LocalDate dateTo,
|
||||
java.util.List<Long> itemIds, String outputFormat) {}
|
||||
|
||||
@@ -317,7 +321,8 @@ Expected: FAIL,PersonalAssistantDto 不存在。
|
||||
java.time.LocalDateTime capturedAt) {}
|
||||
|
||||
public record AskResponse(
|
||||
long sessionId, String answer, java.util.List<CitationResponse> citations,
|
||||
long sessionId, String answer, java.util.List<SearchScope> resolvedScopes,
|
||||
java.util.List<CitationResponse> citations,
|
||||
String model, String promptVersion) {}
|
||||
|
||||
public record SpaceResponse(
|
||||
@@ -348,7 +353,7 @@ Expected: FAIL,PersonalAssistantDto 不存在。
|
||||
String queryText, java.util.List<SearchHitResponse> hits) {}
|
||||
|
||||
public record SessionResponse(
|
||||
long id, String title, String defaultScope,
|
||||
long id, String title, String defaultScopeMode,
|
||||
java.time.LocalDateTime updatedAt) {}
|
||||
|
||||
public record SessionDetailResponse(
|
||||
@@ -970,11 +975,10 @@ Expected: 单测 PASS;匿名请求业务响应为 401,接口没有 @SaIgnore
|
||||
|
||||
---
|
||||
|
||||
### Task 10: 实现 mobile-uni 个人助理页面
|
||||
### Task 10: 将现有「问」页升级为工作助手并接入个人助理
|
||||
|
||||
**Files:**
|
||||
- Create: mobile-uni/src/services/personal-assistant.ts
|
||||
- Create: mobile-uni/src/pages/user/assistant/index.vue
|
||||
- Create: mobile-uni/src/pages/user/assistant/library.vue
|
||||
- Create: mobile-uni/src/pages/user/assistant/capture.vue
|
||||
- Create: mobile-uni/src/pages/user/assistant/item.vue
|
||||
@@ -982,6 +986,7 @@ Expected: 单测 PASS;匿名请求业务响应为 401,接口没有 @SaIgnore
|
||||
- Create: mobile-uni/tests/personal-assistant.test.mjs
|
||||
- Modify: mobile-uni/src/pages.json
|
||||
- Modify: mobile-uni/src/pages/user/sop/index.vue
|
||||
- Modify: mobile-uni/src/pages/user/web-ai/index.vue
|
||||
- Modify: mobile-uni/src/types/api.ts
|
||||
|
||||
- [ ] **Step 1: 写失败的页面契约测试**
|
||||
@@ -992,14 +997,23 @@ Expected: 单测 PASS;匿名请求业务响应为 401,接口没有 @SaIgnore
|
||||
|
||||
const source = (path) => readFile(new URL(path, import.meta.url), 'utf8');
|
||||
|
||||
test('个人助理页面提供范围切换、引用和收藏入口', async () => {
|
||||
const page = await source('../src/pages/user/assistant/index.vue');
|
||||
assert.match(page, /我的资料/);
|
||||
assert.match(page, /企业知识/);
|
||||
test('工作助手默认自动选择内部资料范围', async () => {
|
||||
const page = await source('../src/pages/user/sop/index.vue');
|
||||
assert.match(page, /工作助手/);
|
||||
assert.match(page, /资料范围/);
|
||||
assert.match(page, /自动/);
|
||||
assert.match(page, /收藏资料/);
|
||||
assert.match(page, /citation\.domain/);
|
||||
});
|
||||
|
||||
test('一级入口只区分工作助手与查全网', async () => {
|
||||
const internalPage = await source('../src/pages/user/sop/index.vue');
|
||||
const webPage = await source('../src/pages/user/web-ai/index.vue');
|
||||
assert.match(internalPage, /工作助手/);
|
||||
assert.match(webPage, /查全网/);
|
||||
assert.doesNotMatch(internalPage, /企业问师傅\s*\/\s*个人助理\s*\/\s*全网/);
|
||||
});
|
||||
|
||||
test('个人资料页面包含状态、重试和删除', async () => {
|
||||
const page = await source('../src/pages/user/assistant/item.vue');
|
||||
assert.match(page, /PARSING|解析中/);
|
||||
@@ -1013,18 +1027,19 @@ Run:
|
||||
|
||||
npm --prefix mobile-uni run test:unit
|
||||
|
||||
Expected: FAIL,assistant 页面不存在。
|
||||
Expected: FAIL,现有「问」页尚未提供工作助手 AUTO 范围和简化后的一级入口。
|
||||
|
||||
- [ ] **Step 3: 实现 API 客户端**
|
||||
|
||||
personal-assistant.ts 固定使用现有 apiRequest:
|
||||
|
||||
export type KnowledgeScope = 'PERSONAL' | 'ENTERPRISE';
|
||||
export type InternalKnowledgeScope = 'PERSONAL' | 'PROJECT_SERVICE' | 'ENTERPRISE';
|
||||
|
||||
export const askPersonalAssistant = (payload: {
|
||||
sessionId?: number;
|
||||
queryText: string;
|
||||
scope: KnowledgeScope[];
|
||||
scopeMode: 'AUTO' | 'MANUAL';
|
||||
scope: InternalKnowledgeScope[];
|
||||
dateFrom?: string;
|
||||
dateTo?: string;
|
||||
itemIds?: number[];
|
||||
@@ -1047,7 +1062,8 @@ personal-assistant.ts 固定使用现有 apiRequest:
|
||||
|
||||
关键状态必须唯一:
|
||||
|
||||
const scopes = ref<KnowledgeScope[]>(['PERSONAL']);
|
||||
const scopeMode = ref<'AUTO' | 'MANUAL'>('AUTO');
|
||||
const manualScopes = ref<InternalKnowledgeScope[]>([]);
|
||||
const queryText = ref('');
|
||||
const asking = ref(false);
|
||||
const answer = ref<PersonalAskResponse>();
|
||||
@@ -1059,7 +1075,8 @@ personal-assistant.ts 固定使用现有 apiRequest:
|
||||
try {
|
||||
answer.value = await askPersonalAssistant({
|
||||
queryText: question,
|
||||
scope: scopes.value,
|
||||
scopeMode: scopeMode.value,
|
||||
scope: scopeMode.value === 'MANUAL' ? manualScopes.value : [],
|
||||
outputFormat: 'ACTION_PLAN'
|
||||
});
|
||||
} finally {
|
||||
@@ -1067,7 +1084,7 @@ personal-assistant.ts 固定使用现有 apiRequest:
|
||||
}
|
||||
};
|
||||
|
||||
引用卡必须按 citation.domain 显示“我的资料 / 企业 SOP / 外部网页”。默认只选 PERSONAL;用户主动选择后才启用 mixed。
|
||||
一级只显示“工作助手 / 查全网”。工作助手默认 `AUTO`,只在 PERSONAL / PROJECT_SERVICE / ENTERPRISE 三个内部授权域路由;“资料范围”放在输入区次级设置中。引用卡按 `citation.domain` 显示“我的资料 / 项目记录 / 企业 SOP”,让用户看得见实际来源。公网查询继续使用独立页面和接口,内部无命中时只能提示用户主动进入“查全网”,不得自动转发原问题或住户/项目内容。
|
||||
|
||||
- [ ] **Step 5: 运行移动端检查**
|
||||
|
||||
@@ -1081,7 +1098,7 @@ Expected: 全部 PASS;无新增横向滚动;页面路由存在。
|
||||
|
||||
- [ ] **Step 6: 提交**
|
||||
|
||||
git add mobile-uni/src/pages.json mobile-uni/src/pages/user/assistant mobile-uni/src/pages/user/sop/index.vue mobile-uni/src/services/personal-assistant.ts mobile-uni/src/types/api.ts mobile-uni/tests/personal-assistant.test.mjs
|
||||
git add mobile-uni/src/pages.json mobile-uni/src/pages/user/assistant mobile-uni/src/pages/user/sop/index.vue mobile-uni/src/pages/user/web-ai/index.vue mobile-uni/src/services/personal-assistant.ts mobile-uni/src/types/api.ts mobile-uni/tests/personal-assistant.test.mjs
|
||||
git commit -m "feat(mobile): add personal assistant knowledge flow"
|
||||
|
||||
---
|
||||
@@ -1128,7 +1145,7 @@ demo-check 增加静态 marker:
|
||||
|
||||
contains backend/script/sql/aihr_personal_knowledge_mysql8.sql "aihr_personal_fragment"
|
||||
contains backend/ruoyi-modules/ruoyi-aihr/src/main/java/org/dromara/aihr/personal/service/PersonalVectorStore.java "owner_user_id"
|
||||
contains mobile-uni/src/pages/user/assistant/index.vue "我的资料"
|
||||
contains mobile-uni/src/pages/user/sop/index.vue "资料范围"
|
||||
|
||||
API_INTEGRATION 记录 API、owner 注入规则和 mixed 引用域;DEV_SETUP 记录 Qdrant collection、配额配置和 smoke 命令;DEMO_ACCEPTANCE 记录浏览器闭环。
|
||||
|
||||
@@ -1240,7 +1257,7 @@ Expected: PASS;批准生成企业副本;个人 item owner 不变;员工可
|
||||
- Create: backend/ruoyi-modules/ruoyi-aihr/src/main/java/org/dromara/aihr/personal/service/PersonalExportService.java
|
||||
- Create: backend/ruoyi-modules/ruoyi-aihr/src/test/java/org/dromara/aihr/personal/PersonalExportServiceTest.java
|
||||
- Modify: mobile-uni/src/services/personal-assistant.ts
|
||||
- Modify: mobile-uni/src/pages/user/assistant/index.vue
|
||||
- Modify: mobile-uni/src/pages/user/sop/index.vue
|
||||
|
||||
- [ ] **Step 1: 写“先大纲后 PPT”的失败测试**
|
||||
|
||||
@@ -1305,7 +1322,7 @@ Expected: PASS;未确认大纲不能生成;PPTX 可被 POI 重新打开;
|
||||
|
||||
- [ ] **Step 6: 提交**
|
||||
|
||||
git add backend/ruoyi-modules/ruoyi-aihr/pom.xml backend/script/sql/aihr_personal_knowledge_mysql8.sql backend/ruoyi-modules/ruoyi-aihr/src/main/java/org/dromara/aihr/personal backend/ruoyi-modules/ruoyi-aihr/src/test/java/org/dromara/aihr/personal/PersonalExportServiceTest.java mobile-uni/src/services/personal-assistant.ts mobile-uni/src/pages/user/assistant/index.vue
|
||||
git add backend/ruoyi-modules/ruoyi-aihr/pom.xml backend/script/sql/aihr_personal_knowledge_mysql8.sql backend/ruoyi-modules/ruoyi-aihr/src/main/java/org/dromara/aihr/personal backend/ruoyi-modules/ruoyi-aihr/src/test/java/org/dromara/aihr/personal/PersonalExportServiceTest.java mobile-uni/src/services/personal-assistant.ts mobile-uni/src/pages/user/sop/index.vue
|
||||
git commit -m "feat(personal): export reviewed outlines to pptx"
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user