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

llm-tgi: Fix to display Chinese response correctly in UI #590

Closed
wants to merge 2 commits into from

Conversation

bjzhjing
Copy link
Contributor

@bjzhjing bjzhjing commented Sep 2, 2024

Helm install OPEA ChatQnA, and leverage react UI for Chinese question and answer, but it's failed to display Chinese response on react UI, the output is garbled. TGI model returns the correct context, but llm-tgi microservice converts it to be messy. Add fix to address the issue.

To fix #589

@@ -82,16 +82,15 @@ async def stream_generator():
async for text in text_generation:
stream_gen_time.append(time.time() - start)
chat_response += text
chunk_repr = repr(text.encode("utf-8"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Encoding is required by the frontend to prevent special characters from being omitted. Have you tried the Svelte UI? We need to ensure that both the React UI and Svelte UI work seamlessly, whether in Chinese or English, with your code changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comments! Check with Svelte UI, it can display both Chinese and English well, for it has the logic to decode hexadecimal for Chinese response. It seems that modifying React UI involves minor changes.

Helm install OPEA ChatQnA, and leverage react UI for Chinese question
and answer, but it's failed to display Chinese response on UI, the
output is garbled. TGI model returns the correct context, but llm-tgi
microservice converts it to be messy. Add fix to address the issue.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
@bjzhjing
Copy link
Contributor Author

bjzhjing commented Sep 2, 2024

Open opea-project/GenAIExample# and close this one.

@bjzhjing bjzhjing closed this Sep 2, 2024
lkk12014402 pushed a commit that referenced this pull request Sep 19, 2024
* fixed ISSUE-528

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

Failed to display Chinese response with llm-tgi and react UI
2 participants