inl-ui 0.1.13 → 0.1.15

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.
@@ -1045,30 +1045,4 @@ declare const _default: vue.DefineComponent<{
1045
1045
  commentHeight: string;
1046
1046
  }, {}>;
1047
1047
 
1048
- /**
1049
- * 大语言模型组件 - 对话框
1050
- */
1051
- declare const LlmChatBox: vue.DefineComponent<{
1052
- theme: {
1053
- type: StringConstructor;
1054
- default: string;
1055
- };
1056
- withSpeech: {
1057
- type: BooleanConstructor;
1058
- default: boolean;
1059
- };
1060
- }, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
1061
- theme: {
1062
- type: StringConstructor;
1063
- default: string;
1064
- };
1065
- withSpeech: {
1066
- type: BooleanConstructor;
1067
- default: boolean;
1068
- };
1069
- }>>, {
1070
- theme: string;
1071
- withSpeech: boolean;
1072
- }, {}>;
1073
-
1074
- export { _default$b as AlarmVideo, _default$d as ChangeThemeSelect, _default$e as ChildLayout, _default$j as Demo, _default$1 as FontSelect, _default$6 as HeaderMenu, _default$i as IconFont, _default$5 as IconSelect, ImportModal, _default$h as Layout, _default$f as LayoutTable, LlmChatBox, _default$g as Login, _default$2 as ParamManager, ParamManagerV2, _default$3 as PeopleSelect, _default$c as PollingPlay, _default$4 as QueryFormContainer, _default as SszComment, _default$8 as VideoBox, _default$7 as VideoBoxV2, _default$9 as VideoPlayerV1, _default$a as VideoPlayerV2, getDetailContainer, getMenuDetail };
1048
+ export { _default$b as AlarmVideo, _default$d as ChangeThemeSelect, _default$e as ChildLayout, _default$j as Demo, _default$1 as FontSelect, _default$6 as HeaderMenu, _default$i as IconFont, _default$5 as IconSelect, ImportModal, _default$h as Layout, _default$f as LayoutTable, _default$g as Login, _default$2 as ParamManager, ParamManagerV2, _default$3 as PeopleSelect, _default$c as PollingPlay, _default$4 as QueryFormContainer, _default as SszComment, _default$8 as VideoBox, _default$7 as VideoBoxV2, _default$9 as VideoPlayerV1, _default$a as VideoPlayerV2, getDetailContainer, getMenuDetail };
@@ -3,14 +3,13 @@ import { createFromIconfontCN, SearchOutlined, DownOutlined, PoweroffOutlined, M
3
3
  import { useRoute, useRouter } from 'vue-router';
4
4
  import { useMounted, resolveRef, useThrottleFn, useVModel, useMagicKeys, whenever, watchArray, useEventListener, useSessionStorage, useFullscreen, useLocalStorage, useToggle, useElementBounding, useMemory, useWindowSize, useClipboard, useBreakpoints, breakpointsAntDesign } from '@vueuse/core';
5
5
  import axios from 'axios';
6
- import { message, Menu, MenuItem, Input as Input$1, Badge, Avatar as Avatar$1, MenuDivider, Modal, SubMenu, Dropdown, Tooltip, Select, Layout as Layout$1, LayoutHeader, LayoutSider, LayoutContent, Form, Row, Col, FormItem, SelectOption, Switch, InputNumber } from 'ant-design-vue';
6
+ import { message, Menu, MenuItem, Input, Badge, Avatar, MenuDivider, Modal, SubMenu, Dropdown, Tooltip, Select, Layout as Layout$1, LayoutHeader, LayoutSider, LayoutContent, Form, Row, Col, FormItem, SelectOption, Switch, InputNumber } from 'ant-design-vue';
7
7
  import _, { isPlainObject, omit, differenceBy, isObject as isObject$1 } from 'lodash';
8
8
  import dayjs from 'dayjs';
9
9
  import { loadMicroApp } from 'qiankun';
10
10
  import 'vite-plugin-qiankun';
11
11
  import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
12
12
  import { XPopup, CommentBlock, setAxiosOption } from '@sszj-temp/mobile';
13
- import { marked } from 'marked';
14
13
 
15
14
  const config = {
16
15
  prefix: "inl",
@@ -360,7 +359,7 @@ const Header$1 = defineComponent({
360
359
  }, null)
361
360
  }))) ? _slot : {
362
361
  default: () => [_slot]
363
- }), props.withSearch && createVNode(Input$1, {
362
+ }), props.withSearch && createVNode(Input, {
364
363
  "class": "search",
365
364
  "placeholder": "\u641C\u7D22",
366
365
  "allowClear": true,
@@ -380,7 +379,7 @@ const Header$1 = defineComponent({
380
379
  "offset": [-10, 5],
381
380
  "dot": !!props.messageCount
382
381
  }, {
383
- default: () => [createVNode(Avatar$1, {
382
+ default: () => [createVNode(Avatar, {
384
383
  "class": "avatar",
385
384
  "src": props.userInfo?.photo ?? "/micro-assets/platform_app/avatar.png"
386
385
  }, null)]
@@ -7021,7 +7020,7 @@ const ChildHeader = defineComponent({
7021
7020
  }, {
7022
7021
  default: () => [createVNode("div", {
7023
7022
  "class": "user-info"
7024
- }, [createVNode(Avatar$1, {
7023
+ }, [createVNode(Avatar, {
7025
7024
  "class": "avatar",
7026
7025
  "src": "/micro-assets/inl/logo/logo_avatar.jpg"
7027
7026
  }, null), createVNode("a", {
@@ -9726,7 +9725,7 @@ const ProFormItem = defineComponent({
9726
9725
  Filed = Select;
9727
9726
  break;
9728
9727
  default:
9729
- Filed = Input$1;
9728
+ Filed = Input;
9730
9729
  break;
9731
9730
  }
9732
9731
  const rules = computed(() => {
@@ -10997,6 +10996,12 @@ const getMenuDetail = () => defineComponent({
10997
10996
  });
10998
10997
 
10999
10998
  const fonts = [{
10999
+ label: "\u9ED8\u8BA4",
11000
+ value: ""
11001
+ }, {
11002
+ label: "Arial",
11003
+ value: "Arial"
11004
+ }, {
11000
11005
  label: "\u5FAE\u8F6F\u96C5\u9ED1",
11001
11006
  value: "Microsoft YaHei"
11002
11007
  }, {
@@ -11222,566 +11227,4 @@ const SszComment = defineComponent({
11222
11227
  });
11223
11228
  var index = installComponent(SszComment, "ssz-comment");
11224
11229
 
11225
- function formatDataString(str) {
11226
- const lines = str.split("\n");
11227
- const result = lines.filter(line => !!line.trim()).map(line => {
11228
- const data = JSON.parse(line.replace(/^data: /, ""));
11229
- return data.text;
11230
- }).filter(line => line !== void 0).join("");
11231
- return result;
11232
- }
11233
- function request(question, streamCallback, doneCallback) {
11234
- const controller = new AbortController();
11235
- const signal = controller.signal;
11236
- fetch("/mt_cpp_gpt/chat", {
11237
- signal,
11238
- method: "POST",
11239
- headers: {
11240
- "Content-Type": "application/json"
11241
- },
11242
- body: JSON.stringify({
11243
- query: question,
11244
- conversation_id: ""
11245
- })
11246
- }).then(res => {
11247
- const stream = res.body;
11248
- const decoder = new TextDecoder();
11249
- const reader = stream.getReader();
11250
- let result = "";
11251
- function processText() {
11252
- return reader.read().then(({
11253
- done,
11254
- value
11255
- }) => {
11256
- if (done) {
11257
- doneCallback();
11258
- return;
11259
- }
11260
- try {
11261
- const dataString = decoder.decode(value, {
11262
- stream: true
11263
- });
11264
- const str = formatDataString(dataString);
11265
- result += str;
11266
- streamCallback(result);
11267
- } catch (e) {}
11268
- return processText();
11269
- }).catch(() => {
11270
- doneCallback();
11271
- });
11272
- }
11273
- return processText();
11274
- }).catch(() => {
11275
- doneCallback();
11276
- });
11277
- return function stop() {
11278
- controller.abort();
11279
- };
11280
- }
11281
- function useQA() {
11282
- const context = ref([]);
11283
- const answerLoading = ref(false);
11284
- const answer = ref("");
11285
- let abort = null;
11286
- setTimeout(() => {
11287
- const questionItem = {
11288
- type: "answer",
11289
- content: "",
11290
- id: /* @__PURE__ */new Date().getTime(),
11291
- timestamp: /* @__PURE__ */new Date().getTime(),
11292
- answers: [{
11293
- content: "\u4F60\u597D\uFF0C\u6211\u662F\u4F60\u7684\u5DE5\u4F5C\u4F19\u4F34 \u7F8E\u5C0F\u817E! \u6211\u53EF\u4EE5\u8F85\u52A9\u4F60\u5FEB\u901F\u83B7\u53D6\u4FE1\u606F\uFF0C\u76D1\u63A7\u3001\u67E5\u770B\u751F\u4EA7\u6307\u6807\uFF0C\u56DE\u7B54\u60A8\u7684\u9009\u7164\u4E13\u4E1A\u95EE\u9898\uFF0C\u5FEB\u8BD5\u8BD5\u4E0B\u9762\u5BF9\u8BDD\u5427\u3002",
11294
- timestamp: /* @__PURE__ */new Date().getTime(),
11295
- hideOperates: true,
11296
- id: /* @__PURE__ */new Date().getTime()
11297
- }]
11298
- };
11299
- context.value.push(questionItem);
11300
- }, 1e3);
11301
- function sendQuestion(question, questionId) {
11302
- if (answerLoading.value) return;
11303
- answerLoading.value = true;
11304
- let questionItem = context.value.find(item => item.id === questionId);
11305
- question = questionItem?.content || question;
11306
- if (!questionId) {
11307
- questionItem = {
11308
- id: /* @__PURE__ */new Date().getTime(),
11309
- timestamp: /* @__PURE__ */new Date().getTime(),
11310
- content: question,
11311
- answers: []
11312
- };
11313
- context.value.push(questionItem);
11314
- }
11315
- const answerItem = ref({
11316
- content: "\u6B63\u5728\u601D\u8003\u4E2D...",
11317
- timestamp: /* @__PURE__ */new Date().getTime(),
11318
- parentId: questionItem.id,
11319
- id: /* @__PURE__ */new Date().getTime()
11320
- });
11321
- questionItem.answers.push(answerItem.value);
11322
- abort = request(question, data => {
11323
- answer.value = data;
11324
- answerItem.value.content = data;
11325
- }, () => {
11326
- answerLoading.value = false;
11327
- answerItem.value.loadEnd = true;
11328
- abort = null;
11329
- });
11330
- }
11331
- function abortRequest() {
11332
- if (abort) {
11333
- abort();
11334
- abort = null;
11335
- }
11336
- }
11337
- return {
11338
- context,
11339
- answerLoading,
11340
- answer,
11341
- sendQuestion,
11342
- abortRequest
11343
- };
11344
- }
11345
-
11346
- const Input = defineComponent({
11347
- emits: ["send"],
11348
- setup(props, {
11349
- emit,
11350
- expose
11351
- }) {
11352
- const abortRequest = inject("abortRequest");
11353
- const loading = inject("answerLoading");
11354
- const value = ref("");
11355
- const isFocus = ref(false);
11356
- const send = () => {
11357
- if (loading.value) return;
11358
- if (value.value.length === 0) {
11359
- message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
11360
- return;
11361
- }
11362
- emit("send", value.value);
11363
- value.value = "";
11364
- };
11365
- const handleAbord = () => {
11366
- abortRequest();
11367
- };
11368
- const handleMicClick = () => {
11369
- message.info("\u6682\u4E0D\u652F\u6301\u8BED\u97F3\u8F93\u5165");
11370
- };
11371
- const clear = () => value.value = "";
11372
- expose({
11373
- clear
11374
- });
11375
- return () => createVNode("div", {
11376
- "class": ["chat-box-input", {
11377
- focus: isFocus.value
11378
- }]
11379
- }, [createVNode("img", {
11380
- "class": "img img-mic",
11381
- "src": "/micro-assets/largeLanguageModel/mic.png",
11382
- "alt": "",
11383
- "onClick": handleMicClick
11384
- }, null), createVNode(resolveComponent("a-input"), {
11385
- "value": value.value,
11386
- "onUpdate:value": $event => value.value = $event,
11387
- "bordered": false,
11388
- "placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
11389
- "onFocus": () => isFocus.value = true,
11390
- "onBlur": () => isFocus.value = false,
11391
- "onPressEnter": send
11392
- }, null), loading.value ? createVNode("img", {
11393
- "class": "btn-abort",
11394
- "title": "\u4E2D\u6B62\u56DE\u7B54",
11395
- "src": "/micro-assets/largeLanguageModel/btn-abort.png",
11396
- "onClick": handleAbord
11397
- }, null) : createVNode("img", {
11398
- "class": "img img-send",
11399
- "src": "/micro-assets/largeLanguageModel/send.png",
11400
- "onClick": send
11401
- }, null)]);
11402
- }
11403
- });
11404
-
11405
- const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
11406
- const Bottom = defineComponent({
11407
- emits: ["send"],
11408
- setup(props, {
11409
- emit
11410
- }) {
11411
- const inputRef = ref();
11412
- const handleSend = msg => {
11413
- inputRef.value.clear();
11414
- emit("send", msg);
11415
- };
11416
- return () => {
11417
- tips.map(tip => createVNode("div", {
11418
- "class": "tip",
11419
- "onClick": () => handleSend(tip)
11420
- }, [tip]));
11421
- return createVNode("div", {
11422
- "class": "bottom"
11423
- }, [createVNode(Input, {
11424
- "ref": inputRef,
11425
- "onSend": handleSend
11426
- }, null), createVNode("div", {
11427
- "class": "exemption"
11428
- }, ["\u5185\u5BB9\u7531\u7F8E\u817E\u5927\u6A21\u578B\u751F\u6210\uFF0C\u4EC5\u4F5C\u4E3A\u53C2\u8003"])]);
11429
- };
11430
- }
11431
- });
11432
-
11433
- const Avatar = defineComponent({
11434
- props: {
11435
- avatar: {
11436
- type: String,
11437
- required: true
11438
- },
11439
- name: {
11440
- type: String,
11441
- required: true
11442
- },
11443
- reverse: Boolean
11444
- },
11445
- setup(props, {
11446
- emit
11447
- }) {
11448
- return () => createVNode("div", {
11449
- "class": ["chat-avatar", {
11450
- "chat-avatar-reverse": props.reverse
11451
- }]
11452
- }, [createVNode(resolveComponent("a-avatar"), {
11453
- "class": "avatar",
11454
- "alt": "\u5934\u50CF",
11455
- "src": props.avatar
11456
- }, null), createVNode("div", {
11457
- "class": "chat-avatar-name"
11458
- }, [props.name])]);
11459
- }
11460
- });
11461
-
11462
- const QuestionBubble = defineComponent({
11463
- props: {
11464
- content: {
11465
- type: String,
11466
- default: ""
11467
- }
11468
- },
11469
- setup(props) {
11470
- const userinfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
11471
- const avatar = userinfo.photo || "/micro-assets/platform_app/avatar.png";
11472
- const name = userinfo.employeeName || userinfo.userName || "\u7528\u6237";
11473
- return () => createVNode("div", {
11474
- "class": "question-bubble chat-bubble"
11475
- }, [createVNode(Avatar, {
11476
- "reverse": true,
11477
- "avatar": avatar,
11478
- "name": name
11479
- }, null), createVNode("div", {
11480
- "class": "bubble question"
11481
- }, [props.content]), createVNode("div", {
11482
- "class": "operates"
11483
- }, null)]);
11484
- }
11485
- });
11486
-
11487
- const commonStyle = `
11488
- :host > p {
11489
- margin: 0;
11490
- }
11491
- :host {
11492
- font-size: 14px;
11493
- }
11494
- `;
11495
- const styleDark = `
11496
- <style>
11497
- ${commonStyle}
11498
-
11499
- * {
11500
- color: #fff;
11501
- }
11502
- strong {
11503
- color: #f3c142;
11504
- }
11505
- </style>
11506
- `;
11507
- const styleLight = `
11508
- <style>
11509
- ${commonStyle}
11510
-
11511
- * {
11512
- color: #20242B;
11513
- }
11514
- strong {
11515
- color: #4b7ff7;
11516
- }
11517
- </style>
11518
- `;
11519
-
11520
- const suggestionList = ["\u7F8E\u5C0F\u817E\u80FD\u5E2E\u6211\u505A\u4EC0\u4E48\uFF1F", "\u8FD1\u4E00\u4E2A\u6708\u7684\u4ECB\u8017\u60C5\u51B5\u5982\u4F55\uFF1F", "\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B\uFF1F\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B"];
11521
- const AnswerBubble = defineComponent({
11522
- emits: ["send", "render", "delete", "regenerate"],
11523
- props: {
11524
- content: {
11525
- type: Array,
11526
- default: () => []
11527
- }
11528
- },
11529
- setup(props, {
11530
- emit
11531
- }) {
11532
- const chatTheme = inject("chat-theme");
11533
- const {
11534
- copy
11535
- } = useClipboard({
11536
- legacy: true
11537
- });
11538
- const bubbleRef = ref();
11539
- const activeAnswerIndex = ref(0);
11540
- const activeAnswer = computed(() => props.content[activeAnswerIndex.value]);
11541
- let shadowRoot;
11542
- const trasformMd = mdString => {
11543
- return marked(mdString);
11544
- };
11545
- onMounted(() => {
11546
- shadowRoot = bubbleRef.value.attachShadow({
11547
- mode: "open"
11548
- });
11549
- renderText();
11550
- });
11551
- const renderText = () => {
11552
- if (!shadowRoot) return;
11553
- nextTick(() => {
11554
- emit("render", activeAnswer.value.content);
11555
- });
11556
- const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
11557
- const html = `
11558
- ${trasformMd(activeAnswer.value.content)}
11559
-
11560
- ${themeStyle}
11561
- `;
11562
- shadowRoot.innerHTML = html;
11563
- };
11564
- watch([activeAnswer, activeAnswerIndex], renderText, {
11565
- deep: true
11566
- });
11567
- const switchAnswer = step => {
11568
- activeAnswerIndex.value += step;
11569
- };
11570
- const operateList = reactive([{
11571
- title: "\u590D\u5236",
11572
- key: "copy",
11573
- isActive: false
11574
- }, {
11575
- title: "\u6709\u7528",
11576
- key: "like",
11577
- isActive: computed(() => activeAnswer.value.isLike)
11578
- }, {
11579
- title: "\u65E0\u7528",
11580
- key: "dislike",
11581
- isActive: computed(() => activeAnswer.value.isDislike)
11582
- }, {
11583
- title: "\u8BC4\u8BBA",
11584
- key: "comment",
11585
- isActive: false
11586
- }, {
11587
- title: "\u91CD\u65B0\u751F\u6210",
11588
- key: "regenerate",
11589
- isActive: false
11590
- }, {
11591
- ttile: "\u5220\u9664",
11592
- key: "delete",
11593
- isActive: false
11594
- }]);
11595
- const handleOperate = key => {
11596
- switch (key) {
11597
- case "like":
11598
- if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
11599
- activeAnswer.value.isLike = !activeAnswer.value.isLike;
11600
- }
11601
- break;
11602
- case "dislike":
11603
- if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
11604
- activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
11605
- }
11606
- break;
11607
- case "copy":
11608
- copy(activeAnswer.value.content);
11609
- message.success("\u590D\u5236\u6210\u529F");
11610
- break;
11611
- case "delete":
11612
- Modal.confirm({
11613
- title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
11614
- onOk: () => {
11615
- emit("delete", activeAnswer.value.id);
11616
- if (activeAnswerIndex.value > 0 && activeAnswerIndex.value === props.content.length - 1) {
11617
- activeAnswerIndex.value--;
11618
- }
11619
- }
11620
- });
11621
- break;
11622
- case "comment":
11623
- message.info("\u6682\u672A\u5F00\u653E");
11624
- break;
11625
- case "regenerate":
11626
- if (props.content.length >= 5) {
11627
- message.info("\u6700\u591A\u652F\u6301\u751F\u62105\u6761\u56DE\u7B54");
11628
- return;
11629
- }
11630
- emit("regenerate", activeAnswer.value.id);
11631
- nextTick(() => {
11632
- activeAnswerIndex.value = props.content.length - 1;
11633
- });
11634
- break;
11635
- }
11636
- };
11637
- return () => {
11638
- suggestionList.map(item => createVNode("div", {
11639
- "class": "suggestion-item",
11640
- "onClick": () => emit("send", item)
11641
- }, [item]));
11642
- const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
11643
- const operateDom = operateList.map(item => createVNode(resolveComponent("a-tooltip"), {
11644
- "title": item.title
11645
- }, {
11646
- default: () => [createVNode("div", {
11647
- "class": ["operate-item", item.key, {
11648
- active: item.isActive
11649
- }],
11650
- "onClick": () => handleOperate(item.key)
11651
- }, null)]
11652
- }));
11653
- const prevDisabled = activeAnswerIndex.value === 0;
11654
- const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
11655
- const answerNav = createVNode("div", {
11656
- "class": "operate-item operate-nav"
11657
- }, [createVNode("span", {
11658
- "class": ["nav", {
11659
- disabled: prevDisabled
11660
- }],
11661
- "onClick": () => switchAnswer(-1)
11662
- }, ["<"]), createVNode("span", null, [activeAnswerIndex.value + 1]), " ", createVNode("span", null, [createTextVNode("/")]), createVNode("span", null, [props.content.length]), createVNode("span", {
11663
- "class": ["nav", {
11664
- disabled: nextDisabled
11665
- }],
11666
- "onClick": () => switchAnswer(1)
11667
- }, [">"])]);
11668
- return createVNode("div", {
11669
- "class": "answer-bubble chat-bubble"
11670
- }, [createVNode(Avatar, {
11671
- "avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
11672
- "name": "\u7F8E\u5C0F\u817E"
11673
- }, null), createVNode("div", {
11674
- "ref": bubbleRef,
11675
- "class": "bubble answer"
11676
- }, null), createVNode("div", {
11677
- "class": "operates"
11678
- }, [props.content.length > 1 && answerNav, showOperates && operateDom])]);
11679
- };
11680
- }
11681
- });
11682
-
11683
- const QaContext = defineComponent({
11684
- emits: ["regenerate"],
11685
- props: {
11686
- list: {
11687
- type: Array,
11688
- default: () => []
11689
- }
11690
- },
11691
- setup(props, {
11692
- emit
11693
- }) {
11694
- const containerRef = ref();
11695
- const onAnswerRender = text => {
11696
- containerRef.value.scrollTo({
11697
- top: containerRef.value.scrollHeight,
11698
- behavior: "smooth"
11699
- });
11700
- };
11701
- const handleDeleteAnswer = (questionId, answerId) => {
11702
- const question = props.list.find(item => item.id === questionId);
11703
- if (question) {
11704
- question.answers = question.answers.filter(item => item.id !== answerId);
11705
- }
11706
- };
11707
- return () => {
11708
- const contextList = [];
11709
- for (let i = 0; i < props.list.length; i++) {
11710
- const questionItem = props.list[i];
11711
- const prevItem = props.list[i - 1];
11712
- const currentTime = questionItem.timestamp;
11713
- let timeDiff = 0;
11714
- if (prevItem) {
11715
- const prevTime = prevItem.timestamp;
11716
- timeDiff = currentTime - prevTime;
11717
- }
11718
- if (!prevItem || timeDiff > 1e3 * 60 * 5) {
11719
- contextList.push(createVNode("div", {
11720
- "class": "time-line"
11721
- }, [dayjs(currentTime).format("MM/DD HH:mm")]));
11722
- }
11723
- if (questionItem.content) {
11724
- contextList.push(createVNode(QuestionBubble, {
11725
- "content": questionItem.content
11726
- }, null));
11727
- }
11728
- if (questionItem.answers.length > 0) {
11729
- contextList.push(createVNode(AnswerBubble, {
11730
- "onRender": onAnswerRender,
11731
- "content": questionItem.answers,
11732
- "onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId),
11733
- "onRegenerate": () => emit("regenerate", questionItem.id)
11734
- }, null));
11735
- }
11736
- }
11737
- return createVNode("div", {
11738
- "class": "qa-context",
11739
- "ref": containerRef
11740
- }, [contextList]);
11741
- };
11742
- }
11743
- });
11744
-
11745
- const ChatBox = defineComponent({
11746
- props: {
11747
- theme: {
11748
- type: String,
11749
- default: "light"
11750
- },
11751
- // 语音输入 TODO
11752
- withSpeech: {
11753
- type: Boolean,
11754
- default: false
11755
- }
11756
- },
11757
- setup(props, {
11758
- emit
11759
- }) {
11760
- provide("chat-theme", props.theme);
11761
- const {
11762
- context,
11763
- answerLoading,
11764
- sendQuestion,
11765
- abortRequest
11766
- } = useQA();
11767
- provide("answerLoading", answerLoading);
11768
- provide("abortRequest", abortRequest);
11769
- const handleSend = (msg, questionId) => {
11770
- sendQuestion(msg, questionId);
11771
- };
11772
- return () => {
11773
- return createVNode("div", {
11774
- "class": ["inl-chat-box", `inl-chat-box-${props.theme}`]
11775
- }, [createVNode(QaContext, {
11776
- "list": context.value,
11777
- "onRegenerate": qId => handleSend("", qId)
11778
- }, null), createVNode(Bottom, {
11779
- "onSend": handleSend
11780
- }, null)]);
11781
- };
11782
- }
11783
- });
11784
-
11785
- const LlmChatBox = installComponent(ChatBox, "llm-chat-box");
11786
-
11787
- export { alarmVideo as AlarmVideo, index$6 as ChangeThemeSelect, childLayout as ChildLayout, index$9 as Demo, index$1 as FontSelect, index$5 as HeaderMenu, IconFont$1 as IconFont, icons as IconSelect, ImportModal, index$8 as Layout, table as LayoutTable, LlmChatBox, index$7 as Login, index$2 as ParamManager, ParamManagerV2, index$3 as PeopleSelect, pollingPlay as PollingPlay, index$4 as QueryFormContainer, index as SszComment, videoBox as VideoBox, VideoBoxV2$1 as VideoBoxV2, videoPlayerV1 as VideoPlayerV1, videoPlayerV2 as VideoPlayerV2, getDetailContainer, getMenuDetail };
11230
+ export { alarmVideo as AlarmVideo, index$6 as ChangeThemeSelect, childLayout as ChildLayout, index$9 as Demo, index$1 as FontSelect, index$5 as HeaderMenu, IconFont$1 as IconFont, icons as IconSelect, ImportModal, index$8 as Layout, table as LayoutTable, index$7 as Login, index$2 as ParamManager, ParamManagerV2, index$3 as PeopleSelect, pollingPlay as PollingPlay, index$4 as QueryFormContainer, index as SszComment, videoBox as VideoBox, VideoBoxV2$1 as VideoBoxV2, videoPlayerV1 as VideoPlayerV1, videoPlayerV2 as VideoPlayerV2, getDetailContainer, getMenuDetail };