-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add ui functions to interact with RAG #9
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
Kaiohz
merged 3 commits into
BRIC-4/init-composable-ui
from
BRIC-17/rag-ui-index-query-read
Apr 25, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| interface FileContentPanelProps { | ||
| content: string; | ||
| metadata: { format_type: string; mime_type: string }; | ||
| tables: { headers: string[]; rows: string[][] }[]; | ||
| onClose: () => void; | ||
| } | ||
|
|
||
| export default function FileContentPanel({ | ||
| content, | ||
| metadata, | ||
| tables, | ||
| onClose, | ||
| }: Readonly<FileContentPanelProps>) { | ||
| return ( | ||
| <div className="fixed right-0 top-0 h-full w-[480px] bg-surface-container-lowest border-l border-outline-variant shadow-2xl z-50 flex flex-col"> | ||
| <div className="flex items-center justify-between px-6 py-4 border-b border-outline-variant"> | ||
| <h3 className="font-headline text-sm font-semibold text-on-surface"> | ||
| File Content | ||
| </h3> | ||
| <button | ||
| type="button" | ||
| onClick={onClose} | ||
| className="flex items-center justify-center w-8 h-8 rounded-lg hover:bg-surface-container transition-colors" | ||
| aria-label="Close" | ||
| > | ||
| <span className="material-symbols-outlined text-lg text-on-surface-variant"> | ||
| close | ||
| </span> | ||
| </button> | ||
| </div> | ||
|
|
||
| <div className="px-6 py-3 border-b border-outline-variant"> | ||
| <div className="flex items-center gap-4 text-xs font-body text-on-surface-variant"> | ||
| <span className="bg-surface-container px-2 py-0.5 rounded"> | ||
| {metadata.format_type} | ||
| </span> | ||
| <span>{metadata.mime_type}</span> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex-1 overflow-y-auto px-6 py-4 max-h-[calc(100vh-8rem)]"> | ||
| <pre className="font-body text-sm text-on-surface whitespace-pre-wrap overflow-wrap-anywhere"> | ||
| {content} | ||
| </pre> | ||
|
|
||
| {tables.length > 0 && ( | ||
| <div className="mt-6 space-y-4"> | ||
| <h4 className="font-headline text-sm font-semibold text-on-surface"> | ||
| Tables ({tables.length}) | ||
| </h4> | ||
| {tables.map((table, tableIdx) => ( | ||
| <div | ||
| key={`table-${tableIdx}-${table.headers.join("-")}`} | ||
| className="overflow-x-auto border border-outline-variant rounded-lg" | ||
| > | ||
| <table className="min-w-full text-xs font-body"> | ||
| <thead> | ||
| <tr className="bg-surface-container"> | ||
| {table.headers.map((header) => ( | ||
| <th | ||
| key={header} | ||
| className="px-3 py-2 text-left text-on-surface-variant font-semibold" | ||
| > | ||
| {header} | ||
| </th> | ||
| ))} | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {table.rows.map((row, rowIdx) => ( | ||
| <tr | ||
| key={`row-${tableIdx}-${rowIdx}`} | ||
| className="border-t border-outline-variant" | ||
| > | ||
| {row.map((cell, cellIdx) => ( | ||
| <td | ||
| key={`cell-${tableIdx}-${rowIdx}-${cellIdx}`} | ||
| className="px-3 py-2 text-on-surface" | ||
| > | ||
| {cell} | ||
| </td> | ||
| ))} | ||
| </tr> | ||
| ))} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,55 @@ | ||
| import IndexActionMenu from "@/application/components/rag/IndexActionMenu"; | ||
|
|
||
| interface FolderRowProps { | ||
| name: string; | ||
| onClick: () => void; | ||
| isIndexing?: boolean; | ||
| onIndexLightRAG?: () => void; | ||
| onIndexClassical?: () => void; | ||
| } | ||
|
|
||
| export default function FolderRow({ name, onClick }: Readonly<FolderRowProps>) { | ||
| export default function FolderRow({ name, onClick, isIndexing, onIndexLightRAG, onIndexClassical }: Readonly<FolderRowProps>) { | ||
| const hasIndexOptions = onIndexLightRAG || onIndexClassical; | ||
|
|
||
| return ( | ||
| <button | ||
| type="button" | ||
| tabIndex={0} | ||
| onClick={onClick} | ||
| aria-label={name} | ||
| className="w-full flex items-center gap-4 px-6 py-4 rounded-xl hover:bg-surface-container transition-colors text-left" | ||
| > | ||
| <span | ||
| className="material-symbols-outlined text-2xl text-secondary-brand" | ||
| aria-label="folder icon" | ||
| <div className={`w-full flex items-center ${isIndexing ? "opacity-60" : ""}`}> | ||
| <button | ||
| type="button" | ||
| tabIndex={0} | ||
| onClick={onClick} | ||
| disabled={isIndexing} | ||
| aria-label={name} | ||
|
Contributor
Author
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. Même duplication du menu d'indexation. |
||
| className="flex-1 flex items-center gap-4 px-6 py-4 rounded-xl hover:bg-surface-container transition-colors text-left" | ||
| > | ||
| folder | ||
| </span> | ||
| <span className="font-headline text-sm font-semibold text-on-surface flex-1"> | ||
| {name} | ||
| </span> | ||
| <span | ||
| className="material-symbols-outlined text-lg text-outline" | ||
| aria-hidden="true" | ||
| > | ||
| chevron_right | ||
| </span> | ||
| </button> | ||
| <span | ||
| className="material-symbols-outlined text-2xl text-secondary-brand" | ||
| aria-label="folder icon" | ||
| > | ||
| {isIndexing ? "progress_activity" : "folder"} | ||
| </span> | ||
| <span className="font-headline text-sm font-semibold text-on-surface flex-1"> | ||
| {name} | ||
| </span> | ||
| {isIndexing && ( | ||
| <span className="material-symbols-outlined text-lg animate-spin text-secondary-brand" aria-hidden="true"> | ||
| progress_activity | ||
| </span> | ||
| )} | ||
| <span | ||
| className="material-symbols-outlined text-lg text-outline" | ||
| aria-hidden="true" | ||
| > | ||
| chevron_right | ||
| </span> | ||
| </button> | ||
| {hasIndexOptions && ( | ||
| <div className="mr-4"> | ||
| <IndexActionMenu | ||
| onIndexLightRAG={onIndexLightRAG!} | ||
| onIndexClassical={onIndexClassical!} | ||
| /> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
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.
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.
Le menu d'indexation est dupliqué ici alors que
IndexActionMenu.tsxexiste. Considérer la réutilisation du composant.