@infinilabs/chat-message 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatMessage.cjs +21 -13
- package/dist/ChatMessage.iife.js +21 -13
- package/dist/ChatMessage.js +6712 -1077
- package/dist/ChatMessage.umd.cjs +21 -13
- package/dist/components/DeepResearch/DeepResearchDrawer.d.ts +19 -0
- package/dist/components/DeepResearch/ResearchReportContent.d.ts +12 -0
- package/dist/components/DeepResearch/ResearchSearchResultsContent.d.ts +7 -0
- package/dist/components/DeepResearch/ResearchStepsContent.d.ts +57 -0
- package/dist/components/DeepResearch/index.d.ts +21 -0
- package/dist/components/PayloadCard.d.ts +13 -0
- package/dist/components/index.d.ts +2 -9
- package/dist/hooks/useMessageChunkData.d.ts +2 -0
- package/dist/mockRealData.d.ts +24 -0
- package/dist/mocks.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +5 -13
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StepItem, StepStatus, StepSearchHit } from './ResearchStepsContent';
|
|
2
|
+
import { ResearchReportData } from './ResearchReportContent';
|
|
3
|
+
interface DeepResearchDrawerProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
defaultActiveTab?: string;
|
|
7
|
+
steps?: StepItem[];
|
|
8
|
+
plannerStatus?: StepStatus;
|
|
9
|
+
executionStatus?: StepStatus;
|
|
10
|
+
reportStatus?: StepStatus;
|
|
11
|
+
reportData?: ResearchReportData;
|
|
12
|
+
reportContent?: string;
|
|
13
|
+
searchHits?: StepSearchHit[];
|
|
14
|
+
formatUrl?: (data: any) => string;
|
|
15
|
+
theme?: "light" | "dark";
|
|
16
|
+
showReportOnly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const DeepResearchDrawer: ({ open, onClose, defaultActiveTab, steps, plannerStatus, executionStatus, reportStatus, reportData, reportContent, searchHits, formatUrl, theme, showReportOnly, }: DeepResearchDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ResearchReportData {
|
|
2
|
+
title?: string;
|
|
3
|
+
url?: string;
|
|
4
|
+
created?: string;
|
|
5
|
+
attachment?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ResearchReportContentProps {
|
|
8
|
+
content?: string;
|
|
9
|
+
data?: ResearchReportData;
|
|
10
|
+
formatUrl?: (data: any) => string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ResearchReportContent: ({ content, data, formatUrl }: ResearchReportContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StepSearchHit } from './ResearchStepsContent';
|
|
2
|
+
interface ResearchSearchResultsContentProps {
|
|
3
|
+
hits?: StepSearchHit[];
|
|
4
|
+
theme?: "light" | "dark";
|
|
5
|
+
}
|
|
6
|
+
export declare const ResearchSearchResultsContent: ({ hits, theme, }: ResearchSearchResultsContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 步骤状态类型定义
|
|
3
|
+
* done: 已完成
|
|
4
|
+
* in_progress: 进行中
|
|
5
|
+
* pending: 等待中
|
|
6
|
+
*/
|
|
7
|
+
export type StepStatus = "done" | "in_progress" | "pending";
|
|
8
|
+
/**
|
|
9
|
+
* 搜索状态类型定义
|
|
10
|
+
* done: 搜索完成
|
|
11
|
+
* searching: 正在搜索
|
|
12
|
+
*/
|
|
13
|
+
export type StepSearchStatus = "done" | "searching";
|
|
14
|
+
/**
|
|
15
|
+
* 搜索结果条目接口
|
|
16
|
+
*/
|
|
17
|
+
export interface StepSearchHit {
|
|
18
|
+
source?: string;
|
|
19
|
+
title: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
content?: string;
|
|
22
|
+
score?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 搜索任务接口
|
|
26
|
+
*/
|
|
27
|
+
export interface StepSearch {
|
|
28
|
+
id: string;
|
|
29
|
+
query: string;
|
|
30
|
+
resultCount?: number;
|
|
31
|
+
status: StepSearchStatus;
|
|
32
|
+
note?: string;
|
|
33
|
+
hits?: StepSearchHit[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 研究步骤条目接口
|
|
37
|
+
*/
|
|
38
|
+
export interface StepItem {
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
status: StepStatus;
|
|
43
|
+
searches?: StepSearch[];
|
|
44
|
+
showOptimizePlan?: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface ResearchStepsContentProps {
|
|
47
|
+
steps?: StepItem[];
|
|
48
|
+
plannerStatus?: StepStatus;
|
|
49
|
+
executionStatus?: StepStatus;
|
|
50
|
+
reportStatus?: StepStatus;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 深层研究步骤内容组件
|
|
54
|
+
* 展示研究计划、执行步骤和报告生成的全过程状态
|
|
55
|
+
*/
|
|
56
|
+
export declare const ResearchStepsContent: ({ steps, plannerStatus, executionStatus, reportStatus, }: ResearchStepsContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StepItem, StepStatus, StepSearchHit } from './ResearchStepsContent';
|
|
2
|
+
import { ResearchReportData } from './ResearchReportContent';
|
|
3
|
+
interface DeepResearchProps {
|
|
4
|
+
stepTitle: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
query: string;
|
|
7
|
+
statusText?: string;
|
|
8
|
+
resultCount?: number;
|
|
9
|
+
progress?: number;
|
|
10
|
+
steps?: StepItem[];
|
|
11
|
+
plannerStatus?: StepStatus;
|
|
12
|
+
executionStatus?: StepStatus;
|
|
13
|
+
reportStatus?: StepStatus;
|
|
14
|
+
reportData?: ResearchReportData;
|
|
15
|
+
reportContent?: string;
|
|
16
|
+
searchHits?: StepSearchHit[];
|
|
17
|
+
formatUrl?: (data: any) => string;
|
|
18
|
+
theme?: "light" | "dark";
|
|
19
|
+
}
|
|
20
|
+
export declare const DeepResearch: ({ stepTitle, description, query, statusText, resultCount, progress, steps, plannerStatus, executionStatus, reportStatus, reportData, reportContent, searchHits, formatUrl, theme, }: DeepResearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface PayloadCardProps {
|
|
2
|
+
payload: {
|
|
3
|
+
title?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
created?: string | number;
|
|
6
|
+
type?: string;
|
|
7
|
+
content?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
formatUrl?: (data: any) => string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PayloadCard: ({ payload, formatUrl }: PayloadCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -12,16 +12,9 @@ export interface ChatMessageProps {
|
|
|
12
12
|
formatUrl?: (data: IChunkData) => string;
|
|
13
13
|
theme?: "light" | "dark" | "system";
|
|
14
14
|
locale?: string;
|
|
15
|
-
|
|
16
|
-
tools?: IChunkData;
|
|
17
|
-
fetch_source?: IChunkData;
|
|
18
|
-
pick_source?: IChunkData;
|
|
19
|
-
deep_read?: IChunkData;
|
|
20
|
-
think?: IChunkData;
|
|
21
|
-
response?: IChunkData;
|
|
22
|
-
currentAssistant?: any;
|
|
15
|
+
report_content?: string;
|
|
23
16
|
assistantList?: any[];
|
|
24
|
-
|
|
17
|
+
currentAssistant?: any;
|
|
25
18
|
}
|
|
26
19
|
export interface ChatMessageRef {
|
|
27
20
|
addChunk: (chunk: IChunkData) => void;
|
|
@@ -8,6 +8,7 @@ export default function useMessageChunkData(): {
|
|
|
8
8
|
deep_read: IChunkData | undefined;
|
|
9
9
|
think: IChunkData | undefined;
|
|
10
10
|
response: IChunkData | undefined;
|
|
11
|
+
deepResearch: IChunkData | undefined;
|
|
11
12
|
};
|
|
12
13
|
handlers: {
|
|
13
14
|
deal_query_intent: (data: IChunkData) => void;
|
|
@@ -17,6 +18,7 @@ export default function useMessageChunkData(): {
|
|
|
17
18
|
deal_deep_read: (data: IChunkData) => void;
|
|
18
19
|
deal_think: (data: IChunkData) => void;
|
|
19
20
|
deal_response: (data: IChunkData) => void;
|
|
21
|
+
deal_deep_research: (data: IChunkData) => void;
|
|
20
22
|
};
|
|
21
23
|
clearAllChunkData: () => Promise<void>;
|
|
22
24
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IChunkData } from './types/chat';
|
|
2
|
+
export declare const realDataInitialMessages: {
|
|
3
|
+
_id: string;
|
|
4
|
+
_source: {
|
|
5
|
+
id: string;
|
|
6
|
+
created: string;
|
|
7
|
+
updated: string;
|
|
8
|
+
_system: {
|
|
9
|
+
owner_id: string;
|
|
10
|
+
tenant_id: string;
|
|
11
|
+
};
|
|
12
|
+
type: string;
|
|
13
|
+
session_id: string;
|
|
14
|
+
from: string;
|
|
15
|
+
message: string;
|
|
16
|
+
details: null;
|
|
17
|
+
up_vote: number;
|
|
18
|
+
down_vote: number;
|
|
19
|
+
assistant_id: string;
|
|
20
|
+
payload: null;
|
|
21
|
+
};
|
|
22
|
+
result: string;
|
|
23
|
+
}[];
|
|
24
|
+
export declare const realDataChunks: IChunkData[];
|
package/dist/mocks.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IChunkData } from './types/chat';
|
|
2
|
+
export declare const deepResearchMockChunks: IChunkData[];
|
|
3
|
+
export declare const mockResearchReportContent = "# What is coco ai\n\n## \u6458\u8981\n\n\u672C\u7814\u7A76\u62A5\u544A\u5BF9 Coco AI \u76F8\u5173\u7684\u7CFB\u7EDF\u4E0E\u80FD\u529B\u8FDB\u884C\u4E86\u8C03\u7814\u548C\u5206\u6790\uFF0C\u5BF9\u5176\u4EA7\u54C1\u5B9A\u4F4D\u3001\u6280\u672F\u7279\u70B9\u3001\u5E94\u7528\u573A\u666F\u4EE5\u53CA\u5E02\u573A\u7ADE\u4E89\u529B\u8FDB\u884C\u4E86\u7CFB\u7EDF\u6027\u68B3\u7406\u3002\n\n## \u76EE\u5F55\n\n1. [Coco AI \u6982\u8FF0\u4E0E\u57FA\u672C\u5B9A\u4E49]\n2. [Coco AI \u6838\u5FC3\u6280\u672F\u4E0E\u529F\u80FD\u7279\u6027]\n3. [\u5E02\u573A\u7ADE\u4E89\u5206\u6790\u4E0E\u5DEE\u5F02\u5316\u4F18\u52BF]\n4. [\u5E94\u7528\u573A\u666F\u4E0E\u5B9E\u9645\u4F7F\u7528\u6848\u4F8B]\n5. [\u53D1\u5C55\u5386\u7A0B\u4E0E\u7248\u672C\u6F14\u8FDB]\n6. [\u53D1\u5C55\u524D\u666F\u4E0E\u8D8B\u52BF\u5C55\u671B]\n\n## Coco AI \u6982\u8FF0\u4E0E\u57FA\u672C\u5B9A\u4E49\n\n### 1.1 \u4EA7\u54C1\u5B9A\u4F4D\u4E0E\u6838\u5FC3\u6982\u5FF5\n\nCoco AI \u662F\u9762\u5411\u4F01\u4E1A\u7EA7\u77E5\u8BC6\u68C0\u7D22\u4E0E\u667A\u80FD\u95EE\u7B54\u573A\u666F\u6253\u9020\u7684\u667A\u80FD\u641C\u7D22\u7CFB\u7EDF\uFF0C\u4E13\u6CE8\u4E8E\u901A\u8FC7\u81EA\u7136\u8BED\u8A00\u4EA4\u4E92\u5E2E\u52A9\u7528\u6237\u5728\u590D\u6742\u7684\u4FE1\u606F\u7CFB\u7EDF\u4E2D\u9AD8\u6548\u83B7\u53D6\u7B54\u6848\u3002\n\n\u8BE5\u4EA7\u54C1\u5B9A\u4F4D\u4E3A\u4F01\u4E1A\u7EA7\u667A\u80FD\u6570\u636E\u641C\u7D22\u4E0E\u77E5\u8BC6\u89E3\u51B3\u65B9\u6848\uFF0C\u76EE\u6807\u662F\u63D0\u5347\u4FE1\u606F\u68C0\u7D22\u6548\u7387\u3001\u964D\u4F4E\u77E5\u8BC6\u83B7\u53D6\u95E8\u69DB\uFF0C\u5E76\u901A\u8FC7\u667A\u80FD\u63A8\u8350\u4E0E\u8BED\u4E49\u7406\u89E3\u80FD\u529B\uFF0C\u63D0\u5347\u6574\u4F53\u51B3\u7B56\u8D28\u91CF\u3002\n\n### 1.2 \u6280\u672F\u7279\u5F81\u4E0E\u529F\u80FD\u5C5E\u6027\n\n#### 1.2.1 \u667A\u80FD\u68C0\u7D22\u80FD\u529B\n\nCoco AI \u4F9D\u6258\u8BED\u4E49\u7406\u89E3\u548C\u5927\u6A21\u578B\u76F8\u5173\u6280\u672F\uFF0C\u652F\u6301\u5BF9\u975E\u7ED3\u6784\u5316\u6587\u672C\u3001\u534A\u7ED3\u6784\u5316\u5185\u5BB9\u4EE5\u53CA\u591A\u6E90\u5F02\u6784\u6570\u636E\u8FDB\u884C\u7EDF\u4E00\u68C0\u7D22\u4E0E\u805A\u5408\uFF0C\u63D0\u4F9B\u591A\u7EF4\u5EA6\u3001\u53EF\u8FFD\u6EAF\u7684\u68C0\u7D22\u7ED3\u679C\u3002";
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dist",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.0.
|
|
11
|
+
"version": "0.0.8",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "dist/ChatMessage.cjs",
|
|
@@ -33,27 +33,19 @@
|
|
|
33
33
|
"react-i18next": ">=11.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ant-design/x-markdown": "^2.1.3",
|
|
37
36
|
"@infinilabs/attachments": "^0.0.1",
|
|
38
|
-
"@
|
|
37
|
+
"@infinilabs/markdown": "^0.0.2",
|
|
38
|
+
"@infinilabs/search-results": "^0.0.16",
|
|
39
39
|
"ahooks": "^3.9.6",
|
|
40
40
|
"antd": "^6.1.4",
|
|
41
41
|
"clsx": "^2.1.1",
|
|
42
42
|
"i18next": "^25.7.3",
|
|
43
43
|
"lucide-react": "^0.461.0",
|
|
44
|
-
"
|
|
45
|
-
"motion": "^12.25.0",
|
|
46
|
-
"react-markdown": "^9.1.0",
|
|
47
|
-
"rehype-highlight": "^7.0.2",
|
|
48
|
-
"rehype-katex": "^7.0.1",
|
|
49
|
-
"remark-breaks": "^4.0.0",
|
|
50
|
-
"remark-gfm": "^4.0.1",
|
|
51
|
-
"remark-math": "^6.0.0",
|
|
52
|
-
"use-debounce": "^10.0.4",
|
|
53
|
-
"zustand": "^5.0.4"
|
|
44
|
+
"motion": "^12.25.0"
|
|
54
45
|
},
|
|
55
46
|
"devDependencies": {
|
|
56
47
|
"@eslint/js": "^9.33.0",
|
|
48
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
57
49
|
"@types/react": "18.3.3",
|
|
58
50
|
"@types/react-dom": "18.3.0",
|
|
59
51
|
"@vitejs/plugin-react": "^5.0.0",
|