Skip to content

Commit

Permalink
Update : gpt api 응답값 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JangGusWjd committed Aug 1, 2024
1 parent bea655e commit 8af67ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/components/mentoring/MenteeChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import axios from "axios";
interface ChatMessage {
sender: "me" | "gpt";
text: string;
question: string;
time: string;
}

Expand All @@ -29,7 +30,7 @@ const MenteeChat = () => {

setChatMessages((prevMessages) => [
...prevMessages,
{ sender: "me", text: message, time: currentTime },
{ sender: "me", text: message, time: currentTime, question: "" },
]);
const userMessage = message;
setMessage("");
Expand Down Expand Up @@ -59,8 +60,9 @@ const MenteeChat = () => {
...prevMessages,
{
sender: "gpt",
text: response.data.chat_response,
text: response.data.gpt_response,
time: replyTime,
question: response.data.question,
},
]);
} else {
Expand Down Expand Up @@ -97,7 +99,10 @@ const MenteeChat = () => {
</>
) : (
<>
<p>{msg.text}</p>
<div>
<p>{msg.text}</p>
<p className="balloon">{msg.question}</p>
</div>
<span className="message-time">{msg.time}</span>
</>
)}
Expand Down
11 changes: 10 additions & 1 deletion src/styles/mentoring/MenteeChat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,19 @@
color: #1b1c3a;
border-radius: 10px;
padding: 5px 10px;
margin-bottom: 5px;
}
.balloon {
background: #d9d9d9;
color: #1b1c3a;
border-radius: 10px;
padding: 5px 10px;
margin-bottom: 5px;
position: relative;
}
}

.gpt-message::after {
.balloon::after {
content: "";
position: absolute;
top: 50%;
Expand Down

0 comments on commit 8af67ed

Please sign in to comment.