fix: better chat window with long queries
This commit is contained in:
@@ -50,7 +50,7 @@ export class ChatEngine {
|
|||||||
const drizzle = this.db.getLocal();
|
const drizzle = this.db.getLocal();
|
||||||
const id = `chat_${uuidv4()}`;
|
const id = `chat_${uuidv4()}`;
|
||||||
const title = input.title || 'New Chat';
|
const title = input.title || 'New Chat';
|
||||||
const model = input.model || 'claude-sonnet-4';
|
const model = input.model || 'claude-sonnet-4-5';
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
await drizzle.insert(chatConversations).values({
|
await drizzle.insert(chatConversations).values({
|
||||||
@@ -383,7 +383,7 @@ When answering questions:
|
|||||||
return rows[0].value;
|
return rows[0].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'claude-sonnet-4';
|
return 'claude-sonnet-4-5';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -308,7 +308,7 @@
|
|||||||
.chat-input {
|
.chat-input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 24px;
|
min-height: 24px;
|
||||||
max-height: 120px;
|
max-height: 200px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
@@ -318,6 +318,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
resize: none;
|
resize: none;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input::placeholder {
|
.chat-input::placeholder {
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ export const ChatPanel: React.FC<ChatPanelProps> = ({ conversationId }) => {
|
|||||||
if (!message || isStreaming) return;
|
if (!message || isStreaming) return;
|
||||||
|
|
||||||
setInputValue('');
|
setInputValue('');
|
||||||
|
// Reset textarea height
|
||||||
|
if (inputRef.current) {
|
||||||
|
inputRef.current.style.height = 'auto';
|
||||||
|
}
|
||||||
setIsStreaming(true);
|
setIsStreaming(true);
|
||||||
streamingRef.current = '';
|
streamingRef.current = '';
|
||||||
setStreamingContent('');
|
setStreamingContent('');
|
||||||
@@ -480,7 +484,12 @@ export const ChatPanel: React.FC<ChatPanelProps> = ({ conversationId }) => {
|
|||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
className="chat-input"
|
className="chat-input"
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onChange={(e) => setInputValue(e.target.value)}
|
onChange={(e) => {
|
||||||
|
setInputValue(e.target.value);
|
||||||
|
// Auto-grow the textarea
|
||||||
|
e.target.style.height = 'auto';
|
||||||
|
e.target.style.height = `${Math.min(e.target.scrollHeight, 200)}px`;
|
||||||
|
}}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
placeholder="Type a message..."
|
placeholder="Type a message..."
|
||||||
rows={1}
|
rows={1}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ describe('ChatEngine', () => {
|
|||||||
|
|
||||||
expect(result.id).toMatch(/^chat_mock-uuid-/);
|
expect(result.id).toMatch(/^chat_mock-uuid-/);
|
||||||
expect(result.title).toBe('New Chat');
|
expect(result.title).toBe('New Chat');
|
||||||
expect(result.model).toBe('claude-sonnet-4');
|
expect(result.model).toBe('claude-sonnet-4-5');
|
||||||
expect(result.createdAt).toBeInstanceOf(Date);
|
expect(result.createdAt).toBeInstanceOf(Date);
|
||||||
expect(result.updatedAt).toBeInstanceOf(Date);
|
expect(result.updatedAt).toBeInstanceOf(Date);
|
||||||
});
|
});
|
||||||
@@ -768,7 +768,7 @@ describe('ChatEngine', () => {
|
|||||||
|
|
||||||
const result = await chatEngine.getSelectedModel();
|
const result = await chatEngine.getSelectedModel();
|
||||||
|
|
||||||
expect(result).toBe('claude-sonnet-4');
|
expect(result).toBe('claude-sonnet-4-5');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user