Skip to content

Commit

Permalink
Merge pull request #28 from kim3ho1/main
Browse files Browse the repository at this point in the history
dd
  • Loading branch information
jinho7 authored Jan 11, 2024
2 parents b9f6bf8 + 58a1981 commit f944287
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 65 deletions.
14 changes: 7 additions & 7 deletions add.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<a
class="sidebar-brand d-flex align-items-center justify-content-center"
style="flex-direction: column"
href="index.html"
href="index"
>
<div class="sidebar-brand-icon">
<img src="img/logo.png" alt="Your Logo" />
Expand All @@ -60,18 +60,18 @@

<li class="nav-item">
<!-- 단백질 정보 -->
<a class="nav-link" href="index.html">
<a class="nav-link" href="index">
<i class="fas fa-fw fa-tachometer-alt"></i>
<span id="username2">회원 님</span>
<span>의 단백질 정보</span>
</a>
<!-- 레포트 -->
<a class="nav-link" href="report.html">
<a class="nav-link" href="report">
<i class="fas fa-fw fa-file-alt"></i>
<span>레포트</span></a
>
<!-- 레시피 -->
<a class="nav-link" href="index.html">
<a class="nav-link" href="index">
<i class="fas fa-fw fa-utensils"></i>
<span>레시피</span></a
>
Expand All @@ -85,7 +85,7 @@

<!-- Nav Item - Charts -->
<li class="nav-item">
<a class="nav-link" href="mypage.html">
<a class="nav-link" href="mypage">
<i class="fas fa-fw fa-chart-area"></i>
<span>마이 페이지</span></a
>
Expand Down Expand Up @@ -178,7 +178,7 @@
class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
aria-labelledby="userDropdown"
>
<a class="dropdown-item" href="mypage.html">
<a class="dropdown-item" href="mypage">
<i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
마이 페이지
</a>
Expand Down Expand Up @@ -291,7 +291,7 @@ <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
>
Cancel
</button>
<a class="btn btn-primary" href="login.html">Logout</a>
<a class="btn btn-primary" href="login">Logout</a>
</div>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<a
class="sidebar-brand d-flex align-items-center justify-content-center"
style="flex-direction: column;"
href="index.html"
href="index"
>
<div class="sidebar-brand-icon">
<img src="img/logo.png" alt="Your Logo">
Expand All @@ -60,18 +60,18 @@

<li class="nav-item">
<!-- 단백질 정보 -->
<a class="nav-link" href="index.html">
<a class="nav-link" href="index">
<i class="fas fa-fw fa-tachometer-alt"></i>
<span id="username2">회원 님</span>
<span>의 단백질 정보</span>
</a>
<!-- 레포트 -->
<a class="nav-link" href="report.html">
<a class="nav-link" href="report">
<i class="fas fa-fw fa-file-alt"></i>
<span>레포트</span></a
>
<!-- 레시피 -->
<a class="nav-link" href="index.html">
<a class="nav-link" href="index">
<i class="fas fa-fw fa-utensils"></i>
<span>레시피</span></a
>
Expand All @@ -85,7 +85,7 @@

<!-- Nav Item - Charts -->
<li class="nav-item">
<a class="nav-link" href="mypage.html">
<a class="nav-link" href="mypage">
<i class="fas fa-fw fa-chart-area"></i>
<span>마이 페이지</span></a
>
Expand Down Expand Up @@ -171,7 +171,7 @@
class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
aria-labelledby="userDropdown"
>
<a class="dropdown-item" href="mypage.html">
<a class="dropdown-item" href="mypage">
<i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
마이 페이지
</a>
Expand Down Expand Up @@ -237,7 +237,7 @@ <h1 class="h3 mb-0 text-gray-800" style="font-family: 'Noto Sans KR', sans-serif
</div>

<div class="col text-right">
<a href="add.html" class="btn btn-primary">
<a href="add" class="btn btn-primary">
<i class="fas fa-plus-circle fa-sm text-white-50"></i>
음식 추가하기
</a>
Expand Down Expand Up @@ -280,7 +280,7 @@ <h6 class="m-0 font-weight-bold text-primary">
<!-- Report -->
<div class="row justify-content-center">
<div class="col-lg-3 mb-4">
<a href="report.html" id="diagnoseButton" class="btn card bg-warning text-white shadow">
<a href="report" id="diagnoseButton" class="btn card bg-warning text-white shadow">
<div class="card-body">
<div class="text-xs font-weight-bold" style="font-size: medium">
진단하기
Expand Down Expand Up @@ -361,7 +361,7 @@ <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
>
Cancel
</button>
<a class="btn btn-primary" href="login.html">Logout</a>
<a class="btn btn-primary" href="login">Logout</a>
</div>
</div>
</div>
Expand Down
64 changes: 55 additions & 9 deletions js/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@ $(function(){
.catch(error => {
console.error("에러 발생:", error);
});






//fetch 해야함


}
});

Expand Down Expand Up @@ -111,3 +102,58 @@ function ai_chat(msg){
$(".chat_wrap .inner").stop().animate({scrollTop:position},500);
}

function getPlanAdvice(){
fetch("https://api.yourprotein.shop/gpt/total", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization" : "Bearer " + getCookie("accessToken")
}
})
.then(response => {
// 응답이 성공적으로 받아지면 JSON 형식으로 파싱합니다.
if (!response.ok) {
// window.location.replace(SERVER_DOMAIN+ "/login.html")
}
return response.json();
})
// .then(response => response.json()) // 응답을 JSON 형식으로 파싱
.then(data => {
console.log("서버 응답:", data);
// 여기에서 서버 응답을 처리할 수 있습니다.
document.getElementById("1_loading").remove();
document.getElementById("advice_1").innerText = data.messages[0].message
})
.catch(error => {
console.error("에러 발생:", error);
});
}

function getTotalAdvice(){
fetch("https://api.yourprotein.shop/gpt/plan", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization" : "Bearer " + getCookie("accessToken")
}
})
.then(response => {
// 응답이 성공적으로 받아지면 JSON 형식으로 파싱합니다.
if (!response.ok) {
// window.location.replace(SERVER_DOMAIN+ "/login.html")
}
return response.json();
})
// .then(response => response.json()) // 응답을 JSON 형식으로 파싱
.then(data => {
console.log("서버 응답:", data);
// 여기에서 서버 응답을 처리할 수 있습니다.
document.getElementById("2_loading").remove();
document.getElementById("advice_2").innerText = data.messages[0].message
})
.catch(error => {
console.error("에러 발생:", error);
});
}
getTotalAdvice();
getPlanAdvice();
2 changes: 1 addition & 1 deletion login.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div class="col align-items-center flex-col sign-in">
<div class="form-wrapper align-items-center">
<div class="form sign-in">
<a id="kakao-login-btn" onclick="toggle()" style="cursor: pointer;" href="https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=3d93f617a4d6fc388877925283f37797&redirect_uri=https://yourprotein.shop/login.html">
<a id="kakao-login-btn" onclick="toggle()" style="cursor: pointer;" href="https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=3d93f617a4d6fc388877925283f37797&redirect_uri=https://yourprotein.shop/login">
<img src="/img/kako_login.png" width="auto"
alt="카카오 로그인" />
</a>
Expand Down
52 changes: 13 additions & 39 deletions report.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<a
class="sidebar-brand d-flex align-items-center justify-content-center"
style="flex-direction: column"
href="index.html"
href="index"
>
<div class="sidebar-brand-icon">
<img src="img/logo.png" alt="Your Logo" />
Expand All @@ -69,18 +69,18 @@

<li class="nav-item">
<!-- 단백질 정보 -->
<a class="nav-link" href="index.html">
<a class="nav-link" href="index">
<i class="fas fa-fw fa-tachometer-alt"></i>
<span id="username2">회원 님</span>
<span>의 단백질 정보</span>
</a>
<!-- 레포트 -->
<a class="nav-link" href="report.html">
<a class="nav-link" href="report">
<i class="fas fa-fw fa-file-alt"></i>
<span>레포트</span></a
>
<!-- 레시피 -->
<a class="nav-link" href="index.html">
<a class="nav-link" href="index">
<i class="fas fa-fw fa-utensils"></i>
<span>레시피</span></a
>
Expand All @@ -94,7 +94,7 @@

<!-- Nav Item - Charts -->
<li class="nav-item">
<a class="nav-link" href="mypage.html">
<a class="nav-link" href="mypage">
<i class="fas fa-fw fa-chart-area"></i>
<span>마이 페이지</span></a
>
Expand Down Expand Up @@ -187,7 +187,7 @@
class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
aria-labelledby="userDropdown"
>
<a class="dropdown-item" href="mypage.html">
<a class="dropdown-item" href="mypage">
<i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
마이 페이지
</a>
Expand All @@ -211,29 +211,6 @@
<!-- End of Topbar -->
<!-- Content Row -->
<div class="row justify-content-center">
<!-- Protein Intake Card -->
<div class="col-xl-8 col-md-6 mb-4">
<div class="card border-left-primary shadow h-100 py-2">
<div class="card-body" style="margin-bottom: -1rem">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div
class="h3 text-s font-weight-bold text-primary text-uppercase mb-3"
>
당신의 프로틴 섭취
</div>
<div class="mb-0 font-weight-light text-gray-800">
<!-- 여기에 실제 단백질 섭취량과 목표를 표시 -->
<span id="advice_1"
>
<img id="1_loading" src="/img/loading.gif" alt="" style="height: 20px;">
</span>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- Protein Intake Card -->
<div class="col-xl-8 col-md-6 mb-4">
Expand All @@ -244,12 +221,11 @@
<div
class="h3 text-s font-weight-bold text-primary text-uppercase mb-3"
>
당신의 영양소 균형
AI 계획 조언
</div>
<div class="mb-0 font-weight-light text-gray-800">
<!-- 여기에 실제 단백질 섭취량과 목표를 표시 -->
<span id="advice_1"
><img id="2_loading" src="/img/loading.gif" alt="" style="height: 20px;">
<span id="advice_1"><img id="1_loading" src="/img/loading.gif" alt="" style="height: 20px;">
</span>
</div>
</div>
Expand All @@ -268,14 +244,12 @@
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div
class="h3 text-s font-weight-bold text-primary text-uppercase mb-3"
>
통합 조언
class="h3 text-s font-weight-bold text-primary text-uppercase mb-3">
AI 통합 조언
</div>
<div class="mb-0 font-weight-light text-gray-800">
<!-- 여기에 실제 단백질 섭취량과 목표를 표시 -->
<span id="advice_1"
><img id="3_loading" src="/img/loading.gif" alt="" style="height: 20px;">
<span id="advice_2"><img id="2_loading" src="/img/loading.gif" alt="" style="height: 20px;">
</span>
</div>
</div>
Expand All @@ -298,7 +272,7 @@
onclick="talk_ai_open()"
style="cursor: pointer"
>
AI에게 조언하기
AI에게 조언 구하기
<i id="talk_ai_i" class="fas fa-angle-right"></i>
</div>

Expand Down Expand Up @@ -374,7 +348,7 @@ <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
>
Cancel
</button>
<a class="btn btn-primary" href="login.html">Logout</a>
<a class="btn btn-primary" href="login">Logout</a>
</div>
</div>
</div>
Expand Down

0 comments on commit f944287

Please sign in to comment.