Skip to content

Commit 6d19f3e

Browse files
committed
Fix: User Message overflow when its too long
1 parent 0843099 commit 6d19f3e

10 files changed

+91
-200
lines changed

INSTALLATION.md

Lines changed: 0 additions & 146 deletions
This file was deleted.

README.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@
55
66
![TensorBlock Studio Banner](https://github.com/TensorBlock/TensorBlock-Studio/blob/dev-production-milestone%231/docs/imgs/TensorBlock%20Studio%20Banner.png?raw=true)
77

8-
---
9-
108
## What Makes TensorBlock Studio Different?
119

1210
Forget generic AI chat tools. **TensorBlock Studio** is a new kind of workspace — one that's lightweight, developer-friendly, and yet welcoming to beginners. It's designed around control, clarity, and creation.
1311

14-
---
15-
1612
## Features
1713

1814
- Multiple LLM provider
@@ -30,19 +26,15 @@ Forget generic AI chat tools. **TensorBlock Studio** is a new kind of workspace
3026

3127
---
3228

33-
## Short-Term Roadmap
29+
# Short-Term Roadmap
3430

3531
- Sharing and exports
3632
- Collection of knowledge pieces
3733
- Mobile-friendly UI (PWA or native shell)
3834
- Plugin system for extensions and custom logic
3935
- More themes
4036

41-
---
42-
43-
[TODO: 完善以下所有内容]
44-
45-
## Tech Stack
37+
# Tech Stack
4638

4739
- Framework: Next.js 14
4840
- UI: Tailwind CSS + ShadCN + Framer Motion
@@ -53,33 +45,55 @@ Forget generic AI chat tools. **TensorBlock Studio** is a new kind of workspace
5345

5446
---
5547

56-
## Getting Started
48+
# Getting Started
49+
50+
### Installation
51+
52+
1. Clone the repository:
53+
```bash
54+
git clone https://github.com/TensorBlock/TensorBlock-Studio.git
55+
cd tensorblock-studio
56+
```
57+
58+
2. Install dependencies:
59+
```bash
60+
npm install
61+
```
62+
63+
### Development
64+
65+
Run the application in development mode:
5766

5867
```bash
59-
git clone https://github.com/your-org/tensorblock-studio.git
60-
cd tensorblock-studio
61-
pnpm install
62-
pnpm dev
68+
npm run dev
69+
```
70+
71+
### Building for Production
72+
73+
Package the application for your current platform:
74+
75+
```bash
76+
npm run electron:build:current_platform
77+
```
6378

6479
---
6580

66-
## Contributing
81+
# 📄 Documentation
6782

68-
We’re a tiny team (1 designer, 1 frontend, 1 PM) building the tools we wish existed.
69-
Pull requests, bug reports, and feedback are always welcome!
83+
Comprehensive documentation is available in the `docs` directory:
84+
85+
- [Documentation Index](docs/docs_index.md) - Main documentation entry point with links to all sections
86+
- [Overview](docs/overview.md) - System architecture and high-level application design
7087

7188
---
7289

73-
## Links
90+
# Contributing
7491

75-
- Website:
76-
- Product Hunt:
77-
- 小红书
78-
- Reddit
79-
- X
92+
We're a tiny team (1 designer, 1 frontend, 1 PM) building the tools we wish existed.
93+
Pull requests, bug reports, and feedback are always welcome!
8094

8195
---
8296

83-
## License
97+
# License
8498

8599
MIT

src/components/chat/ChatHistoryList.tsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface ChatHistoryListProps {
99
folders: ConversationFolder[];
1010
activeConversationId: string | null;
1111
onSelectConversation: (conversationId: string) => void;
12-
onCreateNewChat: () => void;
12+
onCreateNewChat: (folderId?: string) => void;
1313
onCreateNewFolder: () => void;
1414
onRenameConversation: (conversationId: string, newTitle: string) => void;
1515
onDeleteConversation: (conversationId: string) => void;
@@ -146,6 +146,11 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
146146
}
147147
};
148148

149+
const handleNewChatClick = (e: React.MouseEvent, folderId: string) => {
150+
e.stopPropagation();
151+
onCreateNewChat(folderId);
152+
};
153+
149154
const handleRenameClick = (e: React.MouseEvent, item: Conversation | ConversationFolder, type: 'conversation' | 'folder') => {
150155
e.stopPropagation();
151156
setEditingId(type === 'conversation' ? (item as Conversation).conversationId : (item as ConversationFolder).folderId);
@@ -343,6 +348,13 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
343348

344349
// Create context menu items for a folder
345350
const getFolderContextMenuItems = (folder: ConversationFolder): ContextMenuItem[] => [
351+
{
352+
id: 'new chat',
353+
icon: PlusCircle,
354+
label: 'New Chat',
355+
onClick: (e) => handleNewChatClick(e, folder.folderId),
356+
color: 'text-gray-700'
357+
},
346358
{
347359
id: 'rename',
348360
icon: Edit,
@@ -437,7 +449,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
437449
</button>
438450

439451
<button
440-
onClick={onCreateNewChat}
452+
onClick={() => onCreateNewChat()}
441453
className="flex items-center justify-center flex-1 h-full gap-2 pr-2 text-sm font-medium transition-all duration-100 primary-btn-border primary-btn-bg-color primary-btn-text-color"
442454
>
443455
<PlusCircle size={16}/>
@@ -485,6 +497,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
485497
onDragOver={(e) => handleDragOver(e, (item as ConversationFolder).folderId, 'folder')}
486498
onDragLeave={handleDragLeave}
487499
onDrop={(e) => handleDrop(e, (item as ConversationFolder).folderId, 'folder')}
500+
onContextMenu={(e) => handleMenuClick(e, (item as ConversationFolder).folderId, 'folder')}
488501
>
489502
{isCollapsed ? (
490503
<Folder fill={(item as ConversationFolder).colorFlag} size={16} className="mx-auto text-gray-600" />
@@ -503,7 +516,9 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
503516
<Folder fill={(item as ConversationFolder).colorFlag} size={16} className="flex-shrink-0 mr-1 text-gray-600" />
504517
<span className="font-semibold truncate select-none">{(item as ConversationFolder).folderName}</span>
505518
</div>
506-
<div onClick={(e) => handleMenuClick(e, (item as ConversationFolder).folderId, 'folder')}>
519+
<div
520+
onClick={(e) => handleMenuClick(e, (item as ConversationFolder).folderId, 'folder')}
521+
>
507522
<MoreVertical size={16} className="flex-shrink-0" />
508523
</div>
509524
</>
@@ -546,6 +561,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
546561
onDragOver={(e) => handleDragOver(e, (item as ConversationFolder).folderId, 'folder')}
547562
onDrop={(e) => handleDrop(e, (item as ConversationFolder).folderId, 'folder')}
548563
onClick={() => onSelectConversation(conversation.conversationId)}
564+
onContextMenu={(e) => handleMenuClick(e, conversation.conversationId, 'conversation')}
549565
className={`flex items-center justify-between w-full px-3 py-2 text-left conversation-item-border transition-all duration-100 cursor-pointer ${
550566
activeConversationId === conversation.conversationId
551567
? 'conversation-selected-item-bg-color conversation-selected-item-text-color'
@@ -561,7 +577,9 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
561577
<MessageSquare size={16} className="flex-shrink-0 mr-1" />
562578
<span className="truncate">{conversation.title}</span>
563579
</div>
564-
<div onClick={(e) => handleMenuClick(e, conversation.conversationId, 'conversation')}>
580+
<div
581+
onClick={(e) => handleMenuClick(e, conversation.conversationId, 'conversation')}
582+
>
565583
<MoreVertical size={16} className="flex-shrink-0" />
566584
</div>
567585
</div>
@@ -602,6 +620,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
602620
onDragStart={(e) => handleDragStart(e, { id: (item as Conversation).conversationId, type: 'conversation' })}
603621
onDragEnd={handleDragEnd}
604622
onClick={() => onSelectConversation((item as Conversation).conversationId)}
623+
onContextMenu={(e) => handleMenuClick(e, (item as Conversation).conversationId, 'conversation')}
605624
className={`flex flex-1 items-center justify-between mx-2 conversation-item-border px-3 py-2 text-left transition-all duration-100 cursor-pointer ${
606625
activeConversationId === (item as Conversation).conversationId
607626
? 'conversation-selected-item-bg-color conversation-selected-item-text-color'
@@ -617,7 +636,9 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
617636
<MessageSquare size={16} className="flex-shrink-0 mr-2" />
618637
<span className="truncate">{(item as Conversation).title}</span>
619638
</div>
620-
<div onClick={(e) => handleMenuClick(e, (item as Conversation).conversationId, 'conversation')}>
639+
<div
640+
onClick={(e) => handleMenuClick(e, (item as Conversation).conversationId, 'conversation')}
641+
>
621642
<MoreVertical size={16} className="flex-shrink-0" />
622643
</div>
623644
</>

src/components/chat/ChatMessageArea.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
274274
const hasStreamingMessage = Array.from(activeConversation.messages.values()).some(m => m.messageId.startsWith('streaming-'));
275275

276276
return (
277-
<div className="flex flex-col h-full">
277+
<div className="flex flex-col w-full h-full max-w-full">
278278
{/* Messages area */}
279279
<div className="flex-1 p-4 space-y-4 overflow-y-auto">
280280
{getMessagesList().map((message) => {
281+
if(message.role === 'system') return null;
282+
281283
const isUserMessage = message.role === 'user';
282284
const isEditing = editingMessageId === message.messageId;
283285

@@ -318,8 +320,6 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
318320
}
319321
];
320322

321-
if(message.role === 'system') return null;
322-
323323
return (
324324
<div
325325
key={message.messageId}
@@ -379,14 +379,14 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
379379
}
380380

381381
<div
382-
className={`max-w-[80%] rounded-lg p-3 ${
382+
className={`max-w-[80%] h-fit rounded-lg p-3 text-wrap break-words ${
383383
isUserMessage
384384
? 'message-user rounded-tr-none'
385385
: 'message-assistant rounded-tl-none'
386386
}`}
387387
>
388388
{isUserMessage ? (
389-
<p className="whitespace-pre-wrap">{MessageHelper.MessageContentToText(message.content)}</p>
389+
<MarkdownContent content={message.content} />
390390
) : (
391391
(message.content.length === 0 || MessageHelper.MessageContentToText(message.content).length === 0) ? (
392392
<div className="w-4 h-4 bg-blue-600 rounded-full animate-bounce"></div>

0 commit comments

Comments
 (0)