增加 环境检测
This commit is contained in:
parent
ae936fc49b
commit
fa450f92a8
|
@ -291,11 +291,11 @@ let sinalModel = ref(false)
|
|||
let pathname = ref('')
|
||||
let modeldata = ref('')
|
||||
if (sinalModel.value) {
|
||||
pathname.value='/three'
|
||||
pathname.value = '/three'
|
||||
modeldata.value = ['模型三']
|
||||
|
||||
} else {
|
||||
pathname.value='/generate'
|
||||
pathname.value = '/generate'
|
||||
modeldata.value = ['模型一', '模型二', '模型三']
|
||||
}
|
||||
let inputText = ref('')
|
||||
|
@ -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)
|
||||
|
@ -363,7 +372,7 @@ const sendMessage = () => {
|
|||
if (inputText.value.trim()) {
|
||||
messages.push({ usrid: uid, qid: uuidv4(), text: inputText.value, isMe: true, type: 'txt', });
|
||||
// console.log("模型", pathname.value, messages);
|
||||
console.log("模型", pathname.value );
|
||||
console.log("模型", pathname.value);
|
||||
if (pathname.value == '/generate') {
|
||||
messages.push({ usrid: uid, qid: uuidv4(), text: '思考中。。。', isMe: true, type: 'loading', });
|
||||
http.post(pathname.value, { "text": messageValue }).then((res) => {
|
||||
|
@ -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()
|
||||
|
@ -484,7 +494,7 @@ onMounted(() => {
|
|||
// messages
|
||||
setTimeout(() => {
|
||||
// messages.push({ id: Date.now(), type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false });
|
||||
messages.push({ usrid: uid,qid:uuidv4(), type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false });
|
||||
messages.push({ usrid: uid, qid: uuidv4(), type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false });
|
||||
}, 500);
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue