@infinilabs/chat-message 0.0.6 → 0.0.7
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 +6645 -1036
- package/dist/ChatMessage.umd.cjs +21 -13
- package/dist/components/DeepResearch/DeepResearchDrawer.d.ts +18 -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 +33 -0
- package/dist/components/DeepResearch/index.d.ts +21 -0
- package/dist/components/PayloadCard.d.ts +11 -0
- package/dist/components/index.d.ts +16 -0
- package/dist/mocks.d.ts +3 -0
- package/package.json +5 -13
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
17
|
+
export declare const DeepResearchDrawer: ({ open, onClose, defaultActiveTab, steps, plannerStatus, executionStatus, reportStatus, reportData, reportContent, searchHits, formatUrl, theme, }: DeepResearchDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
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,33 @@
|
|
|
1
|
+
export type StepStatus = "done" | "in_progress" | "pending";
|
|
2
|
+
export type StepSearchStatus = "done" | "searching";
|
|
3
|
+
export interface StepSearchHit {
|
|
4
|
+
source?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
content?: string;
|
|
8
|
+
score?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface StepSearch {
|
|
11
|
+
id: string;
|
|
12
|
+
query: string;
|
|
13
|
+
resultCount?: number;
|
|
14
|
+
status: StepSearchStatus;
|
|
15
|
+
note?: string;
|
|
16
|
+
hits?: StepSearchHit[];
|
|
17
|
+
}
|
|
18
|
+
export interface StepItem {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
status: StepStatus;
|
|
23
|
+
searches?: StepSearch[];
|
|
24
|
+
showOptimizePlan?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface ResearchStepsContentProps {
|
|
27
|
+
steps?: StepItem[];
|
|
28
|
+
plannerStatus?: StepStatus;
|
|
29
|
+
executionStatus?: StepStatus;
|
|
30
|
+
reportStatus?: StepStatus;
|
|
31
|
+
}
|
|
32
|
+
export declare const ResearchStepsContent: ({ steps, plannerStatus, executionStatus, reportStatus, }: ResearchStepsContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
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,11 @@
|
|
|
1
|
+
interface PayloadCardProps {
|
|
2
|
+
payload: {
|
|
3
|
+
title?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
created?: string | number;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
formatUrl?: (data: any) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PayloadCard: ({ payload, formatUrl }: PayloadCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IChatMessage, IChunkData } from '../types/chat';
|
|
2
|
+
import { StepSearchHit } from './DeepResearch/ResearchStepsContent';
|
|
3
|
+
import { ResearchReportData } from './DeepResearch/ResearchReportContent';
|
|
2
4
|
export type { IChatMessage, IChunkData };
|
|
3
5
|
export interface ChatMessageProps {
|
|
4
6
|
message: IChatMessage;
|
|
@@ -19,9 +21,23 @@ export interface ChatMessageProps {
|
|
|
19
21
|
deep_read?: IChunkData;
|
|
20
22
|
think?: IChunkData;
|
|
21
23
|
response?: IChunkData;
|
|
24
|
+
report_content?: string;
|
|
22
25
|
currentAssistant?: any;
|
|
23
26
|
assistantList?: any[];
|
|
24
27
|
loadingStep?: Record<string, boolean>;
|
|
28
|
+
deepResearchPlans?: string[];
|
|
29
|
+
deepResearchCurrentStepIndex?: number;
|
|
30
|
+
deepResearchQuery?: string;
|
|
31
|
+
deepResearchResultCount?: number;
|
|
32
|
+
deepResearchResearcherStarted?: boolean;
|
|
33
|
+
deepResearchReporterStarted?: boolean;
|
|
34
|
+
deepResearchReporterFinished?: boolean;
|
|
35
|
+
deepResearchReportData?: ResearchReportData;
|
|
36
|
+
deepResearchSearchMap?: Record<string, {
|
|
37
|
+
query?: string;
|
|
38
|
+
resultCount?: number;
|
|
39
|
+
hits?: StepSearchHit[];
|
|
40
|
+
}>;
|
|
25
41
|
}
|
|
26
42
|
export interface ChatMessageRef {
|
|
27
43
|
addChunk: (chunk: IChunkData) => void;
|
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/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dist",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.0.
|
|
11
|
+
"version": "0.0.7",
|
|
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",
|