-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toggle history #369
base: main
Are you sure you want to change the base?
Toggle history #369
Changes from 1 commit
2302266
7111005
112280a
2804b5e
81fe019
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,11 +93,10 @@ export function ChatPanel({ messages, query }: ChatPanelProps) { | |
// Clear messages | ||
const handleClear = () => { | ||
setIsGenerating(false) | ||
if (chatHistoryEnabled) { | ||
setMessages([]) | ||
setAIMessage({ messages: [], chatId: '' }) | ||
} | ||
// Always clear input and reset UI state when clearing even if chat history is disabled | ||
setInput('') | ||
setMessages([]) | ||
setAIMessage({ messages: [], chatId: generateId() }) // Reset AIState with new chatId | ||
router.push('/') | ||
} | ||
|
||
|
@@ -149,7 +148,7 @@ export function ChatPanel({ messages, query }: ChatPanelProps) { | |
placeholder="Ask a question..." | ||
spellCheck={false} | ||
value={input} | ||
className="resize-none w-full min-h-12 rounded-fill bg-muted border border-input pl-4 pr-10 pt-3 pb-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50'" | ||
className="resize-none w-full min-h-12 rounded-fill bg-muted border border-input pl-4 pr-10 pt-3 pb-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok so no cosmetic changes . cool |
||
onChange={e => { | ||
setInput(e.target.value) | ||
setShowEmptyScreen(e.target.value.length === 0) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ import HistoryContainer from './history-container' | |
import TopRightMenu from './ui/top-right-menu' | ||
|
||
export const Header: React.FC = async () => { | ||
// Get storage provider setting from environment | ||
const storageProvider = process.env.STORAGE_PROVIDER || 'redis' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The header will only be controlled on mobile. If you return null in the history-container, you can control everything at once. https://github.com/miurla/morphic/blob/main/components/history-container.tsx
|
||
|
||
return ( | ||
<header className="fixed w-full p-1 md:p-2 flex justify-between items-center z-10 backdrop-blur md:backdrop-blur-none bg-background/80 md:bg-transparent"> | ||
<div> | ||
|
@@ -16,8 +19,7 @@ export const Header: React.FC = async () => { | |
</div> | ||
<div className="flex gap-0.5"> | ||
<ModeToggle /> | ||
<HistoryContainer location="header" /> | ||
{/* <TopRightMenu /> */} | ||
{storageProvider !== 'none' && <HistoryContainer location="header" />} | ||
</div> | ||
</header> | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO: Since chatHistoryEnabled is also being checked in saveChat, checking it in either place should be sufficient.
2804b5e#diff-819d2d9016d052cd621d2190deaf60688a87f953233d709b40fdabcf99d83f47R175-R180
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea just put it as additional safety net but see what you mean