milwright commited on
Commit
64506f7
·
verified ·
1 Parent(s): 9791c26

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +6 -6
  2. config.json +4 -4
app.py CHANGED
@@ -10,11 +10,11 @@ import urllib.parse
10
 
11
 
12
  # Configuration
13
- SPACE_NAME = "Virgil Research Guide"
14
  SPACE_DESCRIPTION = "A customizable AI assistant"
15
 
16
  # Default configuration values
17
- DEFAULT_SYSTEM_PROMPT = """You are a research aid specializing in academic literature search and analysis. Your expertise spans discovering peer-reviewed sources, assessing research methodologies, synthesizing findings across studies, and delivering properly formatted citations. When responding, anchor claims in specific sources from provided URL contexts, differentiate between direct evidence and interpretive analysis, and note any limitations or contradictory results. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation."""
18
  DEFAULT_TEMPERATURE = 0.7
19
  DEFAULT_MAX_TOKENS = 750
20
 
@@ -35,7 +35,7 @@ except:
35
 
36
  MODEL = "google/gemini-2.0-flash-001"
37
  THEME = "Default" # Gradio theme name
38
- GROUNDING_URLS = ["https://bcc-cuny.libguides.com/", "https://researchguides.journalism.cuny.edu/"]
39
  # Get access code from environment variable for security
40
  # If ACCESS_CODE is not set, no access control is applied
41
  ACCESS_CODE = os.environ.get("ACCESS_CODE")
@@ -549,7 +549,7 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
549
  fn=store_and_generate_response, # Use wrapper function to store history
550
  title="", # Title already shown above
551
  description="", # Description already shown above
552
- examples=['Help me prepare for ethnographic fieldwork?', 'What are some methods of digital ethnography?'],
553
  type="messages" # Use modern message format for better compatibility
554
  )
555
 
@@ -779,7 +779,7 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
779
  'locked': lock_config_from_args,
780
  'last_modified': datetime.now().isoformat(),
781
  'last_modified_by': 'faculty'
782
- }
783
 
784
  try:
785
  with open('config.json', 'w') as f:
@@ -788,7 +788,7 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
788
  # Reload all configuration values
789
  reload_config_values()
790
 
791
- return f"✅ Configuration saved successfully at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}"
792
  except Exception as e:
793
  return f"❌ Error saving configuration: {str(e)}"
794
 
 
10
 
11
 
12
  # Configuration
13
+ SPACE_NAME = "AI Assistant"
14
  SPACE_DESCRIPTION = "A customizable AI assistant"
15
 
16
  # Default configuration values
17
+ DEFAULT_SYSTEM_PROMPT = """You are a research aid specializing in academic literature search and analysis. Your expertise spans discovering peer-reviewed sources, assessing research methodologies, synthesizing findings across studies, and delivering properly formatted citations. When responding, anchor claims in specific sources from provided URL contexts, differentiate between direct evidence and interpretive analysis, and note any limitations or contradictory results. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation. Always help, never answer; guide, do not describe."""
18
  DEFAULT_TEMPERATURE = 0.7
19
  DEFAULT_MAX_TOKENS = 750
20
 
 
35
 
36
  MODEL = "google/gemini-2.0-flash-001"
37
  THEME = "Default" # Gradio theme name
38
+ GROUNDING_URLS = []
39
  # Get access code from environment variable for security
40
  # If ACCESS_CODE is not set, no access control is applied
41
  ACCESS_CODE = os.environ.get("ACCESS_CODE")
 
549
  fn=store_and_generate_response, # Use wrapper function to store history
550
  title="", # Title already shown above
551
  description="", # Description already shown above
552
+ examples=['What are peer-reviewed sources?', 'Synthesize two claims for me'],
553
  type="messages" # Use modern message format for better compatibility
554
  )
555
 
 
779
  'locked': lock_config_from_args,
780
  'last_modified': datetime.now().isoformat(),
781
  'last_modified_by': 'faculty'
782
+ })
783
 
784
  try:
785
  with open('config.json', 'w') as f:
 
788
  # Reload all configuration values
789
  reload_config_values()
790
 
791
+ return f"✅ Configuration saved successfully at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n⚠️ **Important**: For theme and interface changes to take full effect, please restart the Space by clicking 'Settings' → 'Restart Space' in your HuggingFace Space settings."
792
  except Exception as e:
793
  return f"❌ Error saving configuration: {str(e)}"
794
 
config.json CHANGED
@@ -1,13 +1,13 @@
1
  {
2
- "name": "Virgil Research Guide",
3
  "description": "A customizable AI assistant",
4
- "system_prompt": "You are a research aid specializing in academic literature search and analysis. Your expertise spans discovering peer-reviewed sources, assessing research methodologies, synthesizing findings across studies, and delivering properly formatted citations. When responding, anchor claims in specific sources from provided URL contexts, differentiate between direct evidence and interpretive analysis, and note any limitations or contradictory results. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation.",
5
  "model": "google/gemini-2.0-flash-001",
6
  "api_key_var": "API_KEY",
7
  "temperature": 0.7,
8
  "max_tokens": 750,
9
- "examples": "['Help me prepare for ethnographic fieldwork?', 'What are some methods of digital ethnography?']",
10
- "grounding_urls": "[\"https://bcc-cuny.libguides.com/\", \"https://researchguides.journalism.cuny.edu/\"]",
11
  "enable_dynamic_urls": true,
12
  "theme": "Default"
13
  }
 
1
  {
2
+ "name": "AI Assistant",
3
  "description": "A customizable AI assistant",
4
+ "system_prompt": "You are a research aid specializing in academic literature search and analysis. Your expertise spans discovering peer-reviewed sources, assessing research methodologies, synthesizing findings across studies, and delivering properly formatted citations. When responding, anchor claims in specific sources from provided URL contexts, differentiate between direct evidence and interpretive analysis, and note any limitations or contradictory results. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation. Always help, never answer; guide, do not describe.",
5
  "model": "google/gemini-2.0-flash-001",
6
  "api_key_var": "API_KEY",
7
  "temperature": 0.7,
8
  "max_tokens": 750,
9
+ "examples": "['What are peer-reviewed sources?', 'Synthesize two claims for me']",
10
+ "grounding_urls": "[]",
11
  "enable_dynamic_urls": true,
12
  "theme": "Default"
13
  }