initial
Browse files- Dockerfile +14 -0
- app.py +28 -0
- requirements.txt +2 -0
Dockerfile
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.13
|
2 |
+
|
3 |
+
RUN useradd -m -u 1000 user
|
4 |
+
USER user
|
5 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
+
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
+
|
12 |
+
COPY --chown=user . /app
|
13 |
+
|
14 |
+
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0" ,"--port", "7860"]
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import chainlit as cl
|
2 |
+
|
3 |
+
@cl.on_chat_start
|
4 |
+
async def start():
|
5 |
+
"""
|
6 |
+
This function is called when a new chat starts.
|
7 |
+
You can use it to initialize any variables or models.
|
8 |
+
"""
|
9 |
+
# Initialize any variables or models here
|
10 |
+
await cl.Message(
|
11 |
+
content="Welcome to the chatbot! How can I help you today?"
|
12 |
+
).send()
|
13 |
+
|
14 |
+
@cl.on_message
|
15 |
+
async def main(message: str):
|
16 |
+
"""
|
17 |
+
This function is called every time a user inputs a message.
|
18 |
+
Args:
|
19 |
+
message: The user's message
|
20 |
+
"""
|
21 |
+
# Process the user's message here
|
22 |
+
response = f"You said: {message.content}"
|
23 |
+
|
24 |
+
# Send a response back to the user
|
25 |
+
await cl.Message(
|
26 |
+
content=response
|
27 |
+
).send()
|
28 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
chainlit
|
2 |
+
websockets
|