-
Notifications
You must be signed in to change notification settings - Fork 415
Got enhancing working in desktop2 #1596
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
41c4343
got working
yujonglee bec0b45
md styling
yujonglee fe57725
autoscroll
yujonglee 932d61e
fixes
yujonglee c8e4e0d
smoother
yujonglee 7f6ed1c
pnpm
yujonglee bcd580c
markdown support
yujonglee 5546951
chores
yujonglee dea9c78
bunch of fixes
yujonglee 6106019
wip
yujonglee 918ad75
refactor chat transport with agent
yujonglee 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
Some comments aren't visible on the classic Files Changed page.
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
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
35 changes: 0 additions & 35 deletions
35
apps/desktop/src/components/main/body/sessions/note-input/enhanced.tsx
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
apps/desktop/src/components/main/body/sessions/note-input/enhanced/editor.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,36 @@ | ||
| import { forwardRef } from "react"; | ||
|
|
||
| import { TiptapEditor } from "@hypr/tiptap/editor"; | ||
| import NoteEditor from "@hypr/tiptap/editor"; | ||
| import * as persisted from "../../../../../../store/tinybase/persisted"; | ||
|
|
||
| export const EnhancedEditor = forwardRef<{ editor: TiptapEditor | null }, { sessionId: string }>( | ||
| ({ sessionId }, ref) => { | ||
| const value = persisted.UI.useCell("sessions", sessionId, "enhanced_md", persisted.STORE_ID); | ||
|
|
||
| const handleEnhancedChange = persisted.UI.useSetPartialRowCallback( | ||
| "sessions", | ||
| sessionId, | ||
| (input: string) => ({ enhanced_md: input }), | ||
| [], | ||
| persisted.STORE_ID, | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="h-full"> | ||
| <NoteEditor | ||
| ref={ref} | ||
| key={`session-${sessionId}-enhanced`} | ||
| initialContent={value ?? ""} | ||
| handleChange={handleEnhancedChange} | ||
| mentionConfig={{ | ||
| trigger: "@", | ||
| handleSearch: async () => { | ||
| return []; | ||
| }, | ||
| }} | ||
| /> | ||
| </div> | ||
| ); | ||
| }, | ||
| ); |
28 changes: 28 additions & 0 deletions
28
apps/desktop/src/components/main/body/sessions/note-input/enhanced/index.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,28 @@ | ||
| import { type TiptapEditor } from "@hypr/tiptap/editor"; | ||
| import { forwardRef } from "react"; | ||
|
|
||
| import { useAITask } from "../../../../../../contexts/ai-task"; | ||
| import { EnhancedEditor } from "./editor"; | ||
| import { StreamingView } from "./streaming"; | ||
|
|
||
| export const Enhanced = forwardRef< | ||
| { editor: TiptapEditor | null }, | ||
| { sessionId: string } | ||
| >(({ sessionId }, ref) => { | ||
| const taskId = `${sessionId}-enhance`; | ||
|
|
||
| const { status, error } = useAITask((state) => ({ | ||
| status: state.tasks[taskId]?.status ?? "idle", | ||
| error: state.tasks[taskId]?.error, | ||
| })); | ||
|
|
||
| if (status === "error" && error) { | ||
| return <pre>{error.message}</pre>; | ||
| } | ||
|
|
||
| if (status === "generating") { | ||
| return <StreamingView sessionId={sessionId} />; | ||
| } | ||
|
|
||
| return <EnhancedEditor ref={ref} sessionId={sessionId} />; | ||
| }); | ||
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.