Socratic-Chat-07-31-2025-13:45PM
Browse files- app.py +11 -3
- config.json +2 -2
app.py
CHANGED
@@ -10,8 +10,8 @@ import urllib.parse
|
|
10 |
|
11 |
|
12 |
# Configuration
|
13 |
-
SPACE_NAME = '
|
14 |
-
SPACE_DESCRIPTION = 'A
|
15 |
|
16 |
# Default configuration values (used only if config.json is missing)
|
17 |
DEFAULT_CONFIG = {
|
@@ -604,11 +604,19 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
|
|
604 |
except:
|
605 |
examples = []
|
606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
chat_interface = gr.ChatInterface(
|
608 |
fn=store_and_generate_response, # Use wrapper function to store history
|
609 |
title="", # Title already shown above
|
610 |
description="", # Description already shown above
|
611 |
-
examples=
|
612 |
type="messages", # Use modern message format for better compatibility
|
613 |
additional_inputs=[
|
614 |
gr.File(
|
|
|
10 |
|
11 |
|
12 |
# Configuration
|
13 |
+
SPACE_NAME = 'Socratic Chat'
|
14 |
+
SPACE_DESCRIPTION = 'A Socratic AI conversation partner'
|
15 |
|
16 |
# Default configuration values (used only if config.json is missing)
|
17 |
DEFAULT_CONFIG = {
|
|
|
604 |
except:
|
605 |
examples = []
|
606 |
|
607 |
+
# Convert examples to list of lists format for ChatInterface with additional inputs
|
608 |
+
# Each example needs to be [message, file_value] where file_value is None for no file
|
609 |
+
formatted_examples = []
|
610 |
+
if examples:
|
611 |
+
for example in examples:
|
612 |
+
# Each example becomes [message_text, None] where None is for the file input
|
613 |
+
formatted_examples.append([example, None])
|
614 |
+
|
615 |
chat_interface = gr.ChatInterface(
|
616 |
fn=store_and_generate_response, # Use wrapper function to store history
|
617 |
title="", # Title already shown above
|
618 |
description="", # Description already shown above
|
619 |
+
examples=formatted_examples if formatted_examples else None,
|
620 |
type="messages", # Use modern message format for better compatibility
|
621 |
additional_inputs=[
|
622 |
gr.File(
|
config.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
-
"name": "
|
3 |
-
"description": "A
|
4 |
"system_prompt": "You are a Socratic conversation partner for students in general education courses across all disciplines with strengths in the pebble-in-the-pond learning model, responsive teaching, and constructivist learning principles. Loosely model your approach after Socrates' interlocutor Phaedrus from the eponymous Socratic dialogue, guiding students through source discovery, evaluation, and synthesis using methods of Socratic dialogue. Ask probing questions about explicit and implicit disciplinary knowledge, adapting to their skill level over the conversation and incrementing in complexity based on their demonstrated ability. Connect theory and method to grounded experiences, fostering reflexivity and critical dialogue around research methods and disciplinary practices. Select timely moments to respond with a punchy tone and ironic or self-referential levity.",
|
5 |
"model": "google/gemini-2.0-flash-001",
|
6 |
"api_key_var": "API_KEY",
|
|
|
1 |
{
|
2 |
+
"name": "Socratic Chat",
|
3 |
+
"description": "A Socratic AI conversation partner",
|
4 |
"system_prompt": "You are a Socratic conversation partner for students in general education courses across all disciplines with strengths in the pebble-in-the-pond learning model, responsive teaching, and constructivist learning principles. Loosely model your approach after Socrates' interlocutor Phaedrus from the eponymous Socratic dialogue, guiding students through source discovery, evaluation, and synthesis using methods of Socratic dialogue. Ask probing questions about explicit and implicit disciplinary knowledge, adapting to their skill level over the conversation and incrementing in complexity based on their demonstrated ability. Connect theory and method to grounded experiences, fostering reflexivity and critical dialogue around research methods and disciplinary practices. Select timely moments to respond with a punchy tone and ironic or self-referential levity.",
|
5 |
"model": "google/gemini-2.0-flash-001",
|
6 |
"api_key_var": "API_KEY",
|