This commit is contained in:
王创世 2025-02-28 20:34:13 +08:00
parent 86e835f67c
commit 81422e7710
3 changed files with 83 additions and 65 deletions

Binary file not shown.

View File

@ -1,44 +1,44 @@
{
"hash": "2c5e6f78",
"hash": "5b5aeddc",
"configHash": "b7fa4f41",
"lockfileHash": "64049b29",
"browserHash": "a3a373ee",
"lockfileHash": "691ad5f6",
"browserHash": "d31dc7ba",
"optimized": {
"naive-ui": {
"src": "../../naive-ui/es/index.mjs",
"file": "naive-ui.js",
"fileHash": "45d8e824",
"needsInterop": false
},
"vue": {
"src": "../../vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "32fae398",
"needsInterop": false
},
"vue-router": {
"src": "../../vue-router/dist/vue-router.mjs",
"file": "vue-router.js",
"fileHash": "b35d4254",
"needsInterop": false
},
"vue-wechat-title": {
"src": "../../vue-wechat-title/vue-wechat-title.js",
"file": "vue-wechat-title.js",
"fileHash": "1d78b2b2",
"needsInterop": true
},
"axios": {
"src": "../../axios/index.js",
"file": "axios.js",
"fileHash": "5add746f",
"fileHash": "596cc5f7",
"needsInterop": false
},
"marked": {
"src": "../../marked/lib/marked.esm.js",
"file": "marked.js",
"fileHash": "8ca88ca7",
"fileHash": "9d266fed",
"needsInterop": false
},
"naive-ui": {
"src": "../../naive-ui/es/index.mjs",
"file": "naive-ui.js",
"fileHash": "48531eea",
"needsInterop": false
},
"vue": {
"src": "../../vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "5fca8b08",
"needsInterop": false
},
"vue-router": {
"src": "../../vue-router/dist/vue-router.mjs",
"file": "vue-router.js",
"fileHash": "50af2467",
"needsInterop": false
},
"vue-wechat-title": {
"src": "../../vue-wechat-title/vue-wechat-title.js",
"file": "vue-wechat-title.js",
"fileHash": "b0f5b871",
"needsInterop": true
}
},
"chunks": {

View File

@ -14,9 +14,9 @@
style="position: absolute; right: calc(100% + 18px); top: 12px; gap: 12px;">
<div class="ds-icon-button" tabindex="0"
style="--ds-icon-button-text-color: #909090; --ds-icon-button-size: 20px;">
<div @click="copy(item.content)" class="ds-icon" style="font-size: 20px; width: 20px; height: 20px;"><svg
viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<div @click="copy(item.content)" class="ds-icon"
style="font-size: 20px; width: 20px; height: 20px;"><svg viewBox="0 0 20 20" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<clippath id="clip1257_20794">
<rect id="复制" width="20.000000" height="20.000000" fill="white" fill-opacity="0">
@ -89,9 +89,9 @@
<div class="ds-flex abe97156" style="align-items: center; gap: 12px;">
<div class="ds-icon-button" tabindex="0"
style="--ds-icon-button-text-color: #909090; --ds-icon-button-size: 20px;">
<div @click="copy(item.content)" class="ds-icon" style="font-size: 20px; width: 20px; height: 20px;"><svg
viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<div @click="copy(item.content)" class="ds-icon"
style="font-size: 20px; width: 20px; height: 20px;"><svg viewBox="0 0 20 20" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<clippath id="clip1257_20794">
<rect id="复制" width="20.000000" height="20.000000" fill="white" fill-opacity="0">
@ -150,9 +150,14 @@
<div class="b13855df">
</div>
</div>
<div @click="MesdsetQuestion" class="ec4f5d61">
<div class="ec4f5d61">
<div class="bf38813a">
<div role="button" aria-disabled="false" class="f6d670">
<div @click="MesdsetQuestionStorp" v-if="!chatHdEnd" role="button" aria-disabled="false" class="f6d670">
<div class="f286936b">
<div class="be24146b"></div>
</div>
</div>
<div @click="MesdsetQuestion" v-if="chatHdEnd" role="button" aria-disabled="false" class="f6d670">
<div class="f286936b">
<div class="ds-icon" style="font-size: 16px; width: 16px; height: 16px;"><svg
width="14" height="16" viewBox="0 0 14 16" fill="none"
@ -187,7 +192,7 @@
</template>
<script setup lang="ts">
import { reactive, ref, onUnmounted, nextTick, watch } from 'vue'
import { reactive, ref, onUnmounted, nextTick, onMounted } from 'vue'
import { setQuestion, getQuestion } from "@/api/index";
import { marked } from 'marked';
import { useMessage } from 'naive-ui'
@ -196,13 +201,8 @@ const Nevkey = ref('');
const showList = ref(false);
const message = ref('');
const paramMsg = ref([]);
const AllMessage = useMessage()
//
const showSk = ref('');
//
const page = reactive({ page: 1, limit: 1 });
//
const showHd = ref('');
//ID
const processedIds = ref(new Set());
@ -218,12 +218,13 @@ const scrollToBottom = async () => {
setTimeout(() => {
if (chatContainerRef.value) {
const container = chatContainerRef.value;
console.log(container);
container.scrollTop = container.scrollHeight;
}
}, 100);
};
onMounted(()=>{
Nevkey.value = Date.now().toString();
})
//
const handleScroll = (event) => {
const container = event.target;
@ -242,6 +243,11 @@ const handleScroll = (event) => {
//
const getQuestionList = () => {
if (storp.value == true) {
storp.value = false;
chatHdEnd.value = true;
return;
}
const index = paramMsg.value.length - 1;
if (paramMsg.value[index].role != 'assistant') {
paramMsg.value.push({ role: 'assistant', sk: '', content: '', skLong: true });
@ -279,11 +285,13 @@ const getQuestionList = () => {
})
}
const storp = ref(false);
//
const MesdsetQuestion = () => {
if (!message.value || message.value.trim() === '') return
console.log(chatHdEnd.value);
if (chatHdEnd.value == true) {
showList.value = true;
paramMsg.value.push({ role: 'user', content: message.value })
@ -302,7 +310,14 @@ const MesdsetQuestion = () => {
}
}
const MesdsetQuestionStorp=()=>{
storp.value=true;
paramMsg.value=[];
chatHdEnd.value = true;
showList.value=false;
// const lIndex = paramMsg.value.length - 1;
// paramMsg.value[lIndex].skLong = false;
}
//
onUnmounted(() => {
processedIds.value.clear();
@ -320,10 +335,13 @@ import "highlight.js/styles/monokai-sublime.css";
.language-markdown {
color: #000 !important;
}
.ds-markdown .ds-markdown--block {
color: #000 !important;
}
code[class*=language-], pre[class*=language-]{
code[class*=language-],
pre[class*=language-] {
color: #000 !important;
}
</style>