增加 环境检测
This commit is contained in:
parent
ae936fc49b
commit
fa450f92a8
|
@ -317,6 +317,14 @@ let messagesCopy = reactive([
|
|||
{ id: 11, type: 'card5', text: '卡片5', carddata: { name: '', text: '卡片5' }, isMe: false },
|
||||
{ id: 12, type: 'txt', text: '空白', isMe: false },
|
||||
]);
|
||||
let prefixpath=ref('/three')
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
console.log('生产');
|
||||
prefixpath.value=''
|
||||
} else {
|
||||
console.log("dev");
|
||||
prefixpath.value='/three'
|
||||
}
|
||||
const cksend = (val) => {
|
||||
if (val.trim()) {
|
||||
inputText.value = val.trim()
|
||||
|
@ -345,7 +353,8 @@ const handleInputFocus = () => {
|
|||
}
|
||||
|
||||
const uid = uuidv4()
|
||||
const event = new EventSource('/three/srv/platform/chat/connect/' + uid, { withCredentials: true });
|
||||
// const event = new EventSource( prefixpath.value+'/three/srv/platform/chat/connect/' + uid, { withCredentials: true });
|
||||
const event = new EventSource( prefixpath.value+'/srv/platform/chat/connect/' + uid, { withCredentials: true });
|
||||
event.onmessage = function (e) {
|
||||
console.log("e", JSON.parse(e.data));
|
||||
var strpart = JSON.parse(e.data)
|
||||
|
@ -408,7 +417,8 @@ const sendMessage = () => {
|
|||
});
|
||||
} else if (pathname.value == '/three') {
|
||||
var msid = uuidv4()
|
||||
http.post(pathname.value + '/srv/platform/chat', { 'id': uid, 'qid': msid, "prompt": messageValue }).then((res) => {
|
||||
// http.post(pathname.value + '/srv/platform/chat', { 'id': uid, 'qid': msid, "prompt": messageValue }).then((res) => {
|
||||
http.post(prefixpath.value + '/srv/platform/chat', { 'id': uid, 'qid': msid, "prompt": messageValue }).then((res) => {
|
||||
console.log("three message", res);
|
||||
messages.push({ usrid: uid, qid: msid, text: '思考中...', isMe: false, type: 'txt' });
|
||||
scollToButtom()
|
||||
|
|
Loading…
Reference in New Issue