st-comp 0.0.257 → 0.0.258

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.257",
4
+ "version": "0.0.258",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -2,7 +2,7 @@
2
2
  import dayjs from "dayjs";
3
3
  import { ElMessage } from "element-plus";
4
4
  import { getUserData } from "st-func";
5
- import { inject, ref, nextTick, watch, reactive } from "vue";
5
+ import { inject, ref, nextTick, watch, reactive, onMounted } from "vue";
6
6
  import { sendToBaiLianAppStreaming } from "../../public/aiTools";
7
7
  import { UserFilled, Service, Promotion } from "@element-plus/icons-vue";
8
8
 
@@ -17,6 +17,9 @@ const props = defineProps({
17
17
  },
18
18
  });
19
19
 
20
+ // 自定义标签数据
21
+ const tagMap = ref();
22
+
20
23
  // loading状态
21
24
  const isSending = ref(false);
22
25
  const isThinking = ref(false);
@@ -250,11 +253,23 @@ const sendMessage = async () => {
250
253
  }
251
254
 
252
255
  // 触发回调
256
+ console.log(fullResponse);
253
257
  try {
254
258
  const jsonResponse = JSON.parse(fullResponse);
255
- // 切割掉parsedConditions, 这个字段仅做AI提炼展示使用
256
- delete jsonResponse.parsedConditions;
257
- console.log(jsonResponse)
259
+ // 切割处理: parsedConditions, 这个字段仅做AI提炼展示使用
260
+ if (jsonResponse.parsedConditions) {
261
+ delete jsonResponse.parsedConditions;
262
+ }
263
+ // 切割处理: customTagNames, 这个字段需要被转换成customTag
264
+ if (jsonResponse.customTagNames?.length) {
265
+ const customTag = jsonResponse.customTagNames.reduce((result, item) => {
266
+ const id = tagMap.value[item];
267
+ if (id) result.push(id);
268
+ return result;
269
+ }, []);
270
+ delete jsonResponse.customTagNames;
271
+ jsonResponse.customTag = customTag;
272
+ }
258
273
  emit("callBack", jsonResponse);
259
274
  } catch (error) {
260
275
  emit("callBack", fullResponse);
@@ -312,7 +327,25 @@ const scrollToBottom = async () => {
312
327
  messageListRef.value.scrollTop = messageListRef.value.scrollHeight;
313
328
  }
314
329
  };
315
-
330
+ // 获取全部标签
331
+ const getTotalTagMap = async () => {
332
+ const res = await Promise.all([stConfig.request.post("/alarm/deliversign/findTagsByUserId"), stConfig.request.post("/alarm/deliversign/findSystemTagsByTagName")]);
333
+ tagMap.value = res.reduce((result, item) => {
334
+ return {
335
+ ...result,
336
+ ...item.body?.reduce((cR, cI) => {
337
+ return {
338
+ ...cR,
339
+ [cI.tagName]: cI.id,
340
+ };
341
+ }, {}),
342
+ };
343
+ }, {});
344
+ };
345
+ onMounted(() => {
346
+ getTotalTagMap();
347
+ });
348
+ // 监视消息队列 => 自动滚动
316
349
  watch(
317
350
  () => messageList.value,
318
351
  () => {
@@ -320,6 +353,13 @@ watch(
320
353
  },
321
354
  { deep: true },
322
355
  );
356
+ // 监视不满意的反馈详情窗口 => 关闭自动清空数据
357
+ watch(
358
+ () => feedbackDialogVisible.value,
359
+ (newValue) => {
360
+ if (!newValue) feedbackContent.value = "";
361
+ },
362
+ );
323
363
  defineExpose({
324
364
  open: () => {
325
365
  visible.value = true;
@@ -433,7 +473,7 @@ defineExpose({
433
473
  type="textarea"
434
474
  :rows="4"
435
475
  :autosize="{ minRows: 2, maxRows: 4 }"
436
- placeholder="输入您想查询的品种条件... (Ctrl+Enter换行,Enter发送)"
476
+ placeholder="输入您想查询的品种条件..."
437
477
  @keydown="handleKeydown"
438
478
  />
439
479
  <div class="input-actions">
@@ -662,60 +702,39 @@ defineExpose({
662
702
  }
663
703
  .input-area {
664
704
  padding: 16px 24px 24px;
665
- border-top: 1px solid rgba(102, 126, 234, 0.1);
666
- background: rgba(255, 255, 255, 0.9);
667
705
  backdrop-filter: blur(10px);
668
-
669
706
  .message-input {
670
707
  :deep(.el-textarea__inner) {
671
708
  border-radius: 16px;
672
709
  border: 1px solid rgba(102, 126, 234, 0.2);
673
- background: #ffffff;
674
710
  font-size: 14px;
675
711
  padding: 12px 16px;
676
712
  transition: all 0.3s ease;
677
-
678
713
  &:focus {
679
714
  border-color: #667eea;
680
715
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
681
716
  }
682
-
683
- &::placeholder {
684
- color: #cbd5e0;
685
- }
686
717
  }
687
718
  }
688
-
689
719
  .input-actions {
690
720
  display: flex;
691
721
  justify-content: space-between;
692
722
  align-items: center;
693
723
  margin-top: 12px;
694
-
695
724
  .input-hint {
696
- font-size: 12px;
697
- color: #9ca3af;
698
-
699
- span {
700
- background: rgba(102, 126, 234, 0.1);
701
- padding: 4px 8px;
702
- border-radius: 12px;
703
- font-size: 11px;
704
- }
725
+ font-size: 11px;
726
+ color: var(--el-color-info);
705
727
  }
706
-
707
728
  .send-btn {
708
729
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
709
730
  border: none;
710
731
  padding: 8px 20px;
711
732
  font-weight: 500;
712
733
  transition: all 0.3s ease;
713
-
714
734
  &:hover {
715
735
  transform: translateY(-2px);
716
736
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
717
737
  }
718
-
719
738
  &:active {
720
739
  transform: translateY(0);
721
740
  }