Skip to content

Conversation

jason-raitz
Copy link
Contributor

Added a custom_element jsx to put the tind-refs into an accordion component from chainlit's import of shadcn.

There are issues with persisting the element to the data layer because we're not currently using a cloud storage integration.

Cloud storage is required in chainlit's chainlit_data_layer.py src, but it appears to be overly aggressive. If we're not persisting any binary uploads as part of the element, then it should be able to work.

Current thoughts are to submit an issue upstream along with a proposed PR for the fix, hookup an S3/localstack integration (that won't be used!), or do some message manipulation on_chat_resume and just recreate them live...

Copy link
Member

@anarchivist anarchivist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is neat - i'm wondering about our approach here and how we're constructing tind_message in our upstream code. curious to see how our chainlit pr can move forward. (can you link that here?)

<AccordionTrigger>Metadata</AccordionTrigger>
<AccordionContent>
<p className="mb-2" style={{ whiteSpace: 'pre-line' }}>
{props.tind_message || 'no references supplied'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an option to not return a References section at all unless props.tind_message is present?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are links rendered in this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anarchivist The way that the custom element is called in chatbot/app.py, it should only render the element if a message from langchain has a metadata['tind_message']. Or, after the proposed changes upstream, the element in the data layer should be able to restore it from props.

Once that's changed upstream we may need to alter our chatbot or graph_manager code to make sure the tind_messages are still getting filtered out of the context sent/returned to/from the summarizer.

All that being said, I think the custom_element part of this approach allows us to get a little more specific about how we customize the output of the references. With structured responses or even some advanced string parsing we could add UI signposting like reference counts or links to specific pages in the source documents.

@jason-raitz
Copy link
Contributor Author

It's in Jira, but here's the links to the upstream custom_element issue and PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants