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

feat(example): chatbot UI #3487

Merged
merged 2 commits into from
Nov 18, 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
32 changes: 16 additions & 16 deletions examples/chatbot/.chainlit/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,33 @@ cot = "full"

[UI.theme]
default = "dark"
#layout = "wide"
#font_family = "Inter, sans-serif"
font_family = "Tahoma,Verdana,Segoe,sans-serif"

# Override default MUI light theme. (Check theme.ts)
[UI.theme.light]
#background = "#FAFAFA"
#paper = "#FFFFFF"
background = "#fcfcfc"
paper = "#f8f8f8"

[UI.theme.light.primary]
#main = "#F80061"
#dark = "#980039"
#light = "#FFE7EB"
main = "#6142d4"
dark = "#6e53cf"
light = "#6e53cf30"
[UI.theme.light.text]
#primary = "#212121"
#secondary = "#616161"
primary = "#1f1f1f"
secondary = "#818080"

# Override default MUI dark theme. (Check theme.ts)
[UI.theme.dark]
#background = "#FAFAFA"
#paper = "#FFFFFF"
background = "#252525"
paper = "#1f1f1f"

[UI.theme.dark.primary]
#main = "#F80061"
#dark = "#980039"
#light = "#FFE7EB"
main = "#6142d4"
dark = "#6e53cf"
light = "#6e53cf30"
[UI.theme.dark.text]
#primary = "#EEEEEE"
#secondary = "#BDBDBD"
primary = "#f4f4f4"
secondary = "#c8c8c8"

[meta]
generated_by = "1.1.402"
1 change: 1 addition & 0 deletions examples/chatbot/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ wheels/

# venv
.venv
.files
6 changes: 5 additions & 1 deletion examples/chatbot/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import tempfile

import chainlit as cl
Expand Down Expand Up @@ -53,11 +54,14 @@ async def main(message: cl.Message):
return

# Prepare the message for streaming
msg = cl.Message(content="")
msg = cl.Message(content="", elements=[])
await msg.send()

# Use the ask_stream method for streaming responses
async for chunk in brain.ask_streaming(message.content):
await msg.stream_token(chunk.answer)
for source in chunk.metadata.sources:
print(source.metadata)
msg.elements.append(cl.Text(name=source.metadata['original_file_name'], content="source", display="inline"))

await msg.send()
Binary file added examples/chatbot/public/favicon.ico
Binary file not shown.
Binary file added examples/chatbot/public/logo_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/chatbot/public/logo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading