DialogList.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <a-scrollbar
  3. type="track"
  4. :style="container_style"
  5. ref="scroll_container"
  6. data-flat="list-container"
  7. :class="is_show_right_page ? 'scrollbar_klass' : ''"
  8. >
  9. <slot name="left"></slot>
  10. <div class="dialog-list dialog-markdown-container">
  11. <DialogItem
  12. v-for="(item, index) of list"
  13. :dialog="item"
  14. :index="index"
  15. :width="width"
  16. :key="item.client_custom_unique_id"
  17. :answer_action_list="answer_action_list"
  18. @select="handleSelectChat(item)"
  19. @edit="handleEditChat(item)"
  20. @toSearchPage="toSearchPage(item)"
  21. />
  22. <DialogSuggestion v-if="suggestion.length !== 0" :suggestion="suggestion" />
  23. </div>
  24. <slot name="right"></slot>
  25. </a-scrollbar>
  26. </template>
  27. <script setup>
  28. import { computed } from 'vue';
  29. import DialogItem from './DialogItem.vue';
  30. import DialogSuggestion from './DialogSuggestion.vue';
  31. import useScrollBottom from './use-scroll-bottom';
  32. const props = defineProps({
  33. /**
  34. * 对话区域的告诉
  35. */
  36. height: Number,
  37. /**
  38. * 对话区域的宽度
  39. */
  40. width: Number,
  41. /**
  42. * 智能体的ID
  43. */
  44. agent_id: String,
  45. /**
  46. * 对话内容数据项
  47. */
  48. list: Array,
  49. /**
  50. * 推荐项
  51. * 当一轮对话结束时,智能体可能会返回推荐项目信息
  52. */
  53. suggestion: Array,
  54. answer_action_list: Array,
  55. /**
  56. * 控制滚动条展示
  57. * */
  58. is_show_right_page: Boolean
  59. });
  60. const emit = defineEmits(['edit']);
  61. const scroll2Bottom = useScrollBottom('scroll_container');
  62. const container_style = computed(() => {
  63. return {
  64. height: props.height + 'px',
  65. overflow: 'auto',
  66. display: 'flex'
  67. };
  68. });
  69. /**
  70. * 选择某个项目
  71. * @param item
  72. */
  73. const handleSelectChat = (item) => {};
  74. const handleEditChat = (item) => {
  75. emit('edit', item);
  76. };
  77. const toSearchPage = (item) => {
  78. emit('toSearchPage', item);
  79. };
  80. defineExpose({
  81. scroll2Bottom: () => {
  82. scroll2Bottom(1000000);
  83. }
  84. });
  85. </script>
  86. <style src="./chat-content.css"></style>
  87. <style lang="css" scoped>
  88. .dialog-list {
  89. color: var(--color-text-1);
  90. flex-grow: 1;
  91. }
  92. :deep(.scrollbar_klass ~ .arco-scrollbar-track.arco-scrollbar-track-direction-vertical) {
  93. display: none;
  94. }
  95. </style>
  96. <style>
  97. /* 隐藏横向滚动条 */
  98. .conversation-chat-main-container .arco-scrollbar-track.arco-scrollbar-track-direction-horizontal {
  99. display: none;
  100. }
  101. </style>