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 file upload button #362

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playground/UI/.chainlit/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ unsafe_allow_html = true
latex = false

# Authorize users to upload files with messages
multi_modal.enabled = true
spontaneous_file_upload.enabled = true

# Allows user to use speech to text
[features.speech_to_text]
Expand Down
7 changes: 7 additions & 0 deletions playground/UI/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class ChainLitMessageUpdater(SessionEventHandlerBase):
def __init__(self, root_step: cl.Step):
self.root_step = root_step
self.reset_cur_step()
self.suppress_blinking_cursor()

def reset_cur_step(self):
self.cur_step: Optional[cl.Step] = None
Expand All @@ -140,6 +141,11 @@ def reset_cur_step(self):
self.cur_message_is_end: bool = False
self.cur_message_sent: bool = False

def suppress_blinking_cursor(self):
cl.run_sync(self.root_step.stream_token(""))
if self.cur_step is not None:
cl.run_sync(self.cur_step.stream_token(""))

def handle_round(
self,
type: RoundEventType,
Expand Down Expand Up @@ -209,6 +215,7 @@ def handle_post(
),
]
cl.run_sync(self.cur_step.update())
self.suppress_blinking_cursor()

def get_message_from_user(self, prompt: str, timeout: int = 120) -> Optional[str]:
ask_user_msg = cl.AskUserMessage(content=prompt, author=" ", timeout=timeout)
Expand Down
7 changes: 6 additions & 1 deletion website/docs/usage/webui.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Please note that this Web UI is for development and testing purposes only.

Follow the instruction in [Quick Start](../quickstart.md) to clone the repository and fill in the necessary configurations.

Install the `chainlit` package by `pip install -U chainlit` if you don't have it in your environment.
Install the `chainlit` package by `pip install -U "chainlit<1.1.300"` if you don't have it in your environment.

:::note
Chainlit has a major update in version 1.1.300 that may cause compatibility issues.
Please make sure you have the correct version installed.
:::

Start the service by running the following command.

Expand Down