@antv/dumi-theme-antv 0.8.0-beta.1 → 0.8.0-beta.3
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/components/AI/HomeDialog/ModeSelector/index.js +4 -1
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +5 -2
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +0 -1
- package/dist/components/AI/HomeDialog/PromptTextarea/Uploader/DataUploader.js +225 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +57 -26
- package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +1 -0
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +10 -3
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +7 -2
- package/dist/components/AI/HomeDialog/index.js +11 -3
- package/dist/components/AI/constant.js +2 -2
- package/dist/hooks/useProducts.js +3 -2
- package/dist/locales/en.json +91 -1
- package/dist/locales/zh.json +91 -1
- package/dist/model/AIChat.js +5 -3
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +26 -7
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +14 -4
- package/dist/pages/AIPlayground/components/MsgBox/index.js +29 -9
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +18 -10
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +2 -0
- package/dist/pages/AIPlayground/components/TaskBox/index.js +77 -33
- package/dist/plugin/index.js +2 -2
- package/dist/slots/CodeEditor/Toolbar.js +15 -9
- package/dist/slots/CodeEditor/index.js +15 -9
- package/dist/slots/CodeRunner/index.js +5 -2
- package/dist/slots/Header/Search/SearchResult.js +8 -3
- package/dist/slots/Header/index.js +24 -8
- package/package.json +1 -1
package/dist/locales/en.json
CHANGED
|
@@ -178,5 +178,95 @@
|
|
|
178
178
|
"企业级 Node 开发框架": "Enterprise-class Node development framework",
|
|
179
179
|
"Sketch 工具集": "Sketch Tool set",
|
|
180
180
|
"互动图形解决方案": "Interactive solution",
|
|
181
|
-
"前端智能研发": "AI Coding Assistant"
|
|
181
|
+
"前端智能研发": "AI Coding Assistant",
|
|
182
|
+
"ai.placeholder.implement": "What would you like to visualize today?",
|
|
183
|
+
"ai.placeholder.solve": "What visualization problem would you like to solve today?",
|
|
184
|
+
"ai.mode.implement": "Develop",
|
|
185
|
+
"ai.mode.solve": "Q&A",
|
|
186
|
+
"ai.upload.tooltip": "Only supports csv,json,tsv,txt files. For performance and cost reasons, only the first few lines will be used as samples",
|
|
187
|
+
"ai.upload.data": "Upload Data",
|
|
188
|
+
"ai.upload.image": "Upload Image",
|
|
189
|
+
"ai.upload.analyzing": "Analyzing...",
|
|
190
|
+
"ai.upload.file.empty": "File is empty.",
|
|
191
|
+
"ai.upload.file.parse.error": "File content format error, unable to parse.",
|
|
192
|
+
"ai.upload.file.read.error": "Failed to read file.",
|
|
193
|
+
"ai.upload.file.type.error": "Unsupported file type. Please upload {types} files.",
|
|
194
|
+
"ai.upload.file.size.error": "File size cannot exceed {size}MB!",
|
|
195
|
+
"ai.upload.file.parse.type.error": "Unsupported file parsing type",
|
|
196
|
+
"ai.upload.file.summary.truncated": "... (Data summary truncated)",
|
|
197
|
+
"ai.upload.file.full.content": "User uploaded a data file, its complete content is as follows:\n\n{fileContent}",
|
|
198
|
+
"ai.upload.file.table.summary": "This is tabular data containing approximately {rowCount} rows and {columnCount} columns.\nColumn headers are: {header}\nFirst {maxLines} rows of sample data:\n{sampleRows}",
|
|
199
|
+
"ai.upload.file.json.array.summary": "This is a JSON array containing {dataLength} objects.\nKeys for each object are: {keys}\nFirst {maxLines} sample objects:\n{sampleData}",
|
|
200
|
+
"ai.upload.file.json.object.summary": "This is a JSON object. Its structure and partial data are as follows:",
|
|
201
|
+
"ai.msgbox.like": "Like",
|
|
202
|
+
"ai.msgbox.dislike": "Dislike",
|
|
203
|
+
"ai.msgbox.retry": "Try Again",
|
|
204
|
+
"ai.msgbox.copy": "Copy",
|
|
205
|
+
"ai.msgbox.start.new.chat": "Start New Chat",
|
|
206
|
+
"ai.msgbox.send.tip": "Please enter content before sending",
|
|
207
|
+
"ai.msgbox.error.response": "Sorry, I couldn't successfully process your request, please try again later",
|
|
208
|
+
"ai.recommend.title": "Featured Cases",
|
|
209
|
+
"ai.recommend.refresh": "Refresh",
|
|
210
|
+
"ai.recommend.card.caseName": "Case Name",
|
|
211
|
+
"ai.recommend.card.description": "Description",
|
|
212
|
+
"ai.markdown.copy": "Copy",
|
|
213
|
+
"ai.markdown.run": "Run this code snippet",
|
|
214
|
+
"ai.toolbar.assistant": "AI Assistant",
|
|
215
|
+
"ai.toolbar.restore": "Restore",
|
|
216
|
+
"ai.toolbar.execute": "Execute Code",
|
|
217
|
+
"ai.toolbar.open.codesandbox": "Open in CodeSandbox",
|
|
218
|
+
"ai.toolbar.open.stackblitz": "Open in StackBlitz",
|
|
219
|
+
"ai.toolbar.open.riddle": "Open in Riddle",
|
|
220
|
+
"ai.toolbar.html.code": "HTML Code",
|
|
221
|
+
"ai.conversations.expand": "Expand",
|
|
222
|
+
"ai.conversations.collapse": "Collapse",
|
|
223
|
+
"ai.conversations.new": "Start New Chat",
|
|
224
|
+
"ai.conversations.history": "History",
|
|
225
|
+
"ai.conversations.rename": "Rename",
|
|
226
|
+
"ai.conversations.pin": "Pin",
|
|
227
|
+
"ai.conversations.delete": "Delete",
|
|
228
|
+
"ai.conversations.edit.title": "Edit Conversation Name",
|
|
229
|
+
"ai.chooseLib.placeholder": "Choose Technology Stack",
|
|
230
|
+
"ai.search.try": "Try",
|
|
231
|
+
"ai.search.visualization": "Q&A",
|
|
232
|
+
"ai.assistant.editor.intro": "I am AntV AI Assistant. You can ask me questions at any time to:\n1. Interpret the code configuration of the current chart.\n2. Generate new code based on the current case through natural language dialogue to customize the chart.",
|
|
233
|
+
"ai.placeholder.whatis": "What is {title}?",
|
|
234
|
+
"header.ai.code": "AI Code Generation",
|
|
235
|
+
"header.china.mirror.title": "AntV series websites are deployed on gh-pages. If the access speed is poor, you can visit the domestic mirror site.",
|
|
236
|
+
"header.china.mirror.temp.close": "Close Temporarily",
|
|
237
|
+
"header.china.mirror.no.more": "Don't Remind Again",
|
|
238
|
+
"header.wx.qrcode.title": "Scan QR Code to Follow",
|
|
239
|
+
"feedback.page.helpful": "Was this page helpful?",
|
|
240
|
+
"feedback.page.easy.understand": "Easy to understand",
|
|
241
|
+
"feedback.page.solved.problem": "Solved my problem",
|
|
242
|
+
"feedback.page.other": "Other",
|
|
243
|
+
"feedback.page.missing.info": "Missing information I need",
|
|
244
|
+
"feedback.page.too.complex": "Too complicated/Too many steps",
|
|
245
|
+
"feedback.page.outdated": "Content is outdated",
|
|
246
|
+
"feedback.page.code.issue": "Sample/Code issue",
|
|
247
|
+
"feedback.page.reason.title": "🚀 What is the reason for your feedback?",
|
|
248
|
+
"feedback.page.issue.alert": "If something is broken or if you need a reply to a problem you've encountered, please ",
|
|
249
|
+
"feedback.page.issue.report": "open an issue instead",
|
|
250
|
+
"feedback.page.issue.alert.end": ". Otherwise, the team won't be able to answer back or ask for more information.",
|
|
251
|
+
"feedback.section.improve": "How can we improve",
|
|
252
|
+
"feedback.section.improve.end": "section? ",
|
|
253
|
+
"feedback.result.success": "Feedback Submitted",
|
|
254
|
+
"feedback.result.error": "Error, please try again later",
|
|
255
|
+
"feedback.result.thanks": "Thank you for your feedback!",
|
|
256
|
+
"feedback.result.github.issue": "Go head to GitHub issue if the problem persists.",
|
|
257
|
+
"feedback.result.problem.type": "What kind of problem are you facing?",
|
|
258
|
+
"feedback.result.reason": "🚀 What is the reason for your feedback?",
|
|
259
|
+
"feedback.result.easy.understand": "Easy to understand",
|
|
260
|
+
"feedback.result.solved.problem": "Resolved my problem",
|
|
261
|
+
"feedback.result.other": "Other",
|
|
262
|
+
"feedback.result.missing.info": "Missing the information I need",
|
|
263
|
+
"feedback.result.too.complex": "Too complicated / Too many steps",
|
|
264
|
+
"feedback.result.outdated": "Out of date",
|
|
265
|
+
"feedback.result.code.issue": "Sample / code issue",
|
|
266
|
+
"feedback.result.previous": "Previous",
|
|
267
|
+
"feedback.result.next": "Next",
|
|
268
|
+
"feedback.result.demo.error": "Demo code error, please check",
|
|
269
|
+
"feedback.result.reading.time": "Reading needs",
|
|
270
|
+
"feedback.result.minutes": "minutes",
|
|
271
|
+
"feedback.result.no.results": "No query result found"
|
|
182
272
|
}
|
package/dist/locales/zh.json
CHANGED
|
@@ -177,5 +177,95 @@
|
|
|
177
177
|
"企业级 Node 开发框架": "企业级 Node 开发框架",
|
|
178
178
|
"Sketch 工具集": "Sketch 工具集",
|
|
179
179
|
"互动图形解决方案": "互动图形解决方案",
|
|
180
|
-
"前端智能研发": "前端智能研发"
|
|
180
|
+
"前端智能研发": "前端智能研发",
|
|
181
|
+
"ai.placeholder.implement": "今天,你想可视化什么?",
|
|
182
|
+
"ai.placeholder.solve": "今天,你想解决什么可视化问题?",
|
|
183
|
+
"ai.mode.implement": "可视化研发",
|
|
184
|
+
"ai.mode.solve": "可视化答疑",
|
|
185
|
+
"ai.upload.tooltip": "仅支持csv,json,tsv,txt文件,为了性能和成本,只会使用文件的前几行作为样本",
|
|
186
|
+
"ai.upload.data": "上传数据",
|
|
187
|
+
"ai.upload.image": "上传图片",
|
|
188
|
+
"ai.upload.analyzing": "分析中...",
|
|
189
|
+
"ai.upload.file.empty": "文件为空。",
|
|
190
|
+
"ai.upload.file.parse.error": "文件内容格式错误,无法解析。",
|
|
191
|
+
"ai.upload.file.read.error": "读取文件失败。",
|
|
192
|
+
"ai.upload.file.type.error": "不支持的文件类型。请上传 {types} 文件。",
|
|
193
|
+
"ai.upload.file.size.error": "文件大小不能超过 {size}MB!",
|
|
194
|
+
"ai.upload.file.parse.type.error": "不支持的文件解析类型",
|
|
195
|
+
"ai.upload.file.summary.truncated": "... (数据摘要已截断)",
|
|
196
|
+
"ai.upload.file.full.content": "用户上传了一个数据文件,其完整内容如下:\n\n{fileContent}",
|
|
197
|
+
"ai.upload.file.table.summary": "这是一个包含约 {rowCount} 行和 {columnCount} 列的表格数据。\n列名(Header)是: {header}\n前{maxLines}行样本数据如下:\n{sampleRows}",
|
|
198
|
+
"ai.upload.file.json.array.summary": "这是一个包含 {dataLength} 个对象的JSON数组。\n每个对象的键(Keys)是: {keys}\n前{maxLines}个样本对象如下:\n{sampleData}",
|
|
199
|
+
"ai.upload.file.json.object.summary": "这是一个JSON对象。其结构和部分数据如下:",
|
|
200
|
+
"ai.msgbox.like": "点赞",
|
|
201
|
+
"ai.msgbox.dislike": "点踩",
|
|
202
|
+
"ai.msgbox.retry": "再来一次",
|
|
203
|
+
"ai.msgbox.copy": "复制",
|
|
204
|
+
"ai.msgbox.start.new.chat": "开始新对话",
|
|
205
|
+
"ai.msgbox.send.tip": "请输入内容后发送指令",
|
|
206
|
+
"ai.msgbox.error.response": "抱歉,我没能成功处理您的请求,请稍后再次提问",
|
|
207
|
+
"ai.recommend.title": "精选案例",
|
|
208
|
+
"ai.recommend.refresh": "换一批",
|
|
209
|
+
"ai.recommend.card.caseName": "案例名",
|
|
210
|
+
"ai.recommend.card.description": "描述信息",
|
|
211
|
+
"ai.markdown.copy": "复制",
|
|
212
|
+
"ai.markdown.run": "运行此代码片段",
|
|
213
|
+
"ai.toolbar.assistant": "AI 助手",
|
|
214
|
+
"ai.toolbar.restore": "还原",
|
|
215
|
+
"ai.toolbar.execute": "执行代码",
|
|
216
|
+
"ai.toolbar.open.codesandbox": "在 CodeSandbox 中打开",
|
|
217
|
+
"ai.toolbar.open.stackblitz": "在 StackBlitz 中打开",
|
|
218
|
+
"ai.toolbar.open.riddle": "在 Riddle 中打开",
|
|
219
|
+
"ai.toolbar.html.code": "HTML 代码",
|
|
220
|
+
"ai.conversations.expand": "展开",
|
|
221
|
+
"ai.conversations.collapse": "收起",
|
|
222
|
+
"ai.conversations.new": "开始新对话",
|
|
223
|
+
"ai.conversations.history": "历史对话",
|
|
224
|
+
"ai.conversations.rename": "重命名",
|
|
225
|
+
"ai.conversations.pin": "置顶",
|
|
226
|
+
"ai.conversations.delete": "删除",
|
|
227
|
+
"ai.conversations.edit.title": "编辑对话名称",
|
|
228
|
+
"ai.chooseLib.placeholder": "选择技术栈",
|
|
229
|
+
"ai.search.try": "试试",
|
|
230
|
+
"ai.search.visualization": "可视化答疑",
|
|
231
|
+
"ai.assistant.editor.intro": "我是AntV AI助手。您可以随时向我提问,让我为您:\n\n1、解读当前图表的代码配置。\n2、通过自然语言对话,基于当前案例生成新代码以定制图表。",
|
|
232
|
+
"ai.placeholder.whatis": "{title}是什么?",
|
|
233
|
+
"header.ai.code": "AI生码",
|
|
234
|
+
"header.china.mirror.title": "AntV 系列网站部署在 gh-pages 上,若访问速度不佳,可以前往国内镜像站点。",
|
|
235
|
+
"header.china.mirror.temp.close": "暂时关闭",
|
|
236
|
+
"header.china.mirror.no.more": "不再提醒",
|
|
237
|
+
"header.wx.qrcode.title": "微信扫一扫关注",
|
|
238
|
+
"feedback.page.helpful": "这个页面对你有帮助吗?",
|
|
239
|
+
"feedback.page.easy.understand": "容易理解",
|
|
240
|
+
"feedback.page.solved.problem": "解决了我的问题",
|
|
241
|
+
"feedback.page.other": "其它",
|
|
242
|
+
"feedback.page.missing.info": "缺少我需要的信息",
|
|
243
|
+
"feedback.page.too.complex": "过于复杂/步骤太多",
|
|
244
|
+
"feedback.page.outdated": "内容更新不及时",
|
|
245
|
+
"feedback.page.code.issue": "示例/代码有问题",
|
|
246
|
+
"feedback.page.reason.title": "🚀 留下你的真实感受",
|
|
247
|
+
"feedback.page.issue.alert": "如果遇到问题或发现某些功能无法正常工作,请通过",
|
|
248
|
+
"feedback.page.issue.report": "提交问题报告",
|
|
249
|
+
"feedback.page.issue.alert.end": "来反馈。否则,团队将无法提供进一步的答复或获取更多信息。",
|
|
250
|
+
"feedback.section.improve": "你认为",
|
|
251
|
+
"feedback.section.improve.end": "部分如何改进更好?",
|
|
252
|
+
"feedback.result.success": "谢谢你的反馈意见!",
|
|
253
|
+
"feedback.result.error": "报错了,请稍后再试",
|
|
254
|
+
"feedback.result.thanks": "感谢你的支持!",
|
|
255
|
+
"feedback.result.github.issue": "如果问题持续,请前往 GitHub 提交 issue。",
|
|
256
|
+
"feedback.result.problem.type": "你遇到的问题是什么?",
|
|
257
|
+
"feedback.result.reason": "🚀 留下你的真实感受",
|
|
258
|
+
"feedback.result.easy.understand": "容易理解",
|
|
259
|
+
"feedback.result.solved.problem": "有效解决了我的问题",
|
|
260
|
+
"feedback.result.other": "其它",
|
|
261
|
+
"feedback.result.missing.info": "缺少我需要的信息",
|
|
262
|
+
"feedback.result.too.complex": "过于复杂/步骤太多",
|
|
263
|
+
"feedback.result.outdated": "内容更新不及时",
|
|
264
|
+
"feedback.result.code.issue": "示例/代码有问题",
|
|
265
|
+
"feedback.result.previous": "上一篇",
|
|
266
|
+
"feedback.result.next": "下一篇",
|
|
267
|
+
"feedback.result.demo.error": "演示代码报错,请检查",
|
|
268
|
+
"feedback.result.reading.time": "阅读时间约",
|
|
269
|
+
"feedback.result.minutes": "分钟",
|
|
270
|
+
"feedback.result.no.results": "没有找到查询结果"
|
|
181
271
|
}
|
package/dist/model/AIChat.js
CHANGED
|
@@ -207,7 +207,7 @@ export var createPureNewSession = function createPureNewSession(title) {
|
|
|
207
207
|
export var createNewSession = function createNewSession(config) {
|
|
208
208
|
// todo 埋点
|
|
209
209
|
// 1. 创建一个新的会话
|
|
210
|
-
createPureNewSession();
|
|
210
|
+
createPureNewSession(config.promptText);
|
|
211
211
|
|
|
212
212
|
// 2. 创建临时消息并存入 store
|
|
213
213
|
AIChatStore.tempMessage = {
|
|
@@ -216,9 +216,11 @@ export var createNewSession = function createNewSession(config) {
|
|
|
216
216
|
content: config.promptText,
|
|
217
217
|
createdAt: Date.now(),
|
|
218
218
|
mode: config.mode,
|
|
219
|
-
lib: config.lib
|
|
219
|
+
lib: config.lib,
|
|
220
|
+
context: config.context
|
|
220
221
|
};
|
|
221
222
|
if (config.jump) {
|
|
222
|
-
|
|
223
|
+
var _config$lang;
|
|
224
|
+
history.push("/".concat((_config$lang = config.lang) !== null && _config$lang !== void 0 ? _config$lang : 'zh', "/ai-playground"));
|
|
223
225
|
}
|
|
224
226
|
};
|
|
@@ -13,6 +13,7 @@ import { useSnapshot } from 'valtio';
|
|
|
13
13
|
import { AIChatStore, handleDeleteSession, handlePinSession, handleRenameSession } from "../../../../model/AIChat";
|
|
14
14
|
import { history } from 'dumi';
|
|
15
15
|
import { useSetState } from "ahooks";
|
|
16
|
+
import { useIntl } from 'dumi';
|
|
16
17
|
export var ConversationsMenu = function ConversationsMenu() {
|
|
17
18
|
var _useSetState = useSetState({
|
|
18
19
|
open: false,
|
|
@@ -33,23 +34,33 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
33
34
|
var toggleCollapsed = function toggleCollapsed() {
|
|
34
35
|
setCollapsed(!collapsed);
|
|
35
36
|
};
|
|
37
|
+
var _useIntl = useIntl(),
|
|
38
|
+
formatMessage = _useIntl.formatMessage;
|
|
36
39
|
var items = [{
|
|
37
40
|
key: 'fold',
|
|
38
41
|
extra: !collapsed ? /*#__PURE__*/React.createElement(MenuFoldOutlined, null) : null,
|
|
39
42
|
onClick: toggleCollapsed,
|
|
40
43
|
label: null,
|
|
41
44
|
icon: !collapsed ? null : /*#__PURE__*/React.createElement(MenuUnfoldOutlined, null),
|
|
42
|
-
title:
|
|
45
|
+
title: collapsed ? formatMessage({
|
|
46
|
+
id: 'ai.conversations.expand'
|
|
47
|
+
}) : formatMessage({
|
|
48
|
+
id: 'ai.conversations.collapse'
|
|
49
|
+
})
|
|
43
50
|
}, {
|
|
44
51
|
key: 'new',
|
|
45
52
|
icon: /*#__PURE__*/React.createElement(PlusSquareOutlined, null),
|
|
46
|
-
label:
|
|
53
|
+
label: formatMessage({
|
|
54
|
+
id: 'ai.conversations.new'
|
|
55
|
+
}),
|
|
47
56
|
onClick: function onClick() {
|
|
48
57
|
return history.push('/');
|
|
49
58
|
}
|
|
50
59
|
}, {
|
|
51
60
|
key: 'history',
|
|
52
|
-
label:
|
|
61
|
+
label: formatMessage({
|
|
62
|
+
id: 'ai.conversations.history'
|
|
63
|
+
}),
|
|
53
64
|
icon: /*#__PURE__*/React.createElement(HistoryOutlined, null),
|
|
54
65
|
children: snap.sessions.map(function (session) {
|
|
55
66
|
return {
|
|
@@ -62,7 +73,9 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
62
73
|
menu: {
|
|
63
74
|
items: [{
|
|
64
75
|
key: 'edit',
|
|
65
|
-
label:
|
|
76
|
+
label: formatMessage({
|
|
77
|
+
id: 'ai.conversations.rename'
|
|
78
|
+
}),
|
|
66
79
|
icon: /*#__PURE__*/React.createElement(EditOutlined, null),
|
|
67
80
|
onClick: function onClick(_ref) {
|
|
68
81
|
var domEvent = _ref.domEvent;
|
|
@@ -75,7 +88,9 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
75
88
|
}
|
|
76
89
|
}, {
|
|
77
90
|
key: 'top',
|
|
78
|
-
label:
|
|
91
|
+
label: formatMessage({
|
|
92
|
+
id: 'ai.conversations.pin'
|
|
93
|
+
}),
|
|
79
94
|
icon: /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null),
|
|
80
95
|
onClick: function onClick(_ref2) {
|
|
81
96
|
var domEvent = _ref2.domEvent;
|
|
@@ -84,7 +99,9 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
84
99
|
}
|
|
85
100
|
}, {
|
|
86
101
|
key: 'delete',
|
|
87
|
-
label:
|
|
102
|
+
label: formatMessage({
|
|
103
|
+
id: 'ai.conversations.delete'
|
|
104
|
+
}),
|
|
88
105
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
|
89
106
|
onClick: function onClick(_ref3) {
|
|
90
107
|
var domEvent = _ref3.domEvent;
|
|
@@ -118,7 +135,9 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
118
135
|
return handleSelectSession(key);
|
|
119
136
|
}
|
|
120
137
|
}), /*#__PURE__*/React.createElement(Modal, {
|
|
121
|
-
title:
|
|
138
|
+
title: formatMessage({
|
|
139
|
+
id: 'ai.conversations.edit.title'
|
|
140
|
+
}),
|
|
122
141
|
open: state.open,
|
|
123
142
|
centered: true,
|
|
124
143
|
maskClosable: false,
|
|
@@ -12,6 +12,7 @@ import { useCopyToClipboard } from "react-use";
|
|
|
12
12
|
import { CheckOutlined, CopyOutlined, PlaySquareOutlined } from "@ant-design/icons";
|
|
13
13
|
import { Space, Tooltip } from "antd";
|
|
14
14
|
import styles from "./MarkdownCodeBlock.module.less";
|
|
15
|
+
import { useIntl } from 'dumi';
|
|
15
16
|
|
|
16
17
|
// 定义 props 类型,它将接收 react-markdown 传递的所有属性
|
|
17
18
|
|
|
@@ -47,6 +48,7 @@ export var MarkdownCodeBlock = function MarkdownCodeBlock(_ref) {
|
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
// 6. 返回最终的 JSX 结构
|
|
51
|
+
var intl = useIntl();
|
|
50
52
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
53
|
style: {
|
|
52
54
|
position: 'relative',
|
|
@@ -55,19 +57,27 @@ export var MarkdownCodeBlock = function MarkdownCodeBlock(_ref) {
|
|
|
55
57
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
56
58
|
className: styles.button
|
|
57
59
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
58
|
-
title:
|
|
60
|
+
title: intl.formatMessage({
|
|
61
|
+
id: 'ai.markdown.copy'
|
|
62
|
+
})
|
|
59
63
|
}, /*#__PURE__*/React.createElement("button", {
|
|
60
64
|
type: "button",
|
|
61
65
|
onClick: function onClick() {
|
|
62
66
|
return copyToClipboard(codeString);
|
|
63
67
|
},
|
|
64
|
-
title:
|
|
68
|
+
title: intl.formatMessage({
|
|
69
|
+
id: 'ai.markdown.copy'
|
|
70
|
+
})
|
|
65
71
|
}, copyState.value === codeString ? /*#__PURE__*/React.createElement(CheckOutlined, null) : /*#__PURE__*/React.createElement(CopyOutlined, null))), showRunButton && /*#__PURE__*/React.createElement(Tooltip, {
|
|
66
|
-
title:
|
|
72
|
+
title: intl.formatMessage({
|
|
73
|
+
id: 'ai.markdown.run'
|
|
74
|
+
})
|
|
67
75
|
}, /*#__PURE__*/React.createElement("button", {
|
|
68
76
|
type: "button",
|
|
69
77
|
onClick: handleRunCode,
|
|
70
|
-
title:
|
|
78
|
+
title: intl.formatMessage({
|
|
79
|
+
id: 'ai.markdown.run'
|
|
80
|
+
})
|
|
71
81
|
}, /*#__PURE__*/React.createElement(PlaySquareOutlined, null)))), /*#__PURE__*/React.createElement(SyntaxHighlighter, {
|
|
72
82
|
style: a11yLight,
|
|
73
83
|
language: language,
|
|
@@ -11,7 +11,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { CheckOutlined, CopyOutlined, DislikeOutlined, LikeOutlined, PlusSquareOutlined, SyncOutlined } from '@ant-design/icons';
|
|
12
12
|
import { Bubble } from '@ant-design/x';
|
|
13
13
|
import { Button, Flex, Space, Tooltip } from 'antd';
|
|
14
|
-
import { history, useSiteData } from 'dumi';
|
|
14
|
+
import { history, useSiteData, useIntl } from 'dumi';
|
|
15
15
|
import { findLast } from 'lodash-es';
|
|
16
16
|
import React, { useEffect, useState } from 'react';
|
|
17
17
|
import { useCopyToClipboard } from 'react-use';
|
|
@@ -53,6 +53,8 @@ function MsgBox(props) {
|
|
|
53
53
|
title = props.title;
|
|
54
54
|
var _useSiteData = useSiteData(),
|
|
55
55
|
themeConfig = _useSiteData.themeConfig;
|
|
56
|
+
var _useIntl = useIntl(),
|
|
57
|
+
formatMessage = _useIntl.formatMessage;
|
|
56
58
|
var _useState = useState(!themeConfig.isAntVSite ? themeConfig.title : undefined),
|
|
57
59
|
_useState2 = _slicedToArray(_useState, 2),
|
|
58
60
|
lib = _useState2[0],
|
|
@@ -78,6 +80,10 @@ function MsgBox(props) {
|
|
|
78
80
|
var latestUserMessage = findLast((_derivedSnap$activeSe = derivedSnap.activeSession) === null || _derivedSnap$activeSe === void 0 ? void 0 : _derivedSnap$activeSe.messages, function (msg) {
|
|
79
81
|
return msg.role === 'user';
|
|
80
82
|
});
|
|
83
|
+
var _useState9 = useState(''),
|
|
84
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
85
|
+
fileSummary = _useState10[0],
|
|
86
|
+
setFileSummary = _useState10[1];
|
|
81
87
|
var streamingText = useStreamingText({
|
|
82
88
|
url: 'https://webgw-pre.alipay.com/visqaservice/external/chat',
|
|
83
89
|
method: 'POST',
|
|
@@ -133,7 +139,9 @@ function MsgBox(props) {
|
|
|
133
139
|
(_derivedState$activeS2 = derivedState.activeSession) === null || _derivedState$activeS2 === void 0 || (_derivedState$activeS2 = _derivedState$activeS2.messages) === null || _derivedState$activeS2 === void 0 || _derivedState$activeS2.push({
|
|
134
140
|
id: crypto.randomUUID(),
|
|
135
141
|
role: 'assistant',
|
|
136
|
-
content:
|
|
142
|
+
content: formatMessage({
|
|
143
|
+
id: 'ai.msgbox.error.response'
|
|
144
|
+
}),
|
|
137
145
|
createdAt: Date.now()
|
|
138
146
|
// mode,
|
|
139
147
|
// lib,
|
|
@@ -153,6 +161,7 @@ function MsgBox(props) {
|
|
|
153
161
|
role: 'user',
|
|
154
162
|
content: promptText,
|
|
155
163
|
createdAt: Date.now(),
|
|
164
|
+
context: fileSummary,
|
|
156
165
|
lib: lib
|
|
157
166
|
});
|
|
158
167
|
// **关键:开启 trigger,开始请求**
|
|
@@ -183,7 +192,7 @@ function MsgBox(props) {
|
|
|
183
192
|
setIsStreaming(false);
|
|
184
193
|
}
|
|
185
194
|
}, [snap.activeSessionId]);
|
|
186
|
-
var showMessages = [].concat(_toConsumableArray(messages), _toConsumableArray((_derivedSnap$activeSe3 = derivedSnap.activeSession) === null || _derivedSnap$activeSe3 === void 0 ? void 0 : _derivedSnap$activeSe3.messages));
|
|
195
|
+
var showMessages = [].concat(_toConsumableArray(messages), _toConsumableArray(((_derivedSnap$activeSe3 = derivedSnap.activeSession) === null || _derivedSnap$activeSe3 === void 0 ? void 0 : _derivedSnap$activeSe3.messages) || []));
|
|
187
196
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex, {
|
|
188
197
|
gap: "middle",
|
|
189
198
|
vertical: true,
|
|
@@ -198,21 +207,27 @@ function MsgBox(props) {
|
|
|
198
207
|
footer: msg.role === 'assistant' && index > 0 ? /*#__PURE__*/React.createElement(Space, {
|
|
199
208
|
size: "small"
|
|
200
209
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
201
|
-
title:
|
|
210
|
+
title: formatMessage({
|
|
211
|
+
id: 'ai.msgbox.like'
|
|
212
|
+
})
|
|
202
213
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
203
214
|
color: "default",
|
|
204
215
|
variant: "text",
|
|
205
216
|
size: "small",
|
|
206
217
|
icon: /*#__PURE__*/React.createElement(LikeOutlined, null)
|
|
207
218
|
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
208
|
-
title:
|
|
219
|
+
title: formatMessage({
|
|
220
|
+
id: 'ai.msgbox.dislike'
|
|
221
|
+
})
|
|
209
222
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
210
223
|
color: "default",
|
|
211
224
|
variant: "text",
|
|
212
225
|
size: "small",
|
|
213
226
|
icon: /*#__PURE__*/React.createElement(DislikeOutlined, null)
|
|
214
227
|
})), index === showMessages.length - 1 && /*#__PURE__*/React.createElement(Tooltip, {
|
|
215
|
-
title:
|
|
228
|
+
title: formatMessage({
|
|
229
|
+
id: 'ai.msgbox.retry'
|
|
230
|
+
})
|
|
216
231
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
217
232
|
onClick: function onClick() {
|
|
218
233
|
derivedState.activeSession.messages.pop();
|
|
@@ -223,7 +238,9 @@ function MsgBox(props) {
|
|
|
223
238
|
size: "small",
|
|
224
239
|
icon: /*#__PURE__*/React.createElement(SyncOutlined, null)
|
|
225
240
|
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
226
|
-
title:
|
|
241
|
+
title: formatMessage({
|
|
242
|
+
id: 'ai.msgbox.copy'
|
|
243
|
+
})
|
|
227
244
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
228
245
|
color: "default",
|
|
229
246
|
variant: "text",
|
|
@@ -247,7 +264,9 @@ function MsgBox(props) {
|
|
|
247
264
|
return history.push('/');
|
|
248
265
|
},
|
|
249
266
|
className: styles.newButton
|
|
250
|
-
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusSquareOutlined, null),
|
|
267
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusSquareOutlined, null), formatMessage({
|
|
268
|
+
id: 'ai.msgbox.start.new.chat'
|
|
269
|
+
})))), /*#__PURE__*/React.createElement(PromptTextarea, {
|
|
251
270
|
size: "compact",
|
|
252
271
|
mode: "implement",
|
|
253
272
|
value: promptText,
|
|
@@ -263,7 +282,8 @@ function MsgBox(props) {
|
|
|
263
282
|
},
|
|
264
283
|
onConfirm: handleSubmit,
|
|
265
284
|
lib: lib,
|
|
266
|
-
onLibChange: setLib
|
|
285
|
+
onLibChange: setLib,
|
|
286
|
+
onDataSummaryChange: setFileSummary
|
|
267
287
|
})));
|
|
268
288
|
}
|
|
269
289
|
export default MsgBox;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
1
|
import React from 'react';
|
|
6
2
|
import styles from "./index.module.less";
|
|
7
3
|
import { ConversationsMenu } from "../ConversationsMenu";
|
|
8
4
|
import { AIChatStore } from "../../../../model/AIChat";
|
|
9
|
-
import { useSnapshot } from
|
|
10
|
-
import classnames from
|
|
5
|
+
import { useSnapshot } from 'valtio';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import SplitPane from 'react-split-pane';
|
|
11
8
|
function SessionLayout(props) {
|
|
12
9
|
var children = props.children;
|
|
13
10
|
var snap = useSnapshot(AIChatStore);
|
|
@@ -16,10 +13,21 @@ function SessionLayout(props) {
|
|
|
16
13
|
}
|
|
17
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
15
|
className: styles.container
|
|
19
|
-
}, /*#__PURE__*/React.createElement(ConversationsMenu, null),
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
}, /*#__PURE__*/React.createElement(ConversationsMenu, null),
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
snap.codeBlock ? /*#__PURE__*/React.createElement(SplitPane, {
|
|
19
|
+
split: "vertical",
|
|
20
|
+
defaultSize: "50vw",
|
|
21
|
+
primary: "second",
|
|
22
|
+
style: {
|
|
23
|
+
position: "unset"
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: classnames(styles.msgBox)
|
|
27
|
+
}, children[0]), /*#__PURE__*/React.createElement("div", {
|
|
22
28
|
className: styles.taskBox
|
|
23
|
-
}, children[1]))
|
|
29
|
+
}, children[1])) : /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: classnames(styles.msgBox, styles.msgBoxFull)
|
|
31
|
+
}, children[0]));
|
|
24
32
|
}
|
|
25
33
|
export { SessionLayout };
|