This commit is contained in:
liuyalei 2024-03-07 17:24:56 +08:00
parent fa6ba1fd30
commit c1cb2c6e34
3 changed files with 45 additions and 5 deletions

BIN
dist.zip

Binary file not shown.

View File

@ -258,12 +258,17 @@
<!-- <div class="recomand">
<div v-for="(v, i) in recomanTags" :key="i" @click="cksend(v)" class="recomand_itm"> {{ v }}</div>
</div> -->
<div class="recomand">
<div v-for="(v, i) in modeldata" :key="i" @click="changetype(i)"
:class="{ 'recomand_itm': true, 'blue': modelnum == i }"> {{ v }}</div>
<div class="tip_window">当前模型接口{{ pathname }}</div>
</div>
<div class="c_bottom">
<img src="../assets/3.png">
<input v-model="inputText" @focus="handleInputFocus" type="text" placeholder="有问题尽管问我~" @keydown.enter="sendMessage"
class="sendinput" />
<input v-model="inputText" @focus="handleInputFocus" type="text" placeholder="有问题尽管问我~"
@keydown.enter="sendMessage" class="sendinput" />
<div class="w_icon">
<img src="../assets/4.png" alt="">
</div>
@ -278,6 +283,7 @@ import { ref, reactive, nextTick, onMounted, watch } from 'vue'
import http from '@/api/http.js'
// import http from '@/utils/request.js'
let recomanTags = ref(['公积金查询', '2024放假安排', '附近推荐的锻炼场所'])
let modeldata = ref(['模型一', '模型二'])
let inputText = ref('')
let messages = reactive([
@ -308,17 +314,29 @@ const cksend = (val) => {
}
}
let modelnum = ref('')
const changetype = (num) => {
modelnum.value = num
if (num == 1) {
pathname.value = '/test'
} else {
pathname.value = '/generate'
}
console.log("模型", pathname.value);
}
const handleInputFocus = () => {
console.log("聚焦了");
scollToButtom();
}
let pathname = ref('/generate')
const sendMessage = () => {
console.log("信息发送成功", inputText.value);
let messageValue = inputText.value.trim()
if (inputText.value.trim()) {
messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt', });
messages.push({ id: Date.now(), text: '思考中。。。', isMe: true, type: 'loading', });
http.post('/generate', { "text": messageValue }).then((res) => {
console.log("模型", pathname.value);
http.post(pathname.value, { "text": messageValue }).then((res) => {
// var msg = JSON.parse(res.name)
var msg = res.response
messages.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' });
@ -334,7 +352,7 @@ const sendMessage = () => {
messages.splice(ii, 1)
}
})
console.log('error',error)
console.log('error', error)
})
// if (inputText.value.indexOf('') != -1 || inputText.value.indexOf('') != -1) {
// messagesCopy[10].id = Date.now();
@ -486,9 +504,24 @@ onMounted(() => {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #4379FF;
// color: #4379FF;
cursor: default;
}
.blue {
color: #4379FF !important;
}
.tip_window {
position: absolute;
border: 1px solid #000;
width: 40%;
height: 100%;
right: 20%;
font-size: 12px;
text-align: center;
line-height: 28px;
}
}

View File

@ -14,10 +14,17 @@ export default defineConfig({
// target: "http://192.168.2.86:8003",
// target: "https://aiai.cityme.com.cn",
target: "https://yx.cityme.com.cn/",
// target: "http://192.168.2.86:8003/test/main_serve/",
changeOrigin: true,
// rewrite: (path) => path.replace(/\/test/, ""), //重写真实路径,替换/api
},
"^/test": {
target: "http://192.168.2.86:8003/",
changeOrigin: true,
rewrite: path => path.replace(/^\/test/, '/test/main_serve/')
},
'/srv': {
// target: "https://aiai.cityme.com.cn",
// target: 'http://36.140.118.172:88',//沈涛