fix
This commit is contained in:
@@ -161,7 +161,6 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
emit('chatChange',{type:JSON.parse(event.data).status})
|
emit('chatChange',{type:JSON.parse(event.data).status})
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
eventSource.onerror = function(error) {
|
eventSource.onerror = function(error) {
|
||||||
if (eventSource.readyState === EventSource.CLOSED) {
|
if (eventSource.readyState === EventSource.CLOSED) {
|
||||||
@@ -195,7 +194,7 @@ export default defineComponent({
|
|||||||
}else{
|
}else{
|
||||||
let think = ''
|
let think = ''
|
||||||
let message = ''
|
let message = ''
|
||||||
if(text.split('[TEXT]').length > 1){
|
if(text.split('[TEXT]').length > 1 && text.split('[THINK]').length > 1){
|
||||||
think = text.split('[TEXT]')[0]
|
think = text.split('[TEXT]')[0]
|
||||||
text.split('[TEXT]').forEach((text:any,index:number) => {
|
text.split('[TEXT]').forEach((text:any,index:number) => {
|
||||||
if(index == 0)return
|
if(index == 0)return
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="sendBox">
|
<div class="sendBox">
|
||||||
|
<div class="enableThinking" :class="{active:enableThinking}" @click="()=>enableThinking = !enableThinking">Deep Thinking</div>
|
||||||
<div class="maxNum">{{ chatContent.length }}/10000</div>
|
<div class="maxNum">{{ chatContent.length }}/10000</div>
|
||||||
<div class="send" @click="sendChat">
|
<div class="send" @click="sendChat">
|
||||||
<i class="fi fi-ss-paper-plane-top"></i>
|
<i class="fi fi-ss-paper-plane-top"></i>
|
||||||
@@ -101,6 +102,7 @@ export default defineComponent({
|
|||||||
'描述3',
|
'描述3',
|
||||||
'描述2',
|
'描述2',
|
||||||
],
|
],
|
||||||
|
enableThinking:false,//深度思考
|
||||||
uploadFile:null as any,
|
uploadFile:null as any,
|
||||||
loadingShow:false,
|
loadingShow:false,
|
||||||
text:'',
|
text:'',
|
||||||
@@ -133,33 +135,33 @@ export default defineComponent({
|
|||||||
let fileList = JSON.parse(JSON.stringify(data.filList))
|
let fileList = JSON.parse(JSON.stringify(data.filList))
|
||||||
let fileUrl = (fileList.filter((item:any)=>item.type == 'file').length > 0) ? fileList.filter((item:any)=>item.type == 'file')[0].minioPath : ''
|
let fileUrl = (fileList.filter((item:any)=>item.type == 'file').length > 0) ? fileList.filter((item:any)=>item.type == 'file')[0].minioPath : ''
|
||||||
let imageUrlList = (fileList.filter((item:any)=>item.type == 'image').length > 0)? fileList.filter((item:any)=>item.type == 'image').map((item:any)=>item.minioPath).join(',') : ''
|
let imageUrlList = (fileList.filter((item:any)=>item.type == 'image').length > 0)? fileList.filter((item:any)=>item.type == 'image').map((item:any)=>item.minioPath).join(',') : ''
|
||||||
Https.axiosGet(Https.httpUrls.chatCreateProject, {params:{prompt:data.chatContent,process:data.selectFlow.value,fileUrl:fileUrl,imageUrlList}}).then((rv)=>{
|
// Https.axiosGet(Https.httpUrls.chatCreateProject, {params:{prompt:data.chatContent,process:data.selectFlow.value,fileUrl:fileUrl,imageUrlList}}).then((rv)=>{
|
||||||
if(rv){
|
// if(rv){
|
||||||
data.loadingShow = false
|
// data.loadingShow = false
|
||||||
emit('newProject',rv)
|
// emit('newProject',rv)
|
||||||
}
|
|
||||||
}).catch(()=>{
|
|
||||||
data.loadingShow = false
|
|
||||||
})
|
|
||||||
|
|
||||||
// const eventSource = new EventSource(`http://192.168.1.3:5567${Https.httpUrls.chatCreateProject}?prompt=${data.chatContent}&token=${getCookie('token')}`,{
|
|
||||||
// });
|
|
||||||
// eventSource.onmessage = function(event) {
|
|
||||||
|
|
||||||
// data.text+=event.data
|
|
||||||
// console.log('收到数据:', event.data);
|
|
||||||
// };
|
|
||||||
// eventSource.onerror = function(error) {
|
|
||||||
// console.log(EventSource.CLOSED,EventSource)
|
|
||||||
// console.log(eventSource.readyState )
|
|
||||||
// if (eventSource.readyState === EventSource.CLOSED) {
|
|
||||||
// console.log('连接已正常关闭');
|
|
||||||
// } else {
|
|
||||||
// console.error('错误:', error);
|
|
||||||
// // 处理错误重连逻辑
|
|
||||||
// }
|
// }
|
||||||
// eventSource.close()
|
// }).catch(()=>{
|
||||||
// };
|
// data.loadingShow = false
|
||||||
|
// })
|
||||||
|
let projectId = ''
|
||||||
|
const eventSource = new EventSource(`${process.env.VUE_APP_BASE_URL}${Https.httpUrls.llmStream}?token=${getCookie('token')}&prompt=${data.chatContent}&projectId=&fileUrl=${fileUrl}&imageUrlList=${imageUrlList}&enableThinking=${data.enableThinking}&process=${data.selectFlow.value}`);
|
||||||
|
eventSource.onmessage = function(event) {
|
||||||
|
let eventData = JSON.parse(event.data)
|
||||||
|
if(eventData.status == "[PROJECT_CREATE_SIGNAL]"){
|
||||||
|
projectId = JSON.parse(eventData.tools_data).projectId
|
||||||
|
}
|
||||||
|
};
|
||||||
|
eventSource.onerror = function(error) {
|
||||||
|
if (eventSource.readyState === EventSource.CLOSED) {
|
||||||
|
// data.chatList[data.chatList.length-1].content.message='服务器繁忙,请稍后再试。'
|
||||||
|
} else {
|
||||||
|
if(projectId){
|
||||||
|
emit('newProject',projectId)
|
||||||
|
}
|
||||||
|
eventSource.close()
|
||||||
|
}
|
||||||
|
data.loadingShow = false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const handleFileUpload = (event:any)=>{
|
const handleFileUpload = (event:any)=>{
|
||||||
if (event.target.files[0].size > 5 * 1024 * 1024) { // 5MB
|
if (event.target.files[0].size > 5 * 1024 * 1024) { // 5MB
|
||||||
@@ -393,6 +395,21 @@ export default defineComponent({
|
|||||||
> .sendBox{
|
> .sendBox{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
> .enableThinking{
|
||||||
|
width: 10rem;
|
||||||
|
padding: .2rem .4rem;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
border: 1px solid #000;
|
||||||
|
border-radius: .4rem;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 1rem;
|
||||||
|
&.active{
|
||||||
|
background: #000;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
> .maxNum{
|
> .maxNum{
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
margin-right: .8rem;
|
margin-right: .8rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user