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

Installing from source... #37

Open
walking-octopus opened this issue May 13, 2023 · 2 comments
Open

Installing from source... #37

walking-octopus opened this issue May 13, 2023 · 2 comments

Comments

@walking-octopus
Copy link

Hi! I'm very much sorry for polluting the issues with stupid questions, but how do I install the component from source?

The version on Pip is a little outdated, and installing it with pip install git+https://github.com/AI-Yash/st-chat doesn't seem to change much. The repo also has dist with some old tars that might need to be somehow recompiled...

I'm very much new to Streamlit, so I'd appreciate any help. Sorry again for wasting anyone time with this... Thank you for this useful little project.

@RLKRo
Copy link
Contributor

RLKRo commented May 24, 2023

Hi!

I solved the issue with this commit: RLKRo@a75fee7.

I have a branch with some changes to the streamlit-chat called RLKRo:patch-1.
Installing it with pip install git+https://github.com/RLKRo/st-chat@patch-1 and then running streamlit produces this exception:

streamlit.errors.StreamlitAPIException: `set_page_config()` can only be called once per app, and must be called as the first Streamlit command in your script.

This is due to these lines in the __init__ file:

if not _RELEASE:
    import streamlit as st  

    long_message = """A chatbot or chatterbot is a software application used to conduct an on-line chat conversation via text or text-to-speech, in lieu of providing direct contact with a live human agent. 
    Designed to convincingly simulate the way a human would behave as a conversational partner, chatbot systems typically require continuous tuning and testing, and many in production remain unable to adequately converse, while none of them can pass the standard Turing test. 
    The term "ChatterBot" was originally coined by Michael Mauldin (creator of the first Verbot) in 1994 to describe these conversational programs.
    """
    message("Hello, I am a Chatbot, how may I help you?")
    message("Hey, \nwhat's a chatbot?", is_user=True)
    message(long_message)
    st.text_input("Message:")

Which initialize streamlit components during import of streamlit_chat.

If _RELEASE is set to True, those lines won't execute.
Which is what I'd done in the aforementioned commit.

I created a new branch from RLKRo:patch-1 called RLKRo:set-release-true which sets _RELEASE to True.

Now installing it from git with pip install git+https://github.com/RLKRo/st-chat@set-release-true and running streamlit does not raise the exception (and streamlit chat works).

Let me know whether this works for you.

@PascalHessler
Copy link

PascalHessler commented Jun 1, 2023

Hey, I tried what you suggested @RLKRo and it works. I now have my own version with small changes. BUT I noticed that changes in the frontend/src directory (which are really important) are ignored. My understanding is that the reason for this is quite simple. Because in the installed package only the built react component is accessible. So now I wonder how we can update this part of the package.

Ok I fixed my issue, it was rather simple. You need to go (local folder) to streamlit_chat\frontend run npm install and then you can run npm run build and then upload your own reporstiy. Everything works now!

Quick instructions to generate the newest build:

  1. fork this repo
  2. go to streamlit_chat/init.py and change "_RELEASE" to True
  3. (make additional changes to the repo)
  4. Since the original repo does not have the newest builded version of the react component we have to build a new one:
    1. go to streamlit_chat\frontend
    2. run npm install
    3. run npm run build
  5. Push everything to your repo
  6. now you created your own python package and you can install it with pip install git+https://your_repo

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

No branches or pull requests

3 participants