Skip to content

Commit 8851e60

Browse files
committed
🧹 Fix chat layout issues and improve message clarity
- Remove duplicate system messages from conversation view - Fix border stacking by removing problematic borderBottom styles - Position user messages on right (marginLeft: auto) and AI on left - Add consistent rounded corners (12px) to all message types - Set messages to 85% width for better readability and attribution - Clean up logic for welcome screen vs conversation view transitions - Filter system messages properly throughout the interface ✨ Much cleaner conversation flow with clear message attribution
1 parent d388a9c commit 8851e60

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

src/index.ts

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,8 @@ export default {
11041104
const MessageComponent = ({ message }) => {
11051105
const getMessageStyle = (type) => {
11061106
const base = {
1107-
padding: '24px',
1108-
marginBottom: '0',
1109-
maxWidth: '100%',
1107+
padding: '16px 24px',
1108+
marginBottom: '16px',
11101109
lineHeight: '1.6',
11111110
fontSize: '16px'
11121111
};
@@ -1117,25 +1116,20 @@ export default {
11171116
...base,
11181117
background: '#2c2e33',
11191118
color: '#c1c2c5',
1120-
borderBottom: '1px solid #373a40'
1119+
borderRadius: '12px',
1120+
maxWidth: '85%',
1121+
marginLeft: 'auto',
1122+
marginRight: '0'
11211123
};
11221124
case 'assistant':
11231125
return {
11241126
...base,
1125-
background: '#1a1b1e',
1127+
background: '#25262b',
11261128
color: '#c1c2c5',
1127-
borderBottom: '1px solid #373a40'
1128-
};
1129-
case 'system':
1130-
return {
1131-
...base,
1132-
background: '#1e3a5f',
1133-
color: '#339af0',
1134-
border: '1px solid #339af0',
1135-
fontStyle: 'italic',
1136-
textAlign: 'center',
11371129
borderRadius: '12px',
1138-
margin: '16px 0'
1130+
maxWidth: '85%',
1131+
marginLeft: '0',
1132+
marginRight: 'auto'
11391133
};
11401134
case 'thinking':
11411135
return {
@@ -1145,7 +1139,9 @@ export default {
11451139
border: '1px solid #fab005',
11461140
fontStyle: 'italic',
11471141
borderRadius: '8px',
1148-
margin: '16px 0'
1142+
maxWidth: '85%',
1143+
marginLeft: '0',
1144+
marginRight: 'auto'
11491145
};
11501146
case 'error':
11511147
return {
@@ -1154,7 +1150,9 @@ export default {
11541150
color: '#ff6b6b',
11551151
border: '1px solid #e03131',
11561152
borderRadius: '8px',
1157-
margin: '16px 0'
1153+
maxWidth: '85%',
1154+
marginLeft: '0',
1155+
marginRight: 'auto'
11581156
};
11591157
default:
11601158
return base;
@@ -1189,13 +1187,19 @@ export default {
11891187
return content;
11901188
};
11911189
1190+
// Don't render system messages in conversation view
1191+
if (message.type === 'system') {
1192+
return null;
1193+
}
1194+
11921195
return (
1193-
<div style={getMessageStyle(message.type)}>
1194-
<div style={{
1195-
maxWidth: '800px',
1196-
margin: '0 auto',
1197-
width: '100%'
1198-
}}>
1196+
<div style={{
1197+
maxWidth: '800px',
1198+
margin: '0 auto',
1199+
width: '100%',
1200+
padding: '0 24px'
1201+
}}>
1202+
<div style={getMessageStyle(message.type)}>
11991203
{message.type === 'assistant' ? (
12001204
<div dangerouslySetInnerHTML={renderContent(message.content, message.type)} />
12011205
) : (
@@ -1250,7 +1254,7 @@ export default {
12501254
padding: '0 24px'
12511255
}}>
12521256
<ScrollArea style={{ flex: 1 }}>
1253-
{messages.length === 1 && messages[0].type === 'system' ? (
1257+
{messages.filter(msg => msg.type !== 'system').length === 0 ? (
12541258
// Welcome screen when no messages - centered like ChatGPT
12551259
<div style={{
12561260
display: 'flex',
@@ -1440,7 +1444,7 @@ export default {
14401444
) : (
14411445
// Regular chat messages
14421446
<div style={{ padding: '24px 0' }}>
1443-
{messages.map((message) => (
1447+
{messages.filter(msg => msg.type !== 'system').map((message) => (
14441448
<MessageComponent key={message.id || Math.random()} message={message} />
14451449
))}
14461450
<div ref={messagesEndRef} />
@@ -1450,7 +1454,7 @@ export default {
14501454
</div>
14511455
14521456
{/* Input Area for active conversations */}
1453-
{messages.length > 1 || (messages.length === 1 && messages[0].type !== 'system') ? (
1457+
{messages.filter(msg => msg.type !== 'system').length > 0 ? (
14541458
<div style={{
14551459
padding: '16px 24px 24px',
14561460
borderTop: '1px solid #373a40',

0 commit comments

Comments
 (0)