Spaces:
Sleeping
Sleeping
matt HOFFNER
commited on
Commit
·
fc7da9f
1
Parent(s):
c3a76e1
cleaning up styles
Browse files- app/page.module.css +30 -5
- app/page.tsx +28 -24
app/page.module.css
CHANGED
@@ -329,6 +329,7 @@
|
|
329 |
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
330 |
color: #333;
|
331 |
overflow: hidden; /* Prevents text from overflowing */
|
|
|
332 |
}
|
333 |
|
334 |
.message-content {
|
@@ -412,14 +413,38 @@
|
|
412 |
.avatar {
|
413 |
display: inline-block;
|
414 |
vertical-align: middle;
|
415 |
-
|
416 |
-
height: 40px;
|
417 |
-
|
418 |
-
|
419 |
-
margin-right: 10px;
|
420 |
}
|
421 |
|
422 |
@keyframes moveClouds {
|
423 |
0% { background-position: 0 0; }
|
424 |
100% { background-position: 1000px 500px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
}
|
|
|
329 |
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
330 |
color: #333;
|
331 |
overflow: hidden; /* Prevents text from overflowing */
|
332 |
+
gap: 20px; /* Space between avatar and text */
|
333 |
}
|
334 |
|
335 |
.message-content {
|
|
|
413 |
.avatar {
|
414 |
display: inline-block;
|
415 |
vertical-align: middle;
|
416 |
+
flex-shrink: 0; /* Prevents the avatar from shrinking */
|
|
|
|
|
|
|
|
|
417 |
}
|
418 |
|
419 |
@keyframes moveClouds {
|
420 |
0% { background-position: 0 0; }
|
421 |
100% { background-position: 1000px 500px; }
|
422 |
+
}
|
423 |
+
|
424 |
+
.message-content-container {
|
425 |
+
flex: 1;
|
426 |
+
padding-left: 10px; /* Adjust as necessary */
|
427 |
+
overflow: hidden; /* Prevents overflow */
|
428 |
+
}
|
429 |
+
|
430 |
+
.message-content {
|
431 |
+
word-break: break-word; /* Ensures long words don't cause overflow */
|
432 |
+
}
|
433 |
+
|
434 |
+
@media (max-width: 768px) {
|
435 |
+
.message-content-container {
|
436 |
+
padding-left: 5px; /* Smaller padding for smaller screens */
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
@media (max-width: 768px) {
|
441 |
+
.message-text {
|
442 |
+
margin-right: 5px;
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
+
.message-text {
|
447 |
+
flex-grow: 1;
|
448 |
+
overflow-wrap: break-word;
|
449 |
+
margin-right: 10px; /* Adjust as necessary */
|
450 |
}
|
app/page.tsx
CHANGED
@@ -80,16 +80,18 @@ const Page: React.FC = () => {
|
|
80 |
bgColor: "bg-white",
|
81 |
avatarColor: "bg-black",
|
82 |
dialogComponent: (message: Message) => (
|
83 |
-
<
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
93 |
),
|
94 |
},
|
95 |
assistant: {
|
@@ -97,16 +99,18 @@ const Page: React.FC = () => {
|
|
97 |
bgColor: "bg-gray-100",
|
98 |
avatarColor: "bg-green-500",
|
99 |
dialogComponent: (message: Message) => (
|
100 |
-
<
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
110 |
),
|
111 |
},
|
112 |
function: {
|
@@ -138,8 +142,7 @@ const Page: React.FC = () => {
|
|
138 |
<div className={styles.avatar}>
|
139 |
{roleUIConfig[message.role].avatar}
|
140 |
</div>
|
141 |
-
|
142 |
-
{message.content === "" && message.function_call != undefined ? (
|
143 |
typeof message.function_call === "object" ? (
|
144 |
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
145 |
<div>
|
@@ -157,9 +160,10 @@ const Page: React.FC = () => {
|
|
157 |
<div className="function-call">{message.function_call}</div>
|
158 |
)
|
159 |
) : (
|
160 |
-
|
|
|
|
|
161 |
)}
|
162 |
-
</div>
|
163 |
</div>
|
164 |
);
|
165 |
})
|
|
|
80 |
bgColor: "bg-white",
|
81 |
avatarColor: "bg-black",
|
82 |
dialogComponent: (message: Message) => (
|
83 |
+
<div className="message-content-container">
|
84 |
+
<ReactMarkdown
|
85 |
+
className=""
|
86 |
+
components={{
|
87 |
+
a: (props) => (
|
88 |
+
<a {...props} target="_blank" rel="noopener noreferrer" />
|
89 |
+
),
|
90 |
+
}}
|
91 |
+
>
|
92 |
+
{message.content}
|
93 |
+
</ReactMarkdown>
|
94 |
+
</div>
|
95 |
),
|
96 |
},
|
97 |
assistant: {
|
|
|
99 |
bgColor: "bg-gray-100",
|
100 |
avatarColor: "bg-green-500",
|
101 |
dialogComponent: (message: Message) => (
|
102 |
+
<div className="message-content-container">
|
103 |
+
<ReactMarkdown
|
104 |
+
className=""
|
105 |
+
components={{
|
106 |
+
a: (props) => (
|
107 |
+
<a {...props} target="_blank" rel="noopener noreferrer" />
|
108 |
+
),
|
109 |
+
}}
|
110 |
+
>
|
111 |
+
{message.content}
|
112 |
+
</ReactMarkdown>
|
113 |
+
</div>
|
114 |
),
|
115 |
},
|
116 |
function: {
|
|
|
142 |
<div className={styles.avatar}>
|
143 |
{roleUIConfig[message.role].avatar}
|
144 |
</div>
|
145 |
+
{message.content === "" && message.function_call != undefined ? (
|
|
|
146 |
typeof message.function_call === "object" ? (
|
147 |
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
148 |
<div>
|
|
|
160 |
<div className="function-call">{message.function_call}</div>
|
161 |
)
|
162 |
) : (
|
163 |
+
<div className="message-text">
|
164 |
+
{roleUIConfig[message.role].dialogComponent(message)}
|
165 |
+
</div>
|
166 |
)}
|
|
|
167 |
</div>
|
168 |
);
|
169 |
})
|