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

Compatibility Issues with @chainlit/react-client in React Native due to uuid Package #1498

Open
maoguy opened this issue Nov 5, 2024 · 7 comments
Labels
frontend Pertains to the frontend. needs-triage question Further information is requested

Comments

@maoguy
Copy link
Contributor

maoguy commented Nov 5, 2024

Description of current situation

when i use @chainlit/react-client in react-native for android app.I get the The following error:
184430d6c349262b0fd5d7c9fb273f8

@dosubot dosubot bot added the frontend Pertains to the frontend. label Nov 5, 2024
@maoguy
Copy link
Contributor Author

maoguy commented Nov 5, 2024

I think I've made a preliminary discovery of what caused this anomaly.

This looks like an exception caused by the npm pack -- uuid.

I tried to solve the problem

At present, I have solved the problem with the following methods.

Firstly, download the source code of @chainlit/client v0.1.2 (which in github repo tag:chainlit-1.1.306);
image

Secondly, put the source code into the react-native project code;
image

Thirdly,change the import alias etc...In order to import the source code just like my project code;
image
image

Fourth,change useChatInteract.ts and state.ts with the following methods
image

Endly,import the module and use them.
image
image

@maoguy
Copy link
Contributor Author

maoguy commented Nov 5, 2024

I will continue to monitor this issue and its solution, and keep active updates on ichigo-ichie😄

@dokterbob dokterbob added the question Further information is requested label Nov 6, 2024
@dokterbob
Copy link
Collaborator

@dosu Could you please try and help this user along? In addition, could you suggest a more appropriate title for this issue?

Copy link

dosubot bot commented Nov 6, 2024

To use Chainlit in a React Native app, you might encounter compatibility issues with certain packages like uuid. Here's a general approach to address these issues:

  1. Identify the Problematic Package: As you've discovered, the uuid package can cause issues in React Native environments.

  2. Workaround: You can manually integrate the source code of the @chainlit/react-client package into your project, as you've done. This involves:

    • Downloading the source code of the specific version you need.
    • Integrating it into your React Native project.
    • Adjusting import paths and aliases to fit your project structure.
    • Modifying specific files like useChatInteract.ts and state.ts to resolve compatibility issues.
  3. Monitor and Update: Keep an eye on updates or fixes from the Chainlit repository or community that might address these compatibility issues more elegantly in the future.

For the issue title, consider something more descriptive like: "Compatibility Issues with @chainlit/react-client in React Native due to uuid Package".

If you need further assistance or have specific questions about the modifications, feel free to ask!

To continue talking to Dosu, mention @dosu.

@dokterbob dokterbob changed the title how can i use chainlit for react-native app? Compatibility Issues with @chainlit/react-client in React Native due to uuid Package Nov 6, 2024
@maoguy
Copy link
Contributor Author

maoguy commented Nov 6, 2024

@dosu Could you please try and help this user along? In addition, could you suggest a more appropriate title for this issue?

Can i contribute the a react-native app demo to the cookbooks repo?😃

Copy link

dosubot bot commented Nov 6, 2024

Yes, contributing a React Native app demo to the cookbooks repository would be a great idea! It could serve as a valuable resource for others facing similar compatibility issues. Make sure to include detailed instructions and any necessary modifications to help others integrate @chainlit/react-client smoothly into their React Native projects. If you need guidance on how to structure the demo or any specific content to include, feel free to ask!

To continue talking to Dosu, mention @dosu.

@maoguy
Copy link
Contributor Author

maoguy commented Nov 11, 2024

Yes, contributing a React Native app demo to the cookbooks repository would be a great idea! It could serve as a valuable resource for others facing similar compatibility issues. Make sure to include detailed instructions and any necessary modifications to help others integrate @chainlit/react-client smoothly into their React Native projects. If you need guidance on how to structure the demo or any specific content to include, feel free to ask!

To continue talking to Dosu, mention @dosu.

Here I just contributing a React Native app demo to the cookbooks repository -> PR Link pull/156

Please review, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Pertains to the frontend. needs-triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants