Merge branch 'main' of git.zdool.com:xs/yxdt/h5

This commit is contained in:
汪汇 2024-03-08 10:47:19 +08:00
commit 8ee1dcc579
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 class="recomand">
<div v-for="(v, i) in recomanTags" :key="i" @click="cksend(v)" class="recomand_itm"> {{ v }}</div> <div v-for="(v, i) in recomanTags" :key="i" @click="cksend(v)" class="recomand_itm"> {{ v }}</div>
</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"> <div class="c_bottom">
<img src="../assets/3.png"> <img src="../assets/3.png">
<input v-model="inputText" @focus="handleInputFocus" type="text" placeholder="有问题尽管问我~" @keydown.enter="sendMessage" <input v-model="inputText" @focus="handleInputFocus" type="text" placeholder="有问题尽管问我~"
class="sendinput" /> @keydown.enter="sendMessage" class="sendinput" />
<div class="w_icon"> <div class="w_icon">
<img src="../assets/4.png" alt=""> <img src="../assets/4.png" alt="">
</div> </div>
@ -278,6 +283,7 @@ import { ref, reactive, nextTick, onMounted, watch } from 'vue'
import http from '@/api/http.js' import http from '@/api/http.js'
// import http from '@/utils/request.js' // import http from '@/utils/request.js'
let recomanTags = ref(['公积金查询', '2024放假安排', '附近推荐的锻炼场所']) let recomanTags = ref(['公积金查询', '2024放假安排', '附近推荐的锻炼场所'])
let modeldata = ref(['模型一', '模型二'])
let inputText = ref('') let inputText = ref('')
let messages = reactive([ 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 = () => { const handleInputFocus = () => {
console.log("聚焦了"); console.log("聚焦了");
scollToButtom(); scollToButtom();
} }
let pathname = ref('/generate')
const sendMessage = () => { const sendMessage = () => {
console.log("信息发送成功", inputText.value); console.log("信息发送成功", inputText.value);
let messageValue = inputText.value.trim() let messageValue = inputText.value.trim()
if (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: inputText.value, isMe: true, type: 'txt', });
messages.push({ id: Date.now(), text: '思考中。。。', isMe: true, type: 'loading', }); 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 = JSON.parse(res.name)
var msg = res.response var msg = res.response
messages.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' }); messages.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' });
@ -334,7 +352,7 @@ const sendMessage = () => {
messages.splice(ii, 1) messages.splice(ii, 1)
} }
}) })
console.log('error',error) console.log('error', error)
}) })
// if (inputText.value.indexOf('') != -1 || inputText.value.indexOf('') != -1) { // if (inputText.value.indexOf('') != -1 || inputText.value.indexOf('') != -1) {
// messagesCopy[10].id = Date.now(); // messagesCopy[10].id = Date.now();
@ -486,9 +504,24 @@ onMounted(() => {
font-size: 12px; font-size: 12px;
font-family: PingFang SC, PingFang SC; font-family: PingFang SC, PingFang SC;
font-weight: 400; font-weight: 400;
color: #4379FF; // color: #4379FF;
cursor: default; 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: "http://192.168.2.86:8003",
// target: "https://aiai.cityme.com.cn", // target: "https://aiai.cityme.com.cn",
target: "https://yx.cityme.com.cn/", target: "https://yx.cityme.com.cn/",
// target: "http://192.168.2.86:8003/test/main_serve/",
changeOrigin: true, changeOrigin: true,
// rewrite: (path) => path.replace(/\/test/, ""), //重写真实路径,替换/api // 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': { '/srv': {
// target: "https://aiai.cityme.com.cn", // target: "https://aiai.cityme.com.cn",
// target: 'http://36.140.118.172:88',//沈涛 // target: 'http://36.140.118.172:88',//沈涛