mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-16 18:25:17 +02:00
Refactor chat submission to include files array and improve heading title extraction
This commit is contained in:
parent
2cf3f9cc95
commit
8029877792
2 changed files with 8 additions and 7 deletions
|
|
@ -140,7 +140,8 @@ const getHeadingTitle = (markdown: string) => {
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const match = line.match(/^#\s+(.+)$/)
|
const match = line.match(/^#\s+(.+)$/)
|
||||||
if (match) return match[1].trim()
|
if (match) return match[1].trim()
|
||||||
if (line.trim() !== '') return null
|
const trimmed = line.trim()
|
||||||
|
if (trimmed !== '') return trimmed
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
@ -604,7 +605,7 @@ function App() {
|
||||||
const handleChatInputSubmit = (text: string) => {
|
const handleChatInputSubmit = (text: string) => {
|
||||||
setIsChatSidebarOpen(true)
|
setIsChatSidebarOpen(true)
|
||||||
// Submit immediately - the sidebar will open and show the message
|
// Submit immediately - the sidebar will open and show the message
|
||||||
handlePromptSubmit({ text })
|
handlePromptSubmit({ text, files: [] })
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleExpand = (path: string, kind: 'file' | 'dir') => {
|
const toggleExpand = (path: string, kind: 'file' | 'dir') => {
|
||||||
|
|
@ -986,7 +987,7 @@ function App() {
|
||||||
onSelectFile={toggleExpand}
|
onSelectFile={toggleExpand}
|
||||||
knowledgeActions={knowledgeActions}
|
knowledgeActions={knowledgeActions}
|
||||||
/>
|
/>
|
||||||
<SidebarInset className="!overflow-hidden min-h-0">
|
<SidebarInset className="overflow-hidden! min-h-0">
|
||||||
{/* Header with sidebar trigger */}
|
{/* Header with sidebar trigger */}
|
||||||
<header className="flex h-12 shrink-0 items-center gap-2 border-b border-border px-3 bg-background">
|
<header className="flex h-12 shrink-0 items-center gap-2 border-b border-border px-3 bg-background">
|
||||||
<SidebarTrigger className="-ml-1" />
|
<SidebarTrigger className="-ml-1" />
|
||||||
|
|
@ -1093,8 +1094,8 @@ function App() {
|
||||||
<ConversationScrollButton className="bottom-24" />
|
<ConversationScrollButton className="bottom-24" />
|
||||||
</Conversation>
|
</Conversation>
|
||||||
|
|
||||||
<div className="relative sticky bottom-0 z-10 bg-background pb-4 pt-6 shadow-lg">
|
<div className="sticky bottom-0 z-10 bg-background pb-4 pt-6 shadow-lg">
|
||||||
<div className="pointer-events-none absolute inset-x-0 -top-6 h-6 bg-gradient-to-t from-background to-transparent" />
|
<div className="pointer-events-none absolute inset-x-0 -top-6 h-6 bg-linear-to-t from-background to-transparent" />
|
||||||
<div className="mx-auto w-full max-w-4xl px-4">
|
<div className="mx-auto w-full max-w-4xl px-4">
|
||||||
<PromptInput onSubmit={handlePromptSubmit}>
|
<PromptInput onSubmit={handlePromptSubmit}>
|
||||||
<PromptInputBody>
|
<PromptInputBody>
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ interface ChatSidebarProps {
|
||||||
isProcessing: boolean
|
isProcessing: boolean
|
||||||
message: string
|
message: string
|
||||||
onMessageChange: (message: string) => void
|
onMessageChange: (message: string) => void
|
||||||
onSubmit: (message: { text: string }) => void
|
onSubmit: (message: { text: string; files: never[] }) => void
|
||||||
contextUsage: LanguageModelUsage
|
contextUsage: LanguageModelUsage
|
||||||
maxTokens: number
|
maxTokens: number
|
||||||
usedTokens: number
|
usedTokens: number
|
||||||
|
|
@ -163,7 +163,7 @@ export function ChatSidebar({
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
const trimmed = message.trim()
|
const trimmed = message.trim()
|
||||||
if (trimmed && !isProcessing) {
|
if (trimmed && !isProcessing) {
|
||||||
onSubmit({ text: trimmed })
|
onSubmit({ text: trimmed, files: [] })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue