Sanchit Verma commited on
Commit ·
1f597c7
1
Parent(s): 9553198
Refactor docstring in handle_message function for clarity
Browse filesUpdated the docstring to provide a clearer description of the function's purpose and parameters in app.py.
app.py
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
from prompts import PERSONAS
|
| 3 |
from utils import generate_response
|
| 4 |
-
from config import DEFAULT_PERSONA
|
| 5 |
|
| 6 |
|
| 7 |
def handle_message(persona, user_input, history):
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
|
| 11 |
Args:
|
| 12 |
-
persona
|
| 13 |
-
user_input
|
| 14 |
-
history
|
| 15 |
-
|
| 16 |
-
Returns:
|
| 17 |
-
|
| 18 |
"""
|
| 19 |
# Validate inputs
|
| 20 |
if not persona or persona not in PERSONAS:
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from config import DEFAULT_PERSONA
|
| 4 |
from prompts import PERSONAS
|
| 5 |
from utils import generate_response
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
def handle_message(persona, user_input, history):
|
| 9 |
+
"""Process a chat message and return updated history.
|
| 10 |
+
|
|
|
|
| 11 |
Args:
|
| 12 |
+
persona: Selected chat persona
|
| 13 |
+
user_input: User's message
|
| 14 |
+
history: Previous chat messages
|
| 15 |
+
|
| 16 |
+
Returns:
|
| 17 |
+
Updated chat history with new messages
|
| 18 |
"""
|
| 19 |
# Validate inputs
|
| 20 |
if not persona or persona not in PERSONAS:
|