@myun/gimi-chat 0.0.9 → 0.1.1

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/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- export * from './components';
1
+ import { GimiChatComponent } from './components';
2
+ export * from './types';
3
+ export * from './interfaces';
4
+ export default GimiChatComponent;
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export * from "./components";
1
+ import { GimiChatComponent } from "./components";
2
+ export * from "./types";
3
+ export * from "./interfaces";
4
+ export default GimiChatComponent;
@@ -0,0 +1,3 @@
1
+ export * from './chatMessage';
2
+ export * from './fileInterface';
3
+ export * from './knowledgeTrace';
@@ -0,0 +1,3 @@
1
+ export * from "./chatMessage";
2
+ export * from "./fileInterface";
3
+ export * from "./knowledgeTrace";
@@ -0,0 +1,16 @@
1
+ export type MCPItem = {
2
+ name: string;
3
+ // executeWorkflowByDescription: 查询工作流
4
+ // notifyWorkflowStart: 开始执行工作流
5
+ // executeWorkflowById: 这个节点表示此条无效mcp应该被过滤掉
6
+ // interrupt: 前端自定义打断状态
7
+ status: 'executeWorkflowByDescription' | 'notifyWorkflowStart' | 'executeWorkflowById' | 'interrupt';
8
+ }
9
+
10
+ export type KonwledgeType = 'video' | 'document' | 'product';
11
+
12
+ export interface KonwledgeTraceState {
13
+ type: KonwledgeType;
14
+ resources: {id: string, productIds?: number[]}[];
15
+ messageId: number | null;
16
+ }
@@ -0,0 +1,124 @@
1
+ import { IChatMessageItem } from "../interfaces/chatMessage";
2
+ import { ChatInputRef } from "../components/chat-input";
3
+ import { Content } from "@douyinfe/semi-ui/lib/cjs/aiChatInput";
4
+
5
+ export interface CommonChatRef {
6
+ messageList: IChatMessageItem[];
7
+ agentDetail?: AgentConfig;
8
+ conversationId?: number | null;
9
+ inputEditor?: ChatInputRef | null;
10
+ }
11
+
12
+ export interface IAIInputProps {
13
+ placeholder?: string;
14
+ onContentChange?: (content: Content[]) => void;
15
+ defaultPrompt?: string;
16
+ disabled?: boolean;
17
+ onBeforeSend?: (text: string) => void;
18
+ onSend?: (text: string) => void;
19
+ onConversationCreated?: (conversationId: number) => void;
20
+ onSendEnd?: (message: IChatMessageItem) => void;
21
+ enableVoiceRecord?: boolean;
22
+ enableVoiceChat?: boolean;
23
+ enableFileUpload?: boolean;
24
+ enableSourceQuote?: boolean;
25
+ style?: React.CSSProperties;
26
+ className?: string;
27
+ }
28
+
29
+ // 语音情感子接口
30
+ export interface VoiceEmotion {
31
+ name?: string;
32
+ param?: string;
33
+ }
34
+
35
+ // 语音配置子接口
36
+ export interface VoiceConfig {
37
+ emotions?: VoiceEmotion[];
38
+ gender?: string;
39
+ isSupportMix?: number;
40
+ languageCode?: string;
41
+ languageId?: number;
42
+ languageName?: string;
43
+ scene?: string;
44
+ toneId?: number;
45
+ toneName?: string;
46
+ voiceType?: string;
47
+ }
48
+
49
+ // 工作流列表子接口
50
+ export interface WorkflowItem {
51
+ botFlowId?: string;
52
+ workflowId?: number;
53
+ workflowName?: string;
54
+ }
55
+
56
+ // 根接口(对应完整 JSON 结构)
57
+ export interface AgentConfig {
58
+ agentIcon?: string;
59
+ agentId?: number;
60
+ agentIntroduce?: string;
61
+ agentMode?: string;
62
+ agentName?: string;
63
+ agentState?: number;
64
+ agentType?: string;
65
+ botId?: string;
66
+ botInstructionId?: number;
67
+ characterSetting?: null;
68
+ conversationType?: number;
69
+ customizeInstructContent?: null;
70
+ defaultPrompt?: string;
71
+ inputPrompt?: string;
72
+ isCustomizeInstruct?: number;
73
+ isEnableRelated?: number;
74
+ isEnableVoiceCall?: number;
75
+ maxLength?: null;
76
+ modeType?: null;
77
+ openUploadFile?: number;
78
+ productId?: number;
79
+ prologue?: string;
80
+ questionList?: any[]; // 空数组,无具体子结构,使用 any[] 兼容
81
+ showName?: string;
82
+ showNameStatus?: number;
83
+ sourceModelId?: null;
84
+ temperature?: null;
85
+ voiceConfigs?: VoiceConfig[];
86
+ workflowList?: WorkflowItem[];
87
+ }
88
+
89
+ export interface CommonChatProps {
90
+ showInput?: boolean;
91
+ baseUrl?: string;
92
+ token?: string;
93
+ showHeader?: boolean;
94
+ chatInputConfig?: IAIInputProps;
95
+ platform?: 'myun' | 'preview' | 'damai';
96
+ businessType: 'correction' | 'chat';
97
+ bussinessParams?: Record<string, any>;
98
+ defaultMessages?: IChatMessageItem[];
99
+ agentDetail?: AgentConfig;
100
+ agentId?: number,
101
+ showPrologue?: boolean;
102
+ quickQuestionListPosition?: 'top' | 'bottom';
103
+ model?: 'sidebar' | 'fullscreen';
104
+ sidebarConfig?: {
105
+ sidebarTargetElm?: HTMLElement;
106
+ className?: string;
107
+ style?: React.CSSProperties;
108
+ }
109
+ conversationId?: number;
110
+ messageConfig?: MessageConfig;
111
+ }
112
+
113
+ export interface MessageConfig {
114
+ onCopyCallback?: () => void;
115
+ onLikeCallback?: () => void;
116
+ onUnLikeCallback?: () => void;
117
+ onDownloadCallback?: () => void;
118
+ enableLike?: boolean;
119
+ enableUnLike?: boolean;
120
+ enableCopy?: boolean;
121
+ enableRegenerate?: boolean;
122
+ enableVoicePlay?: boolean;
123
+ reasoningTitle?: string;
124
+ }
@@ -0,0 +1,20 @@
1
+ export type FileItem = {
2
+ uid: string;
3
+ name: string;
4
+ size: string;
5
+ status: FileStatus;
6
+ fileUrl?: string;
7
+ fileName?: string; // 后端返回的文件名(可选)
8
+ fileSize?: number; // 后端返回的文件大小(可选)
9
+ fileType?: string; // 后端返回的文件类型(可选)
10
+ fileId?: string; // 后端返回的文件ID(可选)
11
+ fileToken?: string; // 关键!后端返回的文件标识,用于SSE调用
12
+ content?: string; // SSE返回的内容
13
+ }
14
+
15
+ export interface IFileCardProps {
16
+ fileName: string;
17
+ downloadUrl: string;
18
+ size: string;
19
+ fileType: string;
20
+ }
@@ -0,0 +1,3 @@
1
+ export * from './answer';
2
+ export * from './chat';
3
+ export * from './file';
@@ -0,0 +1,3 @@
1
+ export * from "./answer";
2
+ export * from "./chat";
3
+ export * from "./file";
@@ -0,0 +1,36 @@
1
+ declare module '*.module.scss' {
2
+ const classes: { [key: string]: string };
3
+ export default classes;
4
+ }
5
+
6
+ declare module '*.scss' {
7
+ const content: { [key: string]: any };
8
+ export default content;
9
+ }
10
+
11
+ declare module '*.png' {
12
+ const src: string;
13
+ export default src;
14
+ }
15
+
16
+ declare module '*.jpg' {
17
+ const src: string;
18
+ export default src;
19
+ }
20
+
21
+ declare module '*.jpeg' {
22
+ const src: string;
23
+ export default src;
24
+ }
25
+
26
+ declare module '*.svg' {
27
+ const src: string;
28
+ export default src;
29
+ }
30
+
31
+ declare module '*.gif' {
32
+ const src: string;
33
+ export default src;
34
+ }
35
+
36
+ declare module 'crypto-js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myun/gimi-chat",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export default function Demo(): React.JSX.Element;
@@ -1,117 +0,0 @@
1
- import GimiChatComponent from "../GimiChatComponent";
2
- import React from "react";
3
- export default function Demo() {
4
- return /*#__PURE__*/React.createElement("div", {
5
- style: {
6
- height: '600px'
7
- }
8
- }, /*#__PURE__*/React.createElement(GimiChatComponent, {
9
- baseUrl: 't-mgateway.gaodunwangxiao.com',
10
- businessType: "correction",
11
- token: 'eyJhZ2VuY3kiOjk1NTU1LCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJHYW9kdW4iLCJpYXQiOjE3NjkwNTIxOTIsInN1YiI6IjE1Mjg4NzQiLCJpc3MiOiJHYW9kdW4iLCJleHAiOjE3NzE2NDQxOTJ9.SykzOBvTDbKydD0k7NrWY1G56LfGMWRJN0QrvNTdDTE',
12
- platform: "myun",
13
- agentId: 62
14
- // bussinessParams={
15
- // {
16
- // "ANSWER_ID": 19923,
17
- // "QUESTION_ID": 77595
18
- // }
19
- // }
20
- // agentDetail={{
21
- // "agentIcon": "https://mstatic.gaodunwangxiao.com/image/2025/09/24/Excel建模-1758706152601.png",
22
- // "agentId": 65,
23
- // "agentIntroduce": "帮你智能搭建财务数据表格信息",
24
- // "agentMode": "workflow",
25
- // "agentName": "智能Excel建模",
26
- // "agentState": 1,
27
- // "agentType": "product",
28
- // "botId": "BOT1757402118115",
29
- // "botInstructionId": 0,
30
- // "characterSetting": null,
31
- // "conversationType": 2,
32
- // "customizeInstructContent": null,
33
- // "defaultPrompt": "我要生成一个{{输入模板名称,如PVM模板}},用于{{输入使用场景,如分析收入增长主要驱动力}}。关键数据:{{输入数据}}",
34
- // "inputPrompt": "",
35
- // "isCustomizeInstruct": 0,
36
- // "isEnableRelated": 1,
37
- // "isEnableVoiceCall": 0,
38
- // "maxLength": null,
39
- // "modeType": null,
40
- // "openUploadFile": 1,
41
- // "productId": 36842,
42
- // "prologue": "帮你智能搭建财务数据表格信息",
43
- // "questionList": [
44
- // {
45
- // "id": 127,
46
- // "question": "会计是现代社会经济活动开展的重要基础,也是推动国际经贸往来的重要保障"
47
- // },
48
- // {
49
- // "id": 128,
50
- // "question": "全面预算的执行和监控中可以采用什么方式做好业务支持和预算管控?"
51
- // }
52
- // ],
53
- // "showName": "智能Excel建模",
54
- // "showNameStatus": 1,
55
- // "sourceModelId": null,
56
- // "temperature": null,
57
- // "voiceConfigs": [
58
- // {
59
- // "emotions": [
60
- // {
61
- // "name": "悲伤",
62
- // "param": "sad"
63
- // },
64
- // {
65
- // "name": "恐惧",
66
- // "param": "fear"
67
- // },
68
- // {
69
- // "name": "厌恶",
70
- // "param": "hate"
71
- // },
72
- // {
73
- // "name": "中性",
74
- // "param": "neutral"
75
- // }
76
- // ],
77
- // "gender": "female",
78
- // "isSupportMix": 0,
79
- // "languageCode": "zh-CN",
80
- // "languageId": 1,
81
- // "languageName": "中文",
82
- // "scene": "多情感",
83
- // "toneId": 2,
84
- // "toneName": "甜心小美(多情感)",
85
- // "voiceType": "zh_female_tianxinxiaomei_emo_v2_mars_bigtts"
86
- // }
87
- // ],
88
- // "workflowList": [
89
- // {
90
- // "botFlowId": "MC-2CDBD8AB38B6410A8C14EE503C9ADBCE",
91
- // "workflowId": 315,
92
- // "workflowName": "excel生成926(第3版)"
93
- // }
94
- // ]
95
- // }}
96
- ,
97
- showPrologue: true,
98
- model: 'fullscreen'
99
- // conversationId={7988}
100
- ,
101
- chatInputConfig: {
102
- enableFileUpload: true,
103
- enableVoiceChat: true,
104
- enableVoiceRecord: true,
105
- enableSourceQuote: true,
106
- onBeforeSend: function onBeforeSend(text) {
107
- console.log('onBeforeSend', text);
108
- },
109
- onConversationCreated: function onConversationCreated(conversationId) {
110
- console.log('创建会话了', conversationId);
111
- }
112
- },
113
- messageConfig: {
114
- enableRegenerate: true
115
- }
116
- }));
117
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const Demo: () => React.JSX.Element;
3
- export default Demo;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import WorkFlowContent from "./index";
3
- var Demo = function Demo() {
4
- return /*#__PURE__*/React.createElement(WorkFlowContent, {
5
- chatItem: {
6
- mcp: '这是一条工作流内容',
7
- status: 'executeWorkflowByDescription'
8
- }
9
- });
10
- };
11
- export default Demo;