yangyin
2024-11-08 b5e920831f3e2ea94c809b0dd99f08c16d9feceb
src/components/chat/components/playBar/phrase/CommonPhrases.vue
@@ -59,7 +59,7 @@
</template>
<script setup lang="ts">
import { ElMessageBox } from 'element-plus';
import { ElMessage, ElMessageBox } from 'element-plus';
import { computed, onMounted, reactive, ref } from 'vue';
import { addUserSample, deleteUserSample, listUserSample, updateUserSample } from '/@/api/ai/chat';
import { activeGroupType, activeRoomId, activeSampleId, setRoomConfig } from '/@/stores/chatRoom';
@@ -118,6 +118,7 @@
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      dangerouslyUseHTMLString: true,
      closeOnClickModal: false,
      type: 'warning',
   }).then(async () => {
      const res = await deleteUserSample({
@@ -168,14 +169,20 @@
   activeSampleId.value = item.id;
};
const commonChatByUser = (data) => {
   state.inputCommonPhrases = data.question;
   addCommonPhrasesData();
   const question = data.question;
   const isCommon = commonPhrases.value.findIndex((item) => item.question === question) > -1;
   if (isCommon) {
      return ElMessage.warning('该问题已存在常用语中');
   } else {
      state.inputCommonPhrases = question;
      addCommonPhrasesData();
   }
};
//#endregion
onMounted(() => {
   getCommonPhrases();
});
defineExpose({ commonChatByUser,getCommonPhrases });
defineExpose({ commonChatByUser, getCommonPhrases });
</script>
<style scoped lang="scss">
.container {