增加输入时候的 markdown 解析
All checks were successful
Build / build (push) Successful in 1m37s

This commit is contained in:
Twilight 2024-09-20 13:01:20 +08:00
parent 6a4a6d8ed6
commit 3a503764c6
2 changed files with 4 additions and 3 deletions

View File

@ -12,6 +12,7 @@
},
"dependencies": {
"@kangc/v-md-editor": "^2.3.18",
"@notable/html2markdown": "^2.0.3",
"@traptitech/markdown-it-katex": "^3.6.0",
"animate.css": "^4.1.1",
"axios": "^1.7.7",

View File

@ -199,6 +199,7 @@ import { useIsMobile } from "@/utils/composables";
import { useAppStore } from "@/stores/app";
import { UploadCustomRequestOptions, useDialog, useMessage } from "naive-ui";
import { useAssistantStore } from "@/stores/assistants";
import html2markdown from "@notable/html2markdown";
// chatId
const chatId: Ref<string | number | undefined | null> = ref(null);
@ -230,7 +231,6 @@ const content = ref("");
const inputExpanded = ref(false);
const chatMessages: Ref<EntityChatMessage[] | undefined> = ref([]);
const processing = ref(false);
const fileUpload = ref();
const uploading = ref(false);
const autoScroll = ref(true);
const appStore = useAppStore();
@ -360,14 +360,14 @@ function sendText() {
}
const input = inputText.value;
const textContent = input.innerText.trim();
const textContent = input.innerHTML;
if (textContent === "") {
return;
}
//
sendMessage("user", textContent);
sendMessage("user", html2markdown(textContent));
//
input.innerText = "";