Spaces:
Running
Running
milwright
commited on
Commit
Β·
65a68da
1
Parent(s):
65ea2b0
increase primary source character limit to 8000 chars
Browse files- app.py +2 -2
- space_template.py +3 -3
app.py
CHANGED
|
@@ -232,7 +232,7 @@ class SpaceGenerator:
|
|
| 232 |
# Create initial URL inputs
|
| 233 |
for i in range(10):
|
| 234 |
url_input = gr.Textbox(
|
| 235 |
-
label=f"URL {i+1}" + (" (Primary -
|
| 236 |
placeholder="https://...",
|
| 237 |
visible=(i < 2)
|
| 238 |
)
|
|
@@ -549,7 +549,7 @@ class SpaceGenerator:
|
|
| 549 |
grounding_context += "\nπ **PRIMARY SOURCES:**\n"
|
| 550 |
for i, url in enumerate(primary_urls, 1):
|
| 551 |
try:
|
| 552 |
-
content = fetch_url_content(url, max_chars=
|
| 553 |
if not content.startswith("β") and not content.startswith("β±οΈ"):
|
| 554 |
grounding_context += f"\n**Primary Source {i}:** {content}\n"
|
| 555 |
except:
|
|
|
|
| 232 |
# Create initial URL inputs
|
| 233 |
for i in range(10):
|
| 234 |
url_input = gr.Textbox(
|
| 235 |
+
label=f"URL {i+1}" + (" (Primary - 8000 chars)" if i < 2 else " (Secondary - 2500 chars)"),
|
| 236 |
placeholder="https://...",
|
| 237 |
visible=(i < 2)
|
| 238 |
)
|
|
|
|
| 549 |
grounding_context += "\nπ **PRIMARY SOURCES:**\n"
|
| 550 |
for i, url in enumerate(primary_urls, 1):
|
| 551 |
try:
|
| 552 |
+
content = fetch_url_content(url, max_chars=8000)
|
| 553 |
if not content.startswith("β") and not content.startswith("β±οΈ"):
|
| 554 |
grounding_context += f"\n**Primary Source {i}:** {content}\n"
|
| 555 |
except:
|
space_template.py
CHANGED
|
@@ -301,7 +301,7 @@ def get_grounding_context() -> str:
|
|
| 301 |
|
| 302 |
context_parts = []
|
| 303 |
|
| 304 |
-
# Process primary sources (first 2 URLs with
|
| 305 |
primary_urls = urls[:2]
|
| 306 |
if primary_urls:
|
| 307 |
context_parts.append("π **PRIMARY SOURCES:**\\n")
|
|
@@ -309,7 +309,7 @@ def get_grounding_context() -> str:
|
|
| 309 |
if url in _url_content_cache:
|
| 310 |
content = _url_content_cache[url]
|
| 311 |
else:
|
| 312 |
-
content = fetch_url_content(url, max_length=
|
| 313 |
_url_content_cache[url] = content
|
| 314 |
|
| 315 |
if not content.startswith("β") and not content.startswith("β±οΈ"):
|
|
@@ -843,7 +843,7 @@ def create_interface():
|
|
| 843 |
placeholder="https://example.com/docs\\nhttps://example.com/api",
|
| 844 |
value='\\n'.join(config.get('grounding_urls', [])),
|
| 845 |
lines=5,
|
| 846 |
-
info="First 2 URLs: Primary sources (
|
| 847 |
)
|
| 848 |
|
| 849 |
with gr.Row():
|
|
|
|
| 301 |
|
| 302 |
context_parts = []
|
| 303 |
|
| 304 |
+
# Process primary sources (first 2 URLs with 8000 char limit)
|
| 305 |
primary_urls = urls[:2]
|
| 306 |
if primary_urls:
|
| 307 |
context_parts.append("π **PRIMARY SOURCES:**\\n")
|
|
|
|
| 309 |
if url in _url_content_cache:
|
| 310 |
content = _url_content_cache[url]
|
| 311 |
else:
|
| 312 |
+
content = fetch_url_content(url, max_length=8000)
|
| 313 |
_url_content_cache[url] = content
|
| 314 |
|
| 315 |
if not content.startswith("β") and not content.startswith("β±οΈ"):
|
|
|
|
| 843 |
placeholder="https://example.com/docs\\nhttps://example.com/api",
|
| 844 |
value='\\n'.join(config.get('grounding_urls', [])),
|
| 845 |
lines=5,
|
| 846 |
+
info="First 2 URLs: Primary sources (8000 chars). URLs 3+: Secondary sources (2500 chars)."
|
| 847 |
)
|
| 848 |
|
| 849 |
with gr.Row():
|