milwright commited on
Commit
40ef35b
·
verified ·
1 Parent(s): 6a5848e

Upload 3 files

Browse files
Files changed (2) hide show
  1. app.py +4 -12
  2. config.json +3 -3
app.py CHANGED
@@ -10,8 +10,8 @@ import urllib.parse
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 = {
@@ -22,7 +22,7 @@ DEFAULT_CONFIG = {
22
  'max_tokens': 750,
23
  'model': 'google/gemini-2.0-flash-001',
24
  'api_key_var': 'API_KEY',
25
- 'theme': 'Default',
26
  'grounding_urls': '["https://classics.mit.edu/Plato/phaedrus.1b.txt", "https://plato.stanford.edu/entries/plato-rhetoric/#Pha", "https://plato.stanford.edu/entries/plato-myths/", "https://en.wikipedia.org/wiki/Socratic_method", "https://en.wikipedia.org/wiki/Research_methodology", "https://en.wikipedia.org/wiki/Academic_research", "https://www.reddit.com/r/askphilosophy/comments/m6u36v/can_someone_go_over_the_socratic_method_and_give/", "https://www.reddit.com/r/askphilosophy/comments/k5td4z/is_socratic_method_the_best_way_to_change/"]',
27
  'enable_dynamic_urls': True,
28
  'examples': ['Can you help me understand why the sky is blue?', 'What makes democracy different from other forms of government?', 'How does the Socratic method apply to modern education?'],
@@ -604,19 +604,11 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
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(
 
10
 
11
 
12
  # Configuration
13
+ SPACE_NAME = 'AI Assistant'
14
+ SPACE_DESCRIPTION = 'A customizable AI assistant'
15
 
16
  # Default configuration values (used only if config.json is missing)
17
  DEFAULT_CONFIG = {
 
22
  'max_tokens': 750,
23
  'model': 'google/gemini-2.0-flash-001',
24
  'api_key_var': 'API_KEY',
25
+ 'theme': 'Monochrome',
26
  'grounding_urls': '["https://classics.mit.edu/Plato/phaedrus.1b.txt", "https://plato.stanford.edu/entries/plato-rhetoric/#Pha", "https://plato.stanford.edu/entries/plato-myths/", "https://en.wikipedia.org/wiki/Socratic_method", "https://en.wikipedia.org/wiki/Research_methodology", "https://en.wikipedia.org/wiki/Academic_research", "https://www.reddit.com/r/askphilosophy/comments/m6u36v/can_someone_go_over_the_socratic_method_and_give/", "https://www.reddit.com/r/askphilosophy/comments/k5td4z/is_socratic_method_the_best_way_to_change/"]',
27
  'enable_dynamic_urls': True,
28
  'examples': ['Can you help me understand why the sky is blue?', 'What makes democracy different from other forms of government?', 'How does the Socratic method apply to modern education?'],
 
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=examples if examples else None,
612
  type="messages", # Use modern message format for better compatibility
613
  additional_inputs=[
614
  gr.File(
config.json CHANGED
@@ -1,6 +1,6 @@
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",
@@ -22,5 +22,5 @@
22
  "https://www.reddit.com/r/askphilosophy/comments/k5td4z/is_socratic_method_the_best_way_to_change/"
23
  ],
24
  "enable_dynamic_urls": true,
25
- "theme": "Default"
26
  }
 
1
  {
2
+ "name": "AI Assistant",
3
+ "description": "A customizable AI assistant",
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",
 
22
  "https://www.reddit.com/r/askphilosophy/comments/k5td4z/is_socratic_method_the_best_way_to_change/"
23
  ],
24
  "enable_dynamic_urls": true,
25
+ "theme": "Monochrome"
26
  }