-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (26 loc) · 901 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This is where the chainlit main page will be implemented.
import chainlit as cl
from chainlit.input_widget import Select, Switch
from agents.agents import start_chat
@cl.on_settings_update
async def on_settings_update(settings):
global transcript_id
transcript_id = settings["Transcripts"][-1]
_message = f"for transcript id {transcript_id}, please extract all the entities"
msg = cl.Message(content=_message)
await on_message(msg)
@cl.on_chat_start
async def on_chat_start():
settings = await cl.ChatSettings(
[
Select(
id="Transcripts",
label="Call Transcripts",
values=["call-transcript-1", "call-transcript-2", "call-transcript-3", "call-transcript-4"],
initial_index=0,
),
]
).send()
@cl.on_message
async def on_message(message):
start_chat(message)