milwright commited on
Commit
483d334
Β·
1 Parent(s): 663172e

refactor: move docs to support_docs.py module with updated content

Browse files
Files changed (2) hide show
  1. app.py +2 -210
  2. support_docs.py +152 -79
app.py CHANGED
@@ -604,8 +604,8 @@ class SpaceGenerator:
604
 
605
  def _create_documentation_tab(self):
606
  """Create the documentation tab"""
607
- with gr.Column():
608
- gr.Markdown(self._get_support_docs())
609
 
610
  def _apply_template(self, template_name, prev_template, cache,
611
  name, tagline, desc, prompt, model, temp, tokens, *args):
@@ -938,214 +938,6 @@ huggingface-hub>=0.20.0"""
938
  **System Prompt:**
939
  {config.get('system_prompt', 'Not set')}"""
940
 
941
- def _get_support_docs(self):
942
- """Get support documentation content"""
943
- return """# ChatUI Helper Documentation
944
-
945
- Welcome to ChatUI Helper! This tool helps you create customizable AI chat interfaces for deployment on HuggingFace Spaces.
946
-
947
- <details open>
948
- <summary><h2>πŸš€ Quick Start Guide</h2></summary>
949
-
950
- 1. **Configure** your assistant using templates or custom settings
951
- 2. **Preview** your configuration to test it works
952
- 3. **Generate** your deployment package
953
- 4. **Deploy** to HuggingFace Spaces
954
-
955
- </details>
956
-
957
- <details>
958
- <summary><h2>πŸ“ Step 1: Configure Your Space</h2></summary>
959
-
960
- The **Configuration Tab** provides these sections:
961
-
962
- ### 1. Quick Start Templates
963
- - Choose from pre-configured academic templates
964
- - Or start with "None (Custom)" for full control
965
- - Your custom values are preserved when switching templates
966
-
967
- ### 2. Space Identity
968
- - **Assistant Name**: Your AI assistant's display name
969
- - **Theme**: Choose from Default, Soft, Glass, Monochrome, or Base
970
- - **Tagline**: Brief description (60 chars max) for the Space header
971
- - **Description**: Full markdown description for the README
972
-
973
- ### 3. System Configuration
974
- - **System Prompt**: Define your assistant's behavior and knowledge
975
- - **Model**: Select from available OpenRouter models
976
- - **Temperature**: Control response creativity (0-2)
977
- - **Max Tokens**: Set response length limit (50-4096)
978
-
979
- ### 4. Example Prompts
980
- - Add 3-5 sample prompts that showcase capabilities
981
- - These appear as quick-start buttons for users
982
- - Use the βž•/βž– buttons to add/remove examples
983
-
984
- ### 5. URL Grounding
985
- - Add reference URLs for context (up to 10)
986
- - First 2 URLs are primary sources (always loaded)
987
- - Additional URLs are secondary references
988
- - Content is fetched and provided as context
989
-
990
- ### 6. API Configuration
991
- - **API_KEY**: Required OpenRouter API key variable
992
- - **HF_TOKEN**: Optional for auto-configuration updates
993
- - **ACCESS_CODE**: Optional password protection
994
-
995
- ### 7. Upload Configuration
996
- - Import existing config.json files
997
- - Quickly restore previous configurations
998
-
999
- </details>
1000
-
1001
- <details>
1002
- <summary><h2>πŸ’¬ Step 2: Preview Your Assistant</h2></summary>
1003
-
1004
- The **Preview Tab** allows you to:
1005
-
1006
- ### Test Configuration
1007
- - Sends real API requests using your local API key
1008
- - Uses the exact configuration from Step 1
1009
- - Displays responses in the chat interface
1010
-
1011
- ### Features Available
1012
- - Try example prompts
1013
- - Upload files (if enabled)
1014
- - Export conversation history
1015
- - View active configuration
1016
-
1017
- ### API Key Setup
1018
- - Set your OpenRouter API key as environment variable
1019
- - Default variable name: `API_KEY`
1020
- - Get your key at: https://openrouter.ai/keys
1021
-
1022
- </details>
1023
-
1024
- <details>
1025
- <summary><h2>πŸ—³οΈ Step 3: Generate Deployment Package</h2></summary>
1026
-
1027
- Click **Generate Deployment Package** to create:
1028
-
1029
- ### Package Contents
1030
- - **app.py**: Complete Gradio application
1031
- - **requirements.txt**: Python dependencies
1032
- - **config.json**: Configuration backup
1033
- - **README.md**: Deployment instructions
1034
-
1035
- ### Deployment Steps
1036
- 1. Download the generated ZIP file
1037
- 2. Create a new HuggingFace Space
1038
- 3. Upload all files from the package
1039
- 4. Configure secrets in Space settings
1040
-
1041
- </details>
1042
-
1043
- <details>
1044
- <summary><h2>πŸ”‘ HuggingFace Secrets Setup</h2></summary>
1045
-
1046
- ### Required Secret
1047
- **API_KEY** (or your configured variable name)
1048
- - Get from: https://openrouter.ai/keys
1049
- - Must start with: `sk-or-`
1050
- - Add in: Settings β†’ Variables and secrets
1051
-
1052
- ### Optional Secrets
1053
- **HF_TOKEN**
1054
- - Enables automatic configuration updates
1055
- - Get from: https://huggingface.co/settings/tokens
1056
- - Needs write permissions
1057
-
1058
- **ACCESS_CODE**
1059
- - Password protects your Space
1060
- - Set any password value
1061
- - Share with authorized users only
1062
-
1063
- ### How to Add Secrets
1064
- 1. Go to your Space Settings (βš™οΈ icon)
1065
- 2. Find "Variables and secrets" section
1066
- 3. Click "New secret"
1067
- 4. Enter the variable name and value
1068
- 5. Save your changes
1069
-
1070
- </details>
1071
-
1072
- <details>
1073
- <summary><h2>🎨 Template System</h2></summary>
1074
-
1075
- ### Available Templates
1076
- - **STEM Adventure Games**: Interactive STEM learning
1077
- - **Socratic Dialogue Partner**: Philosophical discussions
1078
- - **Business Strategy Advisor**: Strategic planning assistant
1079
- - **Creative Writing Coach**: Writing improvement helper
1080
- - **Research Assistant**: Academic research support
1081
-
1082
- ### Template Features
1083
- - Pre-configured prompts and examples
1084
- - Optimized model settings
1085
- - Relevant grounding URLs
1086
- - Domain-specific system prompts
1087
-
1088
- ### Custom Values
1089
- - Your custom settings are preserved
1090
- - Switch templates without losing work
1091
- - Return to "None (Custom)" to restore
1092
-
1093
- </details>
1094
-
1095
- <details>
1096
- <summary><h2>πŸ”§ Troubleshooting</h2></summary>
1097
-
1098
- ### Common Issues
1099
-
1100
- **Build Errors**
1101
- - Check requirements.txt compatibility
1102
- - Ensure Gradio version β‰₯ 5.39.0
1103
- - Verify all dependencies are available
1104
-
1105
- **API Errors**
1106
- - Verify API_KEY is set correctly
1107
- - Check API key starts with 'sk-or-'
1108
- - Ensure you have API credits
1109
-
1110
- **Access Issues**
1111
- - ACCESS_CODE must match exactly
1112
- - Check for extra spaces in password
1113
- - Verify secret is properly saved
1114
-
1115
- **Preview Not Working**
1116
- - Set API_KEY in local environment
1117
- - Check browser console for errors
1118
- - Ensure configuration is saved
1119
-
1120
- </details>
1121
-
1122
- <details>
1123
- <summary><h2>πŸ’‘ Tips & Best Practices</h2></summary>
1124
-
1125
- ### System Prompts
1126
- - Be specific about capabilities
1127
- - Include examples of desired behavior
1128
- - Set clear boundaries and limitations
1129
-
1130
- ### Model Selection
1131
- - Gemini Flash: Fast, cost-effective
1132
- - Claude Sonnet: High quality reasoning
1133
- - GPT-4: Broad knowledge base
1134
- - Llama: Open source alternative
1135
-
1136
- ### URL Grounding
1137
- - Use authoritative sources
1138
- - Keep URLs up to date
1139
- - Primary URLs load on every request
1140
- - Secondary URLs provide additional context
1141
-
1142
- ### Security
1143
- - Never commit API keys to code
1144
- - Use environment variables only
1145
- - Enable ACCESS_CODE for sensitive Spaces
1146
- - Regularly rotate API keys
1147
-
1148
- </details>"""
1149
 
1150
  def _create_readme(self, title, tagline, description, model, api_key_var, access_code):
1151
  """Create README.md content"""
 
604
 
605
  def _create_documentation_tab(self):
606
  """Create the documentation tab"""
607
+ from support_docs import create_support_docs
608
+ create_support_docs()
609
 
610
  def _apply_template(self, template_name, prev_template, cache,
611
  name, tagline, desc, prompt, model, temp, tokens, *args):
 
938
  **System Prompt:**
939
  {config.get('system_prompt', 'Not set')}"""
940
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
941
 
942
  def _create_readme(self, title, tagline, description, model, api_key_var, access_code):
943
  """Create README.md content"""
support_docs.py CHANGED
@@ -10,95 +10,112 @@ def create_support_docs():
10
  """Create the support documentation interface with accordion menus"""
11
 
12
  with gr.Column():
13
- gr.Markdown("# Support Documentation")
14
- gr.Markdown("Step-by-step guidance for creating and deploying chat interfaces with HuggingFace Spaces.")
15
 
16
- with gr.Accordion("πŸš€ Getting Started", open=True):
17
  gr.Markdown("""
18
- # Quick Start
19
 
20
- Build a functional assistant with URL grounding.
21
-
22
- **Steps:**
23
- 1. Configure space settings and system prompt
24
- 2. Enable URL grounding tools
25
- 3. Preview and test
26
- 4. Generate deployment package
27
- 5. Deploy to HuggingFace
28
 
29
  **Requirements:**
30
  - HuggingFace account (free)
31
  - OpenRouter API key
32
- - Basic AI chatbot knowledge
33
  """)
34
 
35
- with gr.Accordion("βš™οΈ Configuration Guide", open=False):
36
  gr.Markdown("""
37
- ### Essential Settings
38
-
39
- **System Prompt** - Define your assistant's role, behavior, and capabilities
40
 
41
- **Model Selection:**
42
- - **Gemini 2.0 Flash** - Fast, reliable (recommended)
43
- - **Gemma 3 27B** - Open-source, cost-effective
44
- - **Claude 3.5 Haiku** - Advanced reasoning
45
 
46
- **System Prompt & Templates:**
47
- - **Custom** - Write your own specific instructions
48
- - **Research Template** - Academic work, citations, fact-checking
49
- - **Socratic Template** - Teaching through questions, critical thinking
 
50
 
51
- **URL Grounding (up to 10 URLs)** - Static content for consistent context
 
 
 
 
52
 
53
- **URL Priority System:**
54
- - **Primary URLs (2)**: Main references (syllabus, textbook) - always processed first with highest priority
55
- - **Secondary URLs (8)**: Supplementary sources - additional context as needed
 
56
 
57
- The system processes URLs in order of priority, ensuring your most important content is always included in the assistant's context.
 
 
 
 
58
 
59
- **Example Prompts Guidelines:**
60
- - One prompt per line, under 100 characters
61
- - Show assistant capabilities
62
- - Examples: "Explain [topic] in simple terms", "Help prepare for exam", "Analyze this source: [URL]"
63
 
64
- **Advanced Parameters:**
65
- - **Temperature (0.0-2.0)**: 0.0-0.3 (focused), 0.4-0.7 (balanced), 0.8+ (creative)
66
- - **Max Tokens (50-4096)**: 750 recommended for balanced responses
67
- - **API Key Variable**: Default `OPENROUTER_API_KEY`
68
- - **Access Code**: Optional student protection
69
  """)
70
 
71
- with gr.Accordion("πŸ”¬ Preview & Testing", open=False):
72
  gr.Markdown("""
73
- ### Pre-Deployment Testing
 
 
 
 
 
74
 
75
- **Preview Steps:**
76
- 1. Complete Configuration tab setup
77
- 2. Click "Preview Deployment Package"
78
- 3. Test chat interface and URL grounding
79
- 4. Export conversations for documentation
80
 
81
- **Requirements:** Set `OPENROUTER_API_KEY` environment variable for full testing
 
 
 
82
 
83
  **Test Checklist:**
84
  - Various query types and assistant responses
85
- - URL grounding functionality (if enabled)
86
  - System prompt behavior matches expectations
87
  - Example prompts work correctly
88
  """)
89
 
90
- with gr.Accordion("πŸš€ HuggingFace Space Deployment", open=False):
91
  gr.Markdown("""
92
- ### Complete Deployment Workflow
93
 
94
- **Overview:** Generate Package β†’ Create Space β†’ Upload Files β†’ Configure Secrets β†’ Monitor Build β†’ Verify Configuration
 
 
 
 
 
 
95
  """)
96
 
97
  with gr.Accordion("Step 1: Generate & Create Space", open=False):
98
  gr.Markdown("""
99
  **1.1 Generate Deployment Package**
100
- - Click "Generate Deployment Package" and download zip
101
- - Extract files: `app.py`, `config.json`, `requirements.txt`
 
102
 
103
  **1.2 Create New Space**
104
  - Go to [huggingface.co/spaces](https://huggingface.co/spaces)
@@ -163,10 +180,19 @@ def create_support_docs():
163
  - Click "New secret"
164
 
165
  **Required Secret:**
166
- - **OPENROUTER_API_KEY**: Set this to your OpenRouter API key value
 
 
 
 
 
 
 
 
167
 
168
- **Optional Secret:**
169
- - **SPACE_ACCESS_CODE**: Set this to your desired access code value for student access control
 
170
 
171
  **Access Control Notes:**
172
  - If you don't create the `SPACE_ACCESS_CODE` secret, your Space will be publicly accessible
@@ -251,54 +277,101 @@ def create_support_docs():
251
  gr.Markdown("""
252
  ### Common Issues and Solutions
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  **Configuration Status Shows Red X:**
255
- - Verify API key secret name matches configuration (usually `OPENROUTER_API_KEY`)
256
  - Check OpenRouter account has credits
257
  - Regenerate API key if needed
 
 
 
 
 
 
 
 
 
 
258
 
259
- **Build Failed:**
260
- - Check `requirements.txt` formatting (no extra spaces)
261
- - Try reuploading files if build gets stuck
262
- - Monitor build logs for specific errors
 
263
 
264
- **API Errors:**
265
- - **401 Unauthorized**: Invalid API key or incorrect secret name
266
- - **429 Rate Limited**: Wait a few minutes, consider upgrading OpenRouter plan
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
 
268
- **Access Issues:**
269
- - **Access code not working**: Verify `SPACE_ACCESS_CODE` secret is set correctly (case-sensitive)
270
- - **URLs not fetching**: Check URLs are publicly accessible, some sites block automated requests
 
 
 
 
 
 
 
 
271
  """)
272
 
273
  with gr.Accordion("πŸ“š Additional Resources", open=False):
274
  gr.Markdown("""
275
- ### Helpful Links
276
 
277
- **HuggingFace Documentation**
278
  - [Spaces Overview](https://huggingface.co/docs/hub/spaces-overview)
279
  - [Gradio on Spaces](https://huggingface.co/docs/hub/spaces-gradio)
280
  - [Environment Variables](https://huggingface.co/docs/hub/spaces-overview#managing-secrets)
281
 
282
- **OpenRouter Documentation**
283
  - [API Keys](https://openrouter.ai/keys)
284
  - [Model Comparison](https://openrouter.ai/models)
285
  - [Pricing](https://openrouter.ai/docs#models)
286
 
287
- **Gradio Documentation**
288
  - [Chat Interface](https://gradio.app/docs/chatinterface)
289
  - [Components](https://gradio.app/docs/)
290
  - [Sharing Apps](https://gradio.app/sharing-your-app/)
291
 
292
  **Community Support**
293
- - [HuggingFace Community Forums](https://discuss.huggingface.co/)
294
  - [Gradio Discord](https://discord.gg/feTf9x3ZSB)
295
-
296
- **Educational Use Cases**
297
- - Course assistants for Q&A
298
- - Research writing support
299
- - Study guide generation
300
- - Document analysis tools
301
- - Language practice partners
302
  """)
303
 
304
  def export_conversation_to_markdown(conversation_history, config_metadata=None):
 
10
  """Create the support documentation interface with accordion menus"""
11
 
12
  with gr.Column():
13
+ gr.Markdown("# ChatUI Helper Documentation")
14
+ gr.Markdown("Welcome to ChatUI Helper! This tool helps you create customizable AI chat interfaces for deployment on HuggingFace Spaces.")
15
 
16
+ with gr.Accordion("πŸš€ Quick Start Guide", open=True):
17
  gr.Markdown("""
18
+ ## Quick Start Guide
19
 
20
+ 1. **Configure** your assistant using templates or custom settings
21
+ 2. **Preview** your configuration to test it works
22
+ 3. **Generate** your deployment package
23
+ 4. **Deploy** to HuggingFace Spaces
 
 
 
 
24
 
25
  **Requirements:**
26
  - HuggingFace account (free)
27
  - OpenRouter API key
28
+ - Basic understanding of AI assistants
29
  """)
30
 
31
+ with gr.Accordion("πŸ“ Step 1: Configure Your Space", open=False):
32
  gr.Markdown("""
33
+ ### Configuration Tab Sections
 
 
34
 
35
+ **1. Quick Start Templates**
36
+ - Choose from pre-configured academic templates
37
+ - Or start with "None (Custom)" for full control
38
+ - Your custom values are preserved when switching templates
39
 
40
+ **2. Space Identity**
41
+ - **Assistant Name**: Your AI assistant's display name
42
+ - **Theme**: Choose from Default, Soft, Glass, Monochrome, or Base
43
+ - **Tagline**: Brief description (60 chars max) for the Space header
44
+ - **Description**: Full markdown description for the README
45
 
46
+ **3. System Configuration**
47
+ - **System Prompt**: Define your assistant's behavior and knowledge
48
+ - **Model**: Select from available OpenRouter models
49
+ - **Temperature**: Control response creativity (0-2)
50
+ - **Max Tokens**: Set response length limit (50-4096)
51
 
52
+ **4. Example Prompts**
53
+ - Add 3-5 sample prompts that showcase capabilities
54
+ - These appear as quick-start buttons for users
55
+ - Use the βž•/βž– buttons to add/remove examples
56
 
57
+ **5. URL Grounding**
58
+ - Add reference URLs for context (up to 10)
59
+ - First 2 URLs are primary sources (always loaded)
60
+ - Additional URLs are secondary references
61
+ - Content is fetched and provided as context
62
 
63
+ **6. API Configuration**
64
+ - **API_KEY**: Required OpenRouter API key variable
65
+ - **HF_TOKEN**: Optional for auto-configuration updates
66
+ - **ACCESS_CODE**: Optional password protection
67
 
68
+ **7. Upload Configuration**
69
+ - Import existing config.json files
70
+ - Quickly restore previous configurations
 
 
71
  """)
72
 
73
+ with gr.Accordion("πŸ’¬ Step 2: Preview Your Assistant", open=False):
74
  gr.Markdown("""
75
+ ### Preview Tab Features
76
+
77
+ **Test Configuration**
78
+ - Sends real API requests using your local API key
79
+ - Uses the exact configuration from Step 1
80
+ - Displays responses in the chat interface
81
 
82
+ **Features Available**
83
+ - Try example prompts
84
+ - Upload files (if enabled)
85
+ - Export conversation history
86
+ - View active configuration
87
 
88
+ **API Key Setup**
89
+ - Set your OpenRouter API key as environment variable
90
+ - Default variable name: `API_KEY`
91
+ - Get your key at: https://openrouter.ai/keys
92
 
93
  **Test Checklist:**
94
  - Various query types and assistant responses
95
+ - URL grounding functionality (if configured)
96
  - System prompt behavior matches expectations
97
  - Example prompts work correctly
98
  """)
99
 
100
+ with gr.Accordion("πŸ—³οΈ Step 3: Generate & Deploy", open=False):
101
  gr.Markdown("""
102
+ ### Deployment Package & HuggingFace Space Setup
103
 
104
+ **Package Contents:**
105
+ - **app.py**: Complete Gradio application
106
+ - **requirements.txt**: Python dependencies
107
+ - **config.json**: Configuration backup
108
+ - **README.md**: Deployment instructions
109
+
110
+ **Deployment Overview:** Generate Package β†’ Create Space β†’ Upload Files β†’ Configure Secrets β†’ Monitor Build β†’ Verify
111
  """)
112
 
113
  with gr.Accordion("Step 1: Generate & Create Space", open=False):
114
  gr.Markdown("""
115
  **1.1 Generate Deployment Package**
116
+ - Click "πŸ—³οΈ Generate Deployment Package" in Configuration tab
117
+ - Download the generated ZIP file
118
+ - Extract files: `app.py`, `config.json`, `requirements.txt`, `README.md`
119
 
120
  **1.2 Create New Space**
121
  - Go to [huggingface.co/spaces](https://huggingface.co/spaces)
 
180
  - Click "New secret"
181
 
182
  **Required Secret:**
183
+ - **API_KEY** (or your configured variable name)
184
+ - Get from: https://openrouter.ai/keys
185
+ - Must start with: `sk-or-`
186
+ - Add in: Settings β†’ Variables and secrets
187
+
188
+ **Optional Secrets:**
189
+ - **HF_TOKEN**: Enables automatic configuration updates
190
+ - Get from: https://huggingface.co/settings/tokens
191
+ - Needs write permissions
192
 
193
+ - **ACCESS_CODE**: Password protects your Space
194
+ - Set any password value
195
+ - Share with authorized users only
196
 
197
  **Access Control Notes:**
198
  - If you don't create the `SPACE_ACCESS_CODE` secret, your Space will be publicly accessible
 
277
  gr.Markdown("""
278
  ### Common Issues and Solutions
279
 
280
+ **Build Errors**
281
+ - Check requirements.txt compatibility
282
+ - Ensure Gradio version β‰₯ 5.39.0
283
+ - Verify all dependencies are available
284
+
285
+ **API Errors**
286
+ - Verify API_KEY is set correctly
287
+ - Check API key starts with 'sk-or-'
288
+ - Ensure you have API credits
289
+
290
+ **Access Issues**
291
+ - ACCESS_CODE must match exactly
292
+ - Check for extra spaces in password
293
+ - Verify secret is properly saved
294
+
295
+ **Preview Not Working**
296
+ - Set API_KEY in local environment
297
+ - Check browser console for errors
298
+ - Ensure configuration is saved
299
+
300
  **Configuration Status Shows Red X:**
301
+ - Verify API key secret name matches configuration
302
  - Check OpenRouter account has credits
303
  - Regenerate API key if needed
304
+ """)
305
+
306
+ with gr.Accordion("🎨 Template System", open=False):
307
+ gr.Markdown("""
308
+ ### Available Templates
309
+ - **STEM Adventure Games**: Interactive STEM learning
310
+ - **Socratic Dialogue Partner**: Philosophical discussions
311
+ - **Business Strategy Advisor**: Strategic planning assistant
312
+ - **Creative Writing Coach**: Writing improvement helper
313
+ - **Research Assistant**: Academic research support
314
 
315
+ ### Template Features
316
+ - Pre-configured prompts and examples
317
+ - Optimized model settings
318
+ - Relevant grounding URLs
319
+ - Domain-specific system prompts
320
 
321
+ ### Custom Values
322
+ - Your custom settings are preserved
323
+ - Switch templates without losing work
324
+ - Return to "None (Custom)" to restore
325
+ """)
326
+
327
+ with gr.Accordion("πŸ’‘ Tips & Best Practices", open=False):
328
+ gr.Markdown("""
329
+ ### System Prompts
330
+ - Be specific about capabilities
331
+ - Include examples of desired behavior
332
+ - Set clear boundaries and limitations
333
+
334
+ ### Model Selection
335
+ - Gemini Flash: Fast, cost-effective
336
+ - Claude Sonnet: High quality reasoning
337
+ - GPT-4: Broad knowledge base
338
+ - Llama: Open source alternative
339
 
340
+ ### URL Grounding
341
+ - Use authoritative sources
342
+ - Keep URLs up to date
343
+ - Primary URLs load on every request
344
+ - Secondary URLs provide additional context
345
+
346
+ ### Security
347
+ - Never commit API keys to code
348
+ - Use environment variables only
349
+ - Enable ACCESS_CODE for sensitive Spaces
350
+ - Regularly rotate API keys
351
  """)
352
 
353
  with gr.Accordion("πŸ“š Additional Resources", open=False):
354
  gr.Markdown("""
355
+ ### Documentation Links
356
 
357
+ **HuggingFace**
358
  - [Spaces Overview](https://huggingface.co/docs/hub/spaces-overview)
359
  - [Gradio on Spaces](https://huggingface.co/docs/hub/spaces-gradio)
360
  - [Environment Variables](https://huggingface.co/docs/hub/spaces-overview#managing-secrets)
361
 
362
+ **OpenRouter**
363
  - [API Keys](https://openrouter.ai/keys)
364
  - [Model Comparison](https://openrouter.ai/models)
365
  - [Pricing](https://openrouter.ai/docs#models)
366
 
367
+ **Gradio**
368
  - [Chat Interface](https://gradio.app/docs/chatinterface)
369
  - [Components](https://gradio.app/docs/)
370
  - [Sharing Apps](https://gradio.app/sharing-your-app/)
371
 
372
  **Community Support**
373
+ - [HuggingFace Forums](https://discuss.huggingface.co/)
374
  - [Gradio Discord](https://discord.gg/feTf9x3ZSB)
 
 
 
 
 
 
 
375
  """)
376
 
377
  def export_conversation_to_markdown(conversation_history, config_metadata=None):