Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.24k stars 955 forks source link

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

Open maoguy opened 2 weeks ago

maoguy commented 2 weeks ago

Description of current situation

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

maoguy commented 2 weeks ago

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 commented 2 weeks ago

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

dokterbob commented 2 weeks ago

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

dosubot[bot] commented 2 weeks ago

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.

maoguy commented 2 weeks ago

@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?😃

dosubot[bot] commented 2 weeks ago

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 commented 1 week ago

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.