ai-chat-bot-interface 1.6.22 → 1.6.23

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": "ai-chat-bot-interface",
3
3
  "private": false,
4
- "version": "1.6.22",
4
+ "version": "1.6.23",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -23,6 +23,7 @@ const handleLog = (log) => {
23
23
  },
24
24
  ]"
25
25
  :need-log="true"
26
+ post-token="CE73EA32DA06F05C3F522FE8E5E1420399E9C8433CD4932C"
26
27
  content-type="markdown"
27
28
  first-msg="减脂减重"
28
29
  @log="handleLog"
package/src/ChatUi.vue CHANGED
@@ -202,6 +202,7 @@ import AssistantReplay from './components/assistantReplay/assistantReplay.vue';
202
202
  import StoreList from './components/StoreList/StoreList.vue';
203
203
  import MarkdownViewer from './components/MarkdownPlan/MarkdownViewer.vue';
204
204
  import PersonalForm from './components/personalForm/personalForm.vue';
205
+ import processBar from './components/icons/processBar.vue';
205
206
 
206
207
  const chatOptions = computed(() => {
207
208
  return {
@@ -275,6 +276,10 @@ const props = defineProps({
275
276
  type: String,
276
277
  required: true,
277
278
  },
279
+ postToken: {
280
+ type: String,
281
+ default: '',
282
+ },
278
283
  showHeader: {
279
284
  type: Boolean,
280
285
  default: true,
@@ -359,7 +364,14 @@ onMounted(async () => {
359
364
  } else {
360
365
  await createConv();
361
366
  if (props.firstMsg) {
362
- const perMsg = `本食谱为通用版${props.firstMsg}示例,依据以下女性常规身体数据制定:
367
+ await handleFirstMsg();
368
+ }
369
+ }
370
+ scrollToEnd();
371
+ });
372
+
373
+ const handleFirstMsg = async () => {
374
+ const perMsg = `本食谱为通用版${props.firstMsg}示例,依据以下女性常规身体数据制定:
363
375
  性别:女;
364
376
  年龄:25岁;
365
377
  身高:160cm;
@@ -367,11 +379,76 @@ onMounted(async () => {
367
379
  日常运动水平:久坐;
368
380
  口味偏好及饮食禁忌:无;
369
381
  如需定制贴合个人情况的专属方案,请前往完善个人身体数据,获取个性化定制食谱。`;
370
- await chatConv([{ content: perMsg, text: perMsg }]);
371
- }
382
+
383
+ historyList.value = [
384
+ {
385
+ conversation_id: '',
386
+ bot_id: props.botId,
387
+ role: 'user',
388
+ content: perMsg,
389
+ reasoning_content: '',
390
+ status: 'ended',
391
+ extra: [],
392
+ },
393
+ ];
394
+
395
+ const res = await post('/api/cn.weis.api.Food/bdGeneralTemp', {
396
+ method: 'bdGeneralTemp',
397
+ params: [{}],
398
+ token: props.postToken,
399
+ });
400
+ if (res.errCode === 0 && res.obj) {
401
+ const resMsg = `您的身高:160cm 年龄:25 岁 体重:60kg 性别:女 日常运动水平:久坐
402
+
403
+ 根据您的身体状况,给您推荐的饮食方案如下
404
+ ——————————————————
405
+
406
+ 早餐
407
+ 热量:375kcal
408
+ 碳水:46.9g
409
+ 蛋白质:18.8g
410
+ 脂肪:12.5g
411
+
412
+ 午餐
413
+ 热量:525kcal
414
+ 碳水:65.6g
415
+ 蛋白质:26.3g
416
+ 脂肪:17.5g
417
+
418
+ 晚餐
419
+ 热量:450kcal
420
+ 碳水:56.3g
421
+ 蛋白质:22.5g
422
+ 脂肪:15g
423
+
424
+ 加餐
425
+ 热量:150kcal
426
+ 碳水:26.3g
427
+ 蛋白质:3.8g
428
+ 脂肪:3.3g
429
+
430
+ ——————————————————`;
431
+
432
+ historyList.value.push({
433
+ conversation_id: '',
434
+ bot_id: props.botId,
435
+ role: 'assistant',
436
+ content: resMsg,
437
+ reasoning_content: '',
438
+ status: 'ended',
439
+ extra: [
440
+ {
441
+ ...res.obj,
442
+ showType: 'card',
443
+ },
444
+ ],
445
+ });
446
+ Emits('log', {
447
+ turns: turns.value,
448
+ info: historyList.value[historyList.value.length - 1],
449
+ });
372
450
  }
373
- scrollToEnd();
374
- });
451
+ };
375
452
 
376
453
  const createConv = async () => {
377
454
  const res = await post(
@@ -66,6 +66,10 @@
66
66
  <div class="tag">花生</div>
67
67
  <div class="tag">玉米淀粉</div>
68
68
  </div>-->
69
+ <div class="tips">
70
+ <span class="star">*</span
71
+ >一份的量偏小不便制作,因而基于3份的量来介绍,食用时取一份即可
72
+ </div>
69
73
  <div class="title">食材</div>
70
74
  <div class="text">
71
75
  {{ materialText }}
@@ -202,6 +206,17 @@ const getImageList = (str) => {
202
206
  font-size: 18px;
203
207
  }
204
208
  }
209
+ .tips {
210
+ vertical-align: middle;
211
+ font-size: 13px;
212
+ font-weight: 400;
213
+ margin-top: 10px;
214
+ .star {
215
+ color: #ff0000;
216
+ vertical-align: middle;
217
+ margin-right: 0.4em;
218
+ }
219
+ }
205
220
  .title {
206
221
  font-weight: 600;
207
222
  font-size: 15px;
@@ -31,12 +31,12 @@
31
31
  温馨提示:维小饭AI健康食谱为日常膳食调理方案,不能替代药物治疗或专业医疗建议。如有疾病,请及时就医并遵医嘱。
32
32
  </div>
33
33
  <div v-if="isMini" class="btn_group">
34
+ <div class="btn btn_1" @click.stop="handleBtn('personalForm')">
35
+ <span class="name">私人定制个性食谱</span>
36
+ </div>
34
37
  <div class="btn btn_2" @click.stop="handleBtn('ship_order')">
35
38
  <span class="name">去订餐</span>
36
39
  </div>
37
- <div class="btn btn_1" @click.stop="handleBtn('personalForm')">
38
- <span class="name">定制个性化食谱</span>
39
- </div>
40
40
  </div>
41
41
  <div v-else class="btn_group">
42
42
  <div
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <div class="cool-progress-container">
3
+ <!-- 进度条外层容器 -->
4
+ <div class="progress-bar-wrapper">
5
+ <!-- 进度条主体(带渐变+流光) -->
6
+ <div class="progress-bar" :style="{ width: `${percentage}%` }">
7
+ <!-- 流光伪元素通过 CSS 实现,无需额外DOM -->
8
+ </div>
9
+ </div>
10
+ <!-- 进度数字(发光效果) -->
11
+ <span class="progress-text">{{ percentage }}%</span>
12
+ </div>
13
+ </template>
14
+
15
+ <script setup>
16
+ import { onMounted, ref } from 'vue';
17
+ // 模拟进度值,可替换为业务数据
18
+ const percentage = ref(0);
19
+ const runner = ref('');
20
+ onMounted(() => {
21
+ percentage.value = 0;
22
+ runFunc();
23
+ });
24
+
25
+ const runFunc = () => {
26
+ let x = 0;
27
+ let t = 100;
28
+ const max = 95;
29
+ const calcProcess = () => {
30
+ const timer = setTimeout(() => {
31
+ if (percentage.value >= max) {
32
+ console.log('== stop ==', new Date().getTime());
33
+ clearTimeout(timer);
34
+ } else {
35
+ if (percentage.value > 80) {
36
+ t = 800;
37
+ }
38
+ percentage.value = (max * (1 - Math.exp(-x / 20))).toFixed(1);
39
+ x += 0.5;
40
+ calcProcess();
41
+ }
42
+ }, t);
43
+ };
44
+ console.log('== start ==', new Date().getTime());
45
+ calcProcess();
46
+ };
47
+ </script>
48
+
49
+ <style scoped>
50
+ .cool-progress-container {
51
+ width: 100%;
52
+ max-width: 600px;
53
+ margin: 20px 0;
54
+ padding: 15px;
55
+ background: #121212; /* 暗黑底色适配酷炫风 */
56
+ border-radius: 12px;
57
+ box-shadow: 0 0 20px rgba(0, 128, 255, 0.2);
58
+ }
59
+
60
+ .progress-bar-wrapper {
61
+ height: 24px;
62
+ width: 100%;
63
+ background: rgba(255, 255, 255, 0.08);
64
+ border-radius: 12px;
65
+ overflow: hidden;
66
+ position: relative;
67
+ }
68
+
69
+ .progress-bar {
70
+ height: 100%;
71
+ border-radius: 12px;
72
+ /* 赛博朋克渐变底色 */
73
+ background: linear-gradient(90deg, #00f5ff, #7928ca, #ff0080);
74
+ position: relative;
75
+ transition: width 0.5s ease-in;
76
+ }
77
+
78
+ /* 流光动画伪元素 */
79
+ .progress-bar-wrapper::after {
80
+ content: '';
81
+ position: absolute;
82
+ top: 0;
83
+ left: -100%;
84
+ width: 50%;
85
+ height: 100%;
86
+ background: linear-gradient(
87
+ 90deg,
88
+ transparent,
89
+ rgba(255, 255, 255, 0.4),
90
+ transparent
91
+ );
92
+ transform: skewX(-20deg);
93
+ animation: light-flow 1.5s infinite linear;
94
+ }
95
+
96
+ /* 流光动画 */
97
+ @keyframes light-flow {
98
+ 0% {
99
+ left: -100%;
100
+ }
101
+ 100% {
102
+ left: 200%;
103
+ }
104
+ }
105
+
106
+ /* 发光进度文字 */
107
+ .progress-text {
108
+ display: block;
109
+ margin-top: 8px;
110
+ font-size: 16px;
111
+ font-weight: bold;
112
+ color: #00f5ff;
113
+ text-shadow: 0 0 10px #00f5ff, 0 0 20px #00f5ff;
114
+ }
115
+ </style>
package/vite.config.js CHANGED
@@ -20,5 +20,14 @@ export default defineConfig({
20
20
  },
21
21
  server: {
22
22
  host: '0.0.0.0',
23
+ hmr: true,
24
+ proxy: {
25
+ '/api': {
26
+ // target: 'https://prodapi.weis1606.cn',
27
+ target: 'https://api.weis1606.cn/',
28
+ changeOrigin: true,
29
+ rewrite: (path) => path.replace(/^\/api/, '/api'),
30
+ },
31
+ },
23
32
  },
24
33
  });