Selaa lähdekoodia

Merge branch 'dev' into dev_zyh

zhouyuhao 6 kuukautta sitten
vanhempi
commit
ee620de06d

+ 15 - 0
src/api/module/AIRobot.ts

@@ -118,3 +118,18 @@ export const feedbackAiChat = (params: any, config: any) => {
     config
   )
 }
+
+/**
+ * AI Robot预设问题显示
+ */
+export const AIRobotInit = (params: any, config: any) => {
+  return HttpAxios.post(
+    `${baseUrl}`,
+    {
+      action: 'robot_chat',
+      operate: 'ai_chat_fixed_init',
+      ...params
+    },
+    config
+  )
+}

+ 11 - 55
src/components/AIRobot/src/AIRobot.vue

@@ -9,62 +9,17 @@ const AIRobotHoverVisible = ref(false)
 const clicked = ref(false)
 const isShowDefault = ref(false)
 const isShowAIRobotTop = ref(false)
-const AIIconVisible = ref(false)
-const DeQuestions = ref([
-  {
-    label: 'List shipments with ETA changes in the last 30 days.',
-    value: 'List shipments with ETA changes in the last 30 days.',
-    isLong: false
-  },
-  {
-    label: 'Shipments arriving in the next 7 days.',
-    value: 'Shipments arriving in the next 7 days.',
-    isLong: false
-  },
-  {
-    label: 'Show shipments delayed in the last 30 days.',
-    value: 'Show shipments delayed in the last 30 days.',
-    isLong: false
-  },
-  {
-    label: 'List shipments with milestone updates in the last 7 days.',
-    value: 'List shipments with milestone updates in the last 7 days.',
-    isLong: false
-  },
-  {
-    label: 'List shipments with milestone in the last 7 days2sdsa.',
-    value: 'List shipments with milestone in the last 7 days2sdsa.',
-    isLong: false
-  },
-  {
-    label: 'List shipments with milestone updates 7 days3fef.',
-    value: 'List shipments with milestone updates 7 days3fef.',
-    isLong: false
-  },
-  {
-    label:
-      'List shipments with ETA changes in the last 30 days11111111111111111111111111111111111.',
-    value:
-      'List shipments with ETA changes in the last 30 days11111111111111111111111111111111111.',
-    isLong: true
-  },
-  {
-    label:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111122.',
-    value:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111122.',
-    isLong: true
-  },
-  {
-    label:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111133.',
-    value:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111133.',
-    isLong: true
-  }
-])
+const AIIconVisible = ref(true)
+const DeQuestions = ref([])
 const itemGroups = ref([])
 
+const AIRobotInit = () => {
+  $api.AIRobotInit({}).then((res:any) => {
+    DeQuestions.value = res.data.fixed_question
+    prepareGroups()
+  })
+}
+
 // 鼠标hover AIRobot图标
 const AvatarMouseEnter = () => {
   if (clicked.value) {
@@ -91,6 +46,7 @@ const AvatarClick = () => {
 // 隐藏上方弹窗
 const HideAIRobotTop = () => {
   isShowDefault.value = false
+  isShowAIRobotTop.value = true
 }
 
 // 隐藏上方弹窗
@@ -165,7 +121,7 @@ const handelClick = (item: any) => {
 }
 
 onMounted(() => {
-  prepareGroups()
+  AIRobotInit()
   emitter.on('login-success', isShowLogin)
   emitter.on('login-out', Logout)
   emitter.on('checkPrompt', Logout)

+ 10 - 57
src/views/AIRobotChat/src/components/AIQuestions.vue

@@ -5,67 +5,22 @@ const props = defineProps<{
   modalSize: String
 }>()
 
-const DeQuestions = ref([
-  {
-    label: 'List shipments with ETA changes in the last 30 days.',
-    value: 'List shipments with ETA changes in the last 30 days.',
-    isLong: false
-  },
-  {
-    label: 'Shipments arriving in the next 7 days.',
-    value: 'Shipments arriving in the next 7 days.',
-    isLong: false
-  },
-  {
-    label: 'Show shipments delayed in the last 30 days.',
-    value: 'Show shipments delayed in the last 30 days.',
-    isLong: false
-  },
-  {
-    label: 'List shipments with milestone updates in the last 7 days.',
-    value: 'List shipments with milestone updates in the last 7 days.',
-    isLong: false
-  },
-  {
-    label: 'List shipments with milestone in the last 7 days2sdsa.',
-    value: 'List shipments with milestone in the last 7 days2sdsa.',
-    isLong: false
-  },
-  {
-    label: 'List shipments with milestone updates 7 days3fef.',
-    value: 'List shipments with milestone updates 7 days3fef.',
-    isLong: false
-  },
-  {
-    label:
-      'List shipments with ETA changes in the last 30 days11111111111111111111111111111111111.',
-    value:
-      'List shipments with ETA changes in the last 30 days11111111111111111111111111111111111.',
-    isLong: true
-  },
-  {
-    label:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111122.',
-    value:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111122.',
-    isLong: true
-  },
-  {
-    label:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111133.',
-    value:
-      'List shipments with ETA changes in the last 30 days1111111111111111111111111111111111133.',
-    isLong: true
-  }
-])
+const DeQuestions = ref([])
 const itemGroups = ref([])
 const pages = ref([])
+
+const AIRobotInit = () => {
+  $api.AIRobotInit({}).then((res:any) => {
+    DeQuestions.value = res.data.fixed_question
+    prepareGroups()
+    generatePages()
+  })
+}
 // 随机显示方法
 const prepareGroups = () => {
   const groups = []
   let currentGroup = []
   let currentHeight = 0
-
   DeQuestions.value.forEach((item) => {
     const itemHeight = item.isLong ? 2 : 1
 
@@ -83,7 +38,6 @@ const prepareGroups = () => {
   if (currentGroup.length > 0) {
     groups.push(currentGroup)
   }
-
   itemGroups.value = groups
 }
 // 智能分页算法
@@ -141,8 +95,7 @@ const generatePages = () => {
   pages.value = result.filter((p) => p.row1.length > 0)
 }
 onMounted(() => {
-  prepareGroups()
-  generatePages()
+  AIRobotInit()
 })
 
 const emit = defineEmits<{ question: [string] }>()