修改AI聊天部分

master^2
Gary 2 weeks ago
parent d8d79bacc6
commit 7f46b731a0

@ -236,19 +236,6 @@
}
},//
/* {
"path": "pages/homepages/temp/temp",
"style": {
"navigationStyle": "custom"
}
}*/
/*---------------------------------------------------------------------------------------------------------------------------------*/
{
"path": "pages/homepages/puppy_chat/puppy_chat",
@ -257,7 +244,7 @@
}
},
/*------------------------------------------------------------------------------------------------------------------------------*/
/* {
/* {
"path": "pages/homepages/community/community",
"style": {
"navigationStyle": "custom"
@ -271,9 +258,9 @@
}
},
/*-------------------------------------------------------------------------------------------------------------------------*/
/*
{
"path": "pages/homepages/user/user_information/user_information",
/* {
"path": "pages/homepages/user/basic_information/basic_information",
"style": {
"navigationStyle": "custom"
}
@ -289,8 +276,8 @@
"style": {
"navigationStyle": "custom"
}
},
{
},*/
/* {
"path": "pages/homepages/user/exercise_plans/exercise_plans",
"style": {
"navigationStyle": "custom"

@ -38,7 +38,11 @@ export default {
const app = getApp();
const serverAddress = app.globalData.fit_journey_ai_address;
console.log("后端服务器的地址是:"+serverAddress);
/* uni.showToast({
title: 'AI正在识别中呢~',
icon: 'loading',
duration: 2000
});*/
// API
uni.file
uni.chooseImage({
@ -58,6 +62,18 @@ export default {
filePath: filePath,
name: 'file', //
success: (uploadFileRes) => {
uni.showToast({
title: 'AI正在识别中呢~',
icon: 'loading',
duration: 2000
});
console.log('上传结果:', uploadFileRes);
const response = JSON.parse(uploadFileRes.data); //
if (response && response.data) {

@ -41,7 +41,7 @@
can_generate_button_click: true, //
recipeImage: null, //
result: '这个',
result: '对不起AI生成有点慢哦请耐心等待~',
token:uni.getStorageSync("access_token"),
};
},
@ -55,7 +55,7 @@
uni.showToast({
title: '正在生成...',
icon: 'loading',
duration: 12000, // Toast 2
duration: 15000, // Toast 2
});
//
const app= getApp();
@ -90,7 +90,7 @@
setTimeout(() => {
this.can_generate_button_click= false;
this.is_create_success = 0;
}, 12000);
}, 20000);
/* //在20秒的时候清空result
setTimeout(() => {
this.result="";

@ -7,8 +7,45 @@
<script>
export default {
data() {
return {};
return {
token: uni.getStorageSync("access_token")
};
},
methods:{
go_to_apple()//
{
uni.navigateTo({
url: "/pages/homepages/homes//pages/homepages/homes/dictionary/apple/apple"
})
},
go_to_orange()//
{
uni.navigateTo({
url: "/pages/homepages/homes/dictionary/orange/orange"
})
},
go_to_peach()//
{
uni.navigateTo({
url: "/pages/homepages/homes/choice_book/choice_book"
})
},
go_to_watermelon()//西
{
uni.navigateTo({
url: "/pages/homepages/homes//pages/homepages/homes/dictionary/apple/apple"
})
},
}
}
</script>

@ -1,17 +0,0 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {};
}
}
</script>
<style lang="scss">
</style>

@ -1,17 +0,0 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {};
}
}
</script>
<style lang="scss">
</style>

@ -1,5 +1,18 @@
<template>
<view>
<view class="background">
<image class="go_back_button" @click="go_back" src="@/static/homepages/homes/knowledge_dictionary/pictures/go_back_button.png" ></image>
<input> </input>
<image class="search_button" @click="search" src="@/static/homepages/homes/knowledge_dictionary/pictures/search_button.png"></image>
<image class="strawberry_image" @click="go_to_strawberry" src="@/static/homepages/homes/knowledge_dictionary/pictures/strawberry.png"></image>
<image class="peach_image" @click="go_to_peach" src="@/static/homepages/homes/knowledge_dictionary/pictures/peach.png"></image>
<image class="carrot_image" @click="go_to_carrot" src="@/static/homepages/homes/knowledge_dictionary/pictures/carrot.png"></image>
<image class="pineapple_image" @click="go_to_pineapple" src="@/static/homepages/homes/knowledge_dictionary/pictures/pineapple.png"></image>
<image class="orange_image" @click="go_to_orange" src="@/static/homepages/homes/knowledge_dictionary/pictures/orange.png"></image>
<image class="banana_image" @click="go_to_banana" src="@/static/homepages/homes/knowledge_dictionary/pictures/banana.png"></image>
</view>
</template>
@ -7,11 +20,172 @@
<script>
export default {
data() {
return {};
return {
url :""//url
};
},
methods:{
search(){
// URL
uni.showToast({
title: '搜索成功!',
icon: 'none',
duration: 2000
})
uni.showToast({
title: '搜索失败,知识库知识有限哦~',
icon: 'none',
duration: 2000
})
},
go_back(){
uni.navigateTo({
url: '/pages/homepages/homes/home/home'
})
uni.showToast({
title: '正在返回主页面',
icon: 'none',
duration: 2000
})
},
go_to_strawberry(){
uni.navigateTo({
url: '/pages/homepages/homes/dictionary/strawberry/strawberry'
})
uni.showToast({
title: '正在前往草莓知识页面',
icon: 'none',
duration: 2000
})
},
go_to_peach(){
uni.navigateTo({
url: '/pages/homepages/homes/dictionary/pear/pear'
})
uni.showToast({
title: '正在前往桃子知识页面',
icon: 'none',
duration: 2000
})
},
go_to_carrot(){
uni.navigateTo({
url: '/pages/homepages/homes/dictionary/carrot/carrot'
})
uni.showToast({
title: '正在前往胡萝卜知识页面',
icon: 'none',
duration: 2000
})
},
go_to_pineapple(){
uni.navigateTo({
url: '/pages/homepages/homes/dictionary/pineapple/pineapple'
})
uni.showToast({
title: '正在前往菠萝知识页面',
icon: 'none',
duration: 2000
})
},
go_to_orange(){
uni.navigateTo({
url: '/pages/homepages/homes/dictionary/orange/orange'
})
uni.showToast({
title: '正在前往橙子知识页面',
icon: 'none',
duration: 2000
})
},
go_to_banana(){
uni.navigateTo({
url: '/pages/homepages/homes/dictionary/banana/banana'
})
uni.showToast({
title: '正在前往香蕉知识页面',
icon: 'none',
duration: 2000
})
},
}
}
</script>
<style lang="scss">
.background{
background-image: url("@/static/homepages/homes/knowledge_dictionary/pictures/background.png");
background-size: cover;
background-position: center;
height: 101vh;
display: flex;
flex-direction: column; /* 纵向排列 */
align-items: center; /* 水平居中 */
justify-content: flex-end; /* 使内容向底部对齐 */
position: relative;
}
.go_back_button{
position: absolute;
height: 8%;
width: 15%;
top: 5%;
left: 5%;
}
.search_button{
position: absolute;
height: 5%;
width: 10%;
top: 43.5%;
left: 83%;
}
.strawberry_image{
position: absolute;
height: 15%;
width: 30%;
top: 60%;
left: 2%;
}
.peach_image{
position: absolute;
height: 15%;
width: 30%;
top: 60%;
left: 34%;
}
.carrot_image{
position: absolute;
height: 15%;
width: 30%;
top: 60%;
left: 67%;
}
.pineapple_image{
position: absolute;
height: 15%;
width: 30%;
top: 78%;
left: 1%;
}
.orange_image{
position: absolute;
height: 15%;
width: 30%;
top: 78%;
left: 34%;
}
.banana_image{
position: absolute;
height: 15%;
width: 30%;
top: 78%;
left: 67%;
}
</style>

@ -85,10 +85,10 @@ export default {
//
const userMessageCount = this.send_messages.filter(msg => msg.sender === 'user').length;
if (userMessageCount >= 2) {
if (userMessageCount >= 1) {
// 2
uni.showToast({
title: "AI 可是要交钱的哦,最多发送两条消息",
title: "AI 可是要交钱的哦,最多发送1条消息,刷新之后再试试吧~",
icon: "none",
});
} else {

@ -36,7 +36,7 @@ export default {
<style lang="scss">
.background{
background-image: url("/static/homepages/user/basic_information/img.png");
background-image: url("@/static/homepages/user/basic_information/img.png");
background-size: cover;
background-position: center;
height: 100vh;
@ -47,7 +47,7 @@ export default {
position: relative;
}
.self_back{
background-image: url("/static/homepages/user/basic_information/back.png");
background-image: url("@/static/homepages/user/basic_information/back.png");
background-size: cover;
flex:1;
height: 80vh;
@ -76,7 +76,6 @@ export default {
flex:1;
align-items: center;
position: absolute;
height: 36vh;
width: 45vh;
right: 10.5%;
bottom: 23%;

@ -1,20 +1,4 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {};
}
}
</script>
<style lang="scss">
</style>
<template>
<view>
<image class="background" src="/static/homepages/user/bmi_information/pictures/background.png"></image>

@ -17,7 +17,6 @@
<image class="submit_button" @click="submit()" src="/static/homepages/user/exercise_plans/pictures/submit_button.png"></image>
</view>
</template>
<script>
export default {
data() {

@ -55,7 +55,6 @@ export default {
justify-content: center;
overflow: hidden;
position: relative;
border: 2px solid #0c0b0b ;
}
.head_pic{
position: absolute;

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

@ -4,6 +4,7 @@
height: 75%;
top: 4%;
z-index: -3;
}
.chat {
@ -19,7 +20,6 @@
flex-direction: column; /* 消息从上往下显示 */
}
.chat_area {
margin-bottom: 10px;
padding: 10px;
@ -30,18 +30,15 @@
flex-direction: row; /* 头像和消息水平排列 */
align-items: center; /* 内容垂直居中 */
}
.user_message {
background-color: #7879F1; /* 用户消息气泡背景色 */
color: white;
margin-top: 22%; /* 让用户的消息气泡靠右 */
margin-top: 2%; /* 让用户的消息气泡靠右 */
margin-right: 5%; /* AI消息靠左 */
margin-left: auto; /* 让AI的消息气泡靠右 */
text-align: left;
word-break: break-word; /* 自动换行 */
}
.ai_message {
background-color: #e5e5ea; /* AI消息气泡背景色 */
color: black;
@ -50,40 +47,33 @@
text-align: left;
word-break: break-word; /* 自动换行 */
}
.avatar_container {
display: flex;
right: 10%;
justify-content: center;
align-items: center;
}
.ai_avatar_container {
margin-right: 10px; /* AI头像与气泡的间距 */
}
.user_avatar_container {
margin-left: 10px; /* 用户头像与气泡的间距 */
}
.ai_avatar, .user_avatar {
right: 5%;
width: 40px; /* 头像的大小 */
height: 40px; /* 头像的大小 */
border-radius: 50%; /* 头像圆形 */
}
.message_content {
max-width: 80%; /* 限制消息气泡的最大宽度 */
}
.input_box {
position: absolute;
position: fixed;
width: 100%;
height: 9%;
top: 79%;
}
.input_box_background {
position: absolute;
width: 98%;
@ -91,7 +81,6 @@
left: 1%;
top: 5%;
}
.input_words {
position: absolute;
width: 70%;
@ -99,7 +88,6 @@
left: 5%;
top: 10%;
}
.send_button {
position: absolute;
width: 12%;

Loading…
Cancel
Save