ai-chat-bot-interface 1.6.16 → 1.6.18

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.16",
4
+ "version": "1.6.18",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -24,6 +24,7 @@ const handleLog = (log) => {
24
24
  ]"
25
25
  :need-log="true"
26
26
  content-type="markdown"
27
+ first-msg="减脂减重"
27
28
  @log="handleLog"
28
29
  />
29
30
  </div>
package/src/ChatUi.vue CHANGED
@@ -123,6 +123,7 @@
123
123
  finalCardList.personalForm &&
124
124
  comp.showType === 'personalForm'
125
125
  "
126
+ :query="firstMsg"
126
127
  @submit="chatConv"
127
128
  />
128
129
  </template>
@@ -355,7 +356,32 @@ onMounted(async () => {
355
356
  } else {
356
357
  await createConv();
357
358
  if (props.firstMsg) {
358
- await chatConv([{ content: props.firstMsg, text: props.firstMsg }]);
359
+ // await chatConv([{ content: props.firstMsg, text: props.firstMsg }]);
360
+ historyList.value = [
361
+ {
362
+ conversation_id: '',
363
+ bot_id: props.botId,
364
+ role: 'user',
365
+ content: props.firstMsg,
366
+ reasoning_content: '',
367
+ status: 'ended',
368
+ extra: [],
369
+ },
370
+ {
371
+ conversation_id: '',
372
+ bot_id: props.botId,
373
+ role: 'assistant',
374
+ content:
375
+ '你好!请提供你的身高、年龄、体重、性别、日常运动水平等身体数据,以及口味偏好、饮食禁忌、疾病史等信息,我会为你制定饮食方案和提供配餐信息。',
376
+ reasoning_content: '',
377
+ status: 'ended',
378
+ extra: [
379
+ {
380
+ showType: 'personalForm',
381
+ },
382
+ ],
383
+ },
384
+ ];
359
385
  }
360
386
  }
361
387
  scrollToEnd();
@@ -6,6 +6,12 @@ import { showToast } from 'vant';
6
6
  import { Field } from 'vant';
7
7
 
8
8
  const showPopup = ref(false);
9
+ const props = defineProps({
10
+ query: {
11
+ type: String,
12
+ default: '',
13
+ },
14
+ });
9
15
 
10
16
  const dialogInfo = ref({
11
17
  key: 'sex',
@@ -100,7 +106,7 @@ const pfForm = ref([
100
106
  {
101
107
  key: 'sport',
102
108
  label: '日常运动水平',
103
- value: '',
109
+ value: '轻体力',
104
110
  placeholder: '请输入',
105
111
  required: true,
106
112
  },
@@ -110,7 +116,7 @@ const pfForm = ref([
110
116
  value: '',
111
117
  taste: [],
112
118
  taboo: [],
113
- placeholder: '请输入',
119
+ placeholder: '无忌口',
114
120
  required: false,
115
121
  },
116
122
  ]);
@@ -275,7 +281,8 @@ const handleSubmit = () => {
275
281
  }
276
282
 
277
283
  localStorage.setItem('personalInfo', JSON.stringify(pfForm.value));
278
- const msg = `性别:${pfForm.value.find((item) => item.key === 'sex').value};
284
+ const msg = `${props.query};
285
+ 性别:${pfForm.value.find((item) => item.key === 'sex').value};
279
286
  年龄:${pfForm.value[ageIdx].value}${pfForm.value[ageIdx].unit || ''};
280
287
  身高:${pfForm.value[heightIdx].value}${pfForm.value[heightIdx].unit || ''};
281
288
  体重:${pfForm.value[weightIdx].value}${pfForm.value[weightIdx].unit || ''};
@@ -332,7 +339,7 @@ const selectSex = (item) => {
332
339
  :class="{ disabled: !isValid }"
333
340
  @click.stop="handleSubmit"
334
341
  >
335
- 按身体数据领取7天食谱
342
+ 按身体数据领取食谱
336
343
  </div>
337
344
  </div>
338
345