danswer-ai / danswer

Gen-AI Chat for Teams - Think ChatGPT if it had access to your team's unique knowledge.
https://docs.danswer.dev/
Other
10.38k stars 1.25k forks source link

Feature/continue #1571

Closed pablodanswer closed 1 month ago

pablodanswer commented 4 months ago

What?

Implements "Continue Generating" button functionality (akin to ChatGPT's)

Why?

Make it simple to continue generating and reach feature parity with other chat-based experiences?

How?

At a high level

Output token tracking

Stores token data in the LangChain AIMessageChunk model's metadata.

Use a new ChunkWithCount model to track the content and token count of each output chunk. This allows for more granular tracking of the generated output.

Integrates aforementioned model into _raw_output_for_explicit_tool_calling_llms which is used by all LLM streaming methods.

Total token count

While processing stream in extract_citations_from_stream, count up tokens and compare to the current maximum (logic within the DanswerAnswerPiece model.

Display

The React checks stream for optional parameter max_token and displays "Continue generating" component if the value is true

UI

UI was implemented using existing component formatting to maintain style consistency. Example below.

Screenshot 2024-06-06 at 9 18 59 AM
vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 8:07pm