-
Notifications
You must be signed in to change notification settings - Fork 312
feat(web): text file attachments for Ask #1374
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
Open
whoisthey
wants to merge
28
commits into
main
Choose a base branch
from
whoisthey/text-file-attachments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
8540cdb
feat(web): add language model inputModalities capability plumbing
whoisthey a473b49
docs: add CHANGELOG entry for language model inputModalities
whoisthey 4b57d27
refactor(schemas): split document types out of inputModalities
whoisthey 0baabcb
docs(schemas): clarify what counts as a document type
whoisthey 5e4045b
fix(web): widen getLanguageModelKey param to keyable subset
whoisthey 507d758
chore(schemas,web): keep schema dist fresh and resolve types from source
whoisthey ed307ed
Merge branch 'main' into whoisthey/language-model-input-modalities
whoisthey a1aeb37
First pass file attachments, picker and drag and drop, with preview c…
whoisthey 18ff55e
Merge branch 'main' into whoisthey/language-model-input-modalities
whoisthey ebd573f
Merge branch 'whoisthey/language-model-input-modalities' into whoisth…
whoisthey 5d69749
escape key handle for modal and add missing description component
whoisthey c52e1cf
Merge branch 'main' into whoisthey/text-file-attachments
whoisthey de291cc
refactor(web): resolve model capabilities from models.dev, not config…
whoisthey d00f02e
Merge branch 'whoisthey/language-model-input-modalities' into whoisth…
whoisthey fb8843b
paste-to-attachment handling, raw paste keychord enabled, toast with …
whoisthey bf79260
stronger typing for contract
whoisthey dbcfc8a
remove blocking models.dev catalog request and add cache warm on startup
whoisthey 7ba297b
cleanup warming
whoisthey bc028ae
Merge branch 'whoisthey/language-model-input-modalities' into whoisth…
whoisthey 070f832
remove button from toast
whoisthey c050eb9
Merge branch 'main' into whoisthey/language-model-input-modalities
whoisthey 3d22e2a
Merge branch 'whoisthey/language-model-input-modalities' into whoisth…
whoisthey a62a25b
add separate state to track pending attachments to avoid visual flick…
whoisthey 38472b7
Merge branch 'main' into whoisthey/text-file-attachments
whoisthey af8a9db
explicitly import already hoisted uuid and change bad crypto call for…
whoisthey 2222dba
add changelog entry
whoisthey 14a237d
remove granular file attachment controls in favor of single per-messa…
whoisthey cb8181d
pass attachments through the login/upgrade redirect
whoisthey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/web/src/app/(app)/chat/components/chatLandingDropzone.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| 'use client'; | ||
|
|
||
| import { ChatBoxHandle } from "@/features/chat/components/chatBox"; | ||
| import { ChatPaneDropzone } from "@/features/chat/components/chatBox/chatPaneDropzone"; | ||
| import { createContext, ReactNode, useCallback, useContext, useRef } from "react"; | ||
|
|
||
| type RegisterChatBoxHandle = (handle: ChatBoxHandle | null) => void; | ||
|
|
||
| const LandingChatBoxContext = createContext<RegisterChatBoxHandle | null>(null); | ||
|
|
||
| // Lets the (nested) landing chat box register its imperative handle so the | ||
| // pane-level drop zone can forward dropped files into it. Returns a no-op when | ||
| // rendered outside the provider. | ||
| export const useRegisterLandingChatBox = (): RegisterChatBoxHandle => { | ||
| return useContext(LandingChatBoxContext) ?? (() => { }); | ||
| } | ||
|
|
||
| interface ChatLandingDropzoneProps { | ||
| disabled?: boolean; | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| // Wraps the entire unstarted-chat landing pane in a drag-and-drop target. | ||
| // The chat box lives deeper in the tree (and behind a server/client boundary), | ||
| // so it registers its handle via context rather than a direct ref. | ||
| export const ChatLandingDropzone = ({ disabled, children }: ChatLandingDropzoneProps) => { | ||
| const handleRef = useRef<ChatBoxHandle | null>(null); | ||
|
|
||
| const register = useCallback<RegisterChatBoxHandle>((handle) => { | ||
| handleRef.current = handle; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <LandingChatBoxContext.Provider value={register}> | ||
| <ChatPaneDropzone | ||
| className="flex flex-col items-center h-full overflow-hidden" | ||
| onFilesDropped={(files) => handleRef.current?.addFiles(files)} | ||
| disabled={disabled} | ||
| > | ||
| {children} | ||
| </ChatPaneDropzone> | ||
| </LandingChatBoxContext.Provider> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.