matt HOFFNER
commited on
Commit
·
5935dee
1
Parent(s):
1f55d89
cleanup
Browse files- app/page.module.css +28 -16
- app/page.tsx +26 -23
- app/tools/odds.ts +0 -1
app/page.module.css
CHANGED
|
@@ -291,7 +291,6 @@
|
|
| 291 |
.main {
|
| 292 |
display: flex;
|
| 293 |
flex-direction: column;
|
| 294 |
-
height: 100vh;
|
| 295 |
justify-content: space-between;
|
| 296 |
padding: 2rem;
|
| 297 |
}
|
|
@@ -310,26 +309,28 @@
|
|
| 310 |
}
|
| 311 |
|
| 312 |
.message {
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
padding: 10px
|
| 316 |
-
margin:
|
| 317 |
-
|
| 318 |
-
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
|
|
|
|
|
|
|
|
|
| 324 |
}
|
| 325 |
|
| 326 |
-
/* Avatar styles */
|
| 327 |
.avatar {
|
| 328 |
-
width: 40px;
|
| 329 |
-
height: 40px;
|
| 330 |
-
border-radius: 50%;
|
| 331 |
-
background-color: #ccc;
|
| 332 |
margin-right: 10px;
|
|
|
|
| 333 |
}
|
| 334 |
|
| 335 |
/* Style for function call messages */
|
|
@@ -396,4 +397,15 @@
|
|
| 396 |
/* In your CSS file */
|
| 397 |
.avatar-user {
|
| 398 |
width: 20px; /* Based on Tailwind's width setting */
|
| 399 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
.main {
|
| 292 |
display: flex;
|
| 293 |
flex-direction: column;
|
|
|
|
| 294 |
justify-content: space-between;
|
| 295 |
padding: 2rem;
|
| 296 |
}
|
|
|
|
| 309 |
}
|
| 310 |
|
| 311 |
.message {
|
| 312 |
+
display: flex;
|
| 313 |
+
align-items: center;
|
| 314 |
+
padding: 10px;
|
| 315 |
+
margin-bottom: 10px;
|
| 316 |
+
border-radius: 5px;
|
| 317 |
+
background: linear-gradient(180deg, #a8a8a8 0%, #8b8b8b 50%, #a8a8a8 100%);
|
| 318 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
| 319 |
+
color: #333;
|
| 320 |
+
overflow: hidden; /* Prevents text from overflowing */
|
| 321 |
}
|
| 322 |
|
| 323 |
+
.message-content {
|
| 324 |
+
flex: 1;
|
| 325 |
+
margin-right: 10px; /* Adjust as needed */
|
| 326 |
+
overflow: hidden; /* Prevents text from overflowing */
|
| 327 |
+
text-overflow: ellipsis; /* Adds an ellipsis to text that overflows */
|
| 328 |
+
white-space: nowrap; /* Keeps the text on a single line */
|
| 329 |
}
|
| 330 |
|
|
|
|
| 331 |
.avatar {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
margin-right: 10px;
|
| 333 |
+
/* Ensure you have width, height, and other necessary styles here */
|
| 334 |
}
|
| 335 |
|
| 336 |
/* Style for function call messages */
|
|
|
|
| 397 |
/* In your CSS file */
|
| 398 |
.avatar-user {
|
| 399 |
width: 20px; /* Based on Tailwind's width setting */
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
.avatar {
|
| 403 |
+
display: inline-block;
|
| 404 |
+
vertical-align: middle;
|
| 405 |
+
width: 40px;
|
| 406 |
+
height: 40px;
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
margin-right: 10px;
|
| 410 |
+
}
|
| 411 |
+
|
app/page.tsx
CHANGED
|
@@ -124,35 +124,38 @@ const Page: React.FC = () => {
|
|
| 124 |
<div className={styles.messages}>
|
| 125 |
{messages.length > 0 ? (
|
| 126 |
messages.map((message, i) => {
|
| 127 |
-
const messageClass =
|
| 128 |
return (
|
| 129 |
-
<div key={i} className={messageClass}>
|
| 130 |
-
<div className=
|
| 131 |
{roleUIConfig[message.role].avatar}
|
| 132 |
</div>
|
| 133 |
-
{
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
<div>
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
</div>
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
</div>
|
| 147 |
) : (
|
| 148 |
-
|
| 149 |
-
)
|
| 150 |
-
|
| 151 |
-
roleUIConfig[message.role].dialogComponent(message)
|
| 152 |
-
)}
|
| 153 |
</div>
|
| 154 |
);
|
| 155 |
-
|
|
|
|
| 156 |
</div>
|
| 157 |
<form onSubmit={handleSubmit} className={styles.form}>
|
| 158 |
<input
|
|
@@ -168,6 +171,6 @@ const Page: React.FC = () => {
|
|
| 168 |
</form>
|
| 169 |
</main>
|
| 170 |
);
|
| 171 |
-
}
|
| 172 |
|
| 173 |
export default Page;
|
|
|
|
| 124 |
<div className={styles.messages}>
|
| 125 |
{messages.length > 0 ? (
|
| 126 |
messages.map((message, i) => {
|
| 127 |
+
const messageClass = `${styles.message} ${message.role === 'user' ? styles['message-user'] : ''}`;
|
| 128 |
return (
|
| 129 |
+
<div key={i} className={messageClass} style={{ display: 'flex', alignItems: 'center' }}>
|
| 130 |
+
<div className={styles.avatar}>
|
| 131 |
{roleUIConfig[message.role].avatar}
|
| 132 |
</div>
|
| 133 |
+
<div style={{ flex: 1 }}>
|
| 134 |
+
{message.content === "" && message.function_call != undefined ? (
|
| 135 |
+
typeof message.function_call === "object" ? (
|
| 136 |
+
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
| 137 |
+
<div>
|
| 138 |
+
Using{" "}
|
| 139 |
+
<span className="font-bold">
|
| 140 |
+
{message.function_call.name}
|
| 141 |
+
</span>{" "}
|
| 142 |
+
...
|
| 143 |
+
</div>
|
| 144 |
+
<div>
|
| 145 |
+
{message.function_call.arguments}
|
| 146 |
+
</div>
|
| 147 |
</div>
|
| 148 |
+
) : (
|
| 149 |
+
<div className="function-call">{message.function_call}</div>
|
| 150 |
+
)
|
|
|
|
| 151 |
) : (
|
| 152 |
+
roleUIConfig[message.role].dialogComponent(message)
|
| 153 |
+
)}
|
| 154 |
+
</div>
|
|
|
|
|
|
|
| 155 |
</div>
|
| 156 |
);
|
| 157 |
+
})
|
| 158 |
+
) : null}
|
| 159 |
</div>
|
| 160 |
<form onSubmit={handleSubmit} className={styles.form}>
|
| 161 |
<input
|
|
|
|
| 171 |
</form>
|
| 172 |
</main>
|
| 173 |
);
|
| 174 |
+
}
|
| 175 |
|
| 176 |
export default Page;
|
app/tools/odds.ts
CHANGED
|
@@ -35,7 +35,6 @@ function createOddsApi({ apiKey }: { apiKey: string }) {
|
|
| 35 |
}
|
| 36 |
const activeSports = await fetch(`https://api.the-odds-api.com/v4/sports/${sportKey}/odds?apiKey=${apiKey}&oddsFormat=${oddsFormat}&dateFormat=${dateFormat}&market=${market}®ions=${regions}`);
|
| 37 |
const oddsResponse = await activeSports.json();
|
| 38 |
-
console.log(oddsResponse);
|
| 39 |
return JSON.stringify(oddsResponse);
|
| 40 |
} catch (error) {
|
| 41 |
throw new Error(`Error in oddsApi: ${error}`);
|
|
|
|
| 35 |
}
|
| 36 |
const activeSports = await fetch(`https://api.the-odds-api.com/v4/sports/${sportKey}/odds?apiKey=${apiKey}&oddsFormat=${oddsFormat}&dateFormat=${dateFormat}&market=${market}®ions=${regions}`);
|
| 37 |
const oddsResponse = await activeSports.json();
|
|
|
|
| 38 |
return JSON.stringify(oddsResponse);
|
| 39 |
} catch (error) {
|
| 40 |
throw new Error(`Error in oddsApi: ${error}`);
|