Skip to content
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

fix token duplication in frontend #301

Merged
merged 1 commit into from May 22, 2024

Conversation

spatker
Copy link
Contributor

@spatker spatker commented Apr 22, 2024

applyPatch modifies the document so every token got added twice to the stream

Fixes: #300

applyPatch modifies the document so every token got added twice to the stream

Signed-off-by: Peter Suti <spatker@gmail.com>
Copy link

vercel bot commented Apr 22, 2024

@spatker is attempting to deploy a commit to the LangChain Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@Trde654 Trde654 left a comment

Choose a reason for hiding this comment

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

😍😘✌️

streamedResponse = applyPatch(streamedResponse, chunk.ops).newDocument;
streamedResponse = applyPatch(streamedResponse, chunk.ops, undefined, false).newDocument;
Copy link

Choose a reason for hiding this comment

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

Yes

Choose a reason for hiding this comment

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

That works!

Copy link

@Trde654 Trde654 left a comment

Choose a reason for hiding this comment

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

Traducción

@@ -132,7 +132,7 @@ export function ChatWindow(props: { conversationId: string }) {
},
);
for await (const chunk of streamLog) {
streamedResponse = applyPatch(streamedResponse, chunk.ops).newDocument;
streamedResponse = applyPatch(streamedResponse, chunk.ops, undefined, false).newDocument;
Copy link

Choose a reason for hiding this comment

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

@😘

Copy link

@Trde654 Trde654 left a comment

Choose a reason for hiding this comment

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

Traidora

@@ -132,7 +132,7 @@ export function ChatWindow(props: { conversationId: string }) {
},
);
for await (const chunk of streamLog) {
streamedResponse = applyPatch(streamedResponse, chunk.ops).newDocument;
streamedResponse = applyPatch(streamedResponse, chunk.ops, undefined, false).newDocument;
Copy link

Choose a reason for hiding this comment

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

Traidora

Copy link

@Trde654 Trde654 left a comment

Choose a reason for hiding this comment

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

❤️

Copy link

@Trde654 Trde654 left a comment

Choose a reason for hiding this comment

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

@@ -132,7 +132,7 @@ export function ChatWindow(props: { conversationId: string }) {
},
);
for await (const chunk of streamLog) {
streamedResponse = applyPatch(streamedResponse, chunk.ops).newDocument;
streamedResponse = applyPatch(streamedResponse, chunk.ops, undefined, false).newDocument;
Copy link

Choose a reason for hiding this comment

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


@@ -132,7 +132,7 @@ export function ChatWindow(props: { conversationId: string }) {
},
);
for await (const chunk of streamLog) {
streamedResponse = applyPatch(streamedResponse, chunk.ops).newDocument;
streamedResponse = applyPatch(streamedResponse, chunk.ops, undefined, false).newDocument;
Copy link

Choose a reason for hiding this comment

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

Copy link

@Trde654 Trde654 left a comment

Choose a reason for hiding this comment

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

Traducción

Copy link

vercel bot commented May 22, 2024

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

Name Status Preview Comments Updated (UTC)
chat-langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 11:24pm

@vbarda
Copy link

vbarda commented May 22, 2024

Thank you @spatker!

@vbarda vbarda merged commit 6c8478d into langchain-ai:master May 22, 2024
2 checks passed
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.

Why the answer string show duplicated words on front end?
4 participants