123
This commit is contained in:
parent
86e835f67c
commit
81422e7710
BIN
deepseek.zip
BIN
deepseek.zip
Binary file not shown.
58
node_modules/.vite/deps/_metadata.json
generated
vendored
58
node_modules/.vite/deps/_metadata.json
generated
vendored
@ -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": {
|
||||
|
@ -6,7 +6,7 @@
|
||||
<div class="a5cd95be">
|
||||
<div class="b83ee326">
|
||||
<div class="f6004764" ref="chatContainerRef" @scroll="handleScroll">
|
||||
<div class="f72b0bab" :style="{ height: !showList ? '60%' : '100%' }" >
|
||||
<div class="f72b0bab" :style="{ height: !showList ? '60%' : '100%' }">
|
||||
<div class="dad65929" style="flex-grow: 0;margin: 0px auto;" ref="chatContainer" v-if="showList"
|
||||
v-for="item in paramMsg">
|
||||
<div v-if="item.role == 'user'" class="fa81">
|
||||
@ -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="bf38813a">
|
||||
<div role="button" aria-disabled="false" class="f6d670">
|
||||
<div class="ec4f5d61">
|
||||
<div class="bf38813a">
|
||||
<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,29 +192,24 @@
|
||||
</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'
|
||||
import "highlight.js/styles/monokai-sublime.css";
|
||||
import "highlight.js/styles/monokai-sublime.css";
|
||||
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());
|
||||
|
||||
const chatContainerRef = ref(null);
|
||||
// 添加用户是否手动滚动的标志
|
||||
const userScrolled = ref(false);
|
||||
const chatHdEnd=ref(true);
|
||||
const chatHdEnd = ref(true);
|
||||
// 修改滚动到底部的函数
|
||||
const scrollToBottom = async () => {
|
||||
// 如果用户已经手动滚动,则不再自动滚动
|
||||
@ -218,22 +218,23 @@ 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;
|
||||
const isScrolledToBottom = container.scrollHeight - container.scrollTop < container.clientHeight;
|
||||
|
||||
|
||||
// 如果不在底部,说明用户进行了手动滚动
|
||||
if (!isScrolledToBottom) {
|
||||
userScrolled.value = true;
|
||||
}
|
||||
|
||||
|
||||
// 如果用户将内容滚动到底部,重新启用自动滚动
|
||||
if (isScrolledToBottom) {
|
||||
userScrolled.value = false;
|
||||
@ -242,9 +243,14 @@ 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 });
|
||||
paramMsg.value.push({ role: 'assistant', sk: '', content: '', skLong: true });
|
||||
}
|
||||
getQuestion({ 'key': Nevkey.value, 'page': page.page, 'limit': page.limit }).then(res => {
|
||||
if (res.code == 1) {
|
||||
@ -256,14 +262,14 @@ const getQuestionList = () => {
|
||||
if (item.reasoning == 1) {
|
||||
paramMsg.value[lastIndex].sk += item.content;
|
||||
} else {
|
||||
paramMsg.value[lastIndex].skLong =false;
|
||||
paramMsg.value[lastIndex].skLong = false;
|
||||
paramMsg.value[lastIndex].content += item.content;
|
||||
}
|
||||
}
|
||||
if (item.usage_json.length > 0 || item.usage_json.prompt_tokens) {
|
||||
const lIndex = paramMsg.value.length - 1;
|
||||
paramMsg.value[lIndex].content = marked(paramMsg.value[lIndex].content);
|
||||
paramMsg.value[lIndex].skLong =false;
|
||||
paramMsg.value[lIndex].skLong = false;
|
||||
chatHdEnd.value = true;
|
||||
return;
|
||||
}
|
||||
@ -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 })
|
||||
@ -293,8 +301,8 @@ const MesdsetQuestion = () => {
|
||||
processedIds.value.clear();
|
||||
message.value = '';
|
||||
chatHdEnd.value = false;
|
||||
userScrolled.value = false;
|
||||
scrollToBottom(); // 添加滚动到底部
|
||||
userScrolled.value = false;
|
||||
scrollToBottom(); // 添加滚动到底部
|
||||
setQuestion({ 'key': Nevkey.value, 'messages': JSON.stringify(paramMsg.value) }).then(res => {
|
||||
console.log(res);
|
||||
});
|
||||
@ -302,13 +310,20 @@ 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();
|
||||
page.page = 1;
|
||||
});
|
||||
const copy = (d) =>{
|
||||
const copy = (d) => {
|
||||
navigator.clipboard.writeText(d);
|
||||
//AllMessage.success('复制成功!');
|
||||
}
|
||||
@ -317,13 +332,16 @@ const copy = (d) =>{
|
||||
|
||||
import "highlight.js/styles/monokai-sublime.css";
|
||||
<style>
|
||||
.language-markdown{
|
||||
color: #000!important;
|
||||
.language-markdown {
|
||||
color: #000 !important;
|
||||
}
|
||||
.ds-markdown .ds-markdown--block{
|
||||
color: #000!important;
|
||||
|
||||
.ds-markdown .ds-markdown--block {
|
||||
color: #000 !important;
|
||||
}
|
||||
code[class*=language-], pre[class*=language-]{
|
||||
color: #000!important;
|
||||
|
||||
code[class*=language-],
|
||||
pre[class*=language-] {
|
||||
color: #000 !important;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user