修改AI聊天部分

master
Gary 1 month ago
parent d8d79bacc6
commit 7f46b731a0

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

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

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

@ -7,8 +7,45 @@
<script> <script>
export default { export default {
data() { 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> </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> <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> </view>
</template> </template>
@ -7,11 +20,172 @@
<script> <script>
export default { export default {
data() { 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> </script>
<style lang="scss"> <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> </style>

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

@ -36,7 +36,7 @@ export default {
<style lang="scss"> <style lang="scss">
.background{ .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-size: cover;
background-position: center; background-position: center;
height: 100vh; height: 100vh;
@ -47,7 +47,7 @@ export default {
position: relative; position: relative;
} }
.self_back{ .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; background-size: cover;
flex:1; flex:1;
height: 80vh; height: 80vh;
@ -76,7 +76,6 @@ export default {
flex:1; flex:1;
align-items: center; align-items: center;
position: absolute; position: absolute;
height: 36vh;
width: 45vh; width: 45vh;
right: 10.5%; right: 10.5%;
bottom: 23%; bottom: 23%;

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

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

Loading…
Cancel
Save