-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[FEAT] show chunk score on citations #773
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
Conversation
frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsxConsider using React's useMemo hook to memoize the result of the combineLikeSources function. This will prevent unnecessary re-rendering and computation when the sources prop does not change. const combinedSources = useMemo(() => combineLikeSources(sources), [sources]);Consider destructuring the properties of the chunk object in the map function. This will make the code more readable and easier to understand. {chunks.map(({id, text, score}, idx) => (
...
))}Consider checking if the chunks array is not empty before trying to access its first element. This will prevent unnecessary computation and potential errors. if (!chunks.length || !chunks[0].chunkSource.startsWith("link://")) return nullResponse; |
frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx
Outdated
Show resolved
Hide resolved
frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx
Outdated
Show resolved
Hide resolved
* show similarity score in citation chunks * refactor combine like sources to handle separate similarity scores and improve UI for displaying chunks * fix parseChunkSource function to work with links * destructure properties in chunks mapping * check chunk length in parseChunkSource * change UI on how score is shown * remove duplicate import --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
Pull Request Type
Relevant Issues
resolves #742
What is in this change?
Describe the changes in this PR that are impactful to the repo.
Additional Information
Add any other context about the Pull Request here that was not captured above.
Developer Validations
yarn lintfrom the root of the repo & committed changes