| | |
| | | import { md } from './libs/markdown'; |
| | | import { RoleEnum, roleImageMap, type ChatMessage } from './types'; |
| | | import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue'; |
| | | import { activeChatRoom } from '/@/stores/chatRoom'; |
| | | import router from '/@/router'; |
| | | |
| | | let apiKey = ''; |
| | | let isConfig = ref(false); |
| | |
| | | if (getAPIKey()) { |
| | | switchConfigStatus(); |
| | | } |
| | | const inputValue = history.state.inputValue; |
| | | messageContent.value = inputValue; |
| | | if (!activeChatRoom.value) { |
| | | router.replace({ |
| | | name: 'Home', |
| | | }); |
| | | return; |
| | | } |
| | | messageContent.value = activeChatRoom.value.title; |
| | | sendOrSave(); |
| | | }); |
| | | |
| | |
| | | |
| | | const sendOrSave = () => { |
| | | if (!messageContent.value.length) return; |
| | | if (activeChatRoom.value.isInitial) { |
| | | activeChatRoom.value.title = messageContent.value; |
| | | activeChatRoom.value.isInitial = false; |
| | | } |
| | | if (isConfig.value) { |
| | | if (saveAPIKey(messageContent.value.trim())) { |
| | | switchConfigStatus(); |