7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
155 lines
5.0 KiB
Python
155 lines
5.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Populate search engine settings in the database
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from loguru import logger
|
|
|
|
# Add parent directory to path
|
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
|
|
|
from local_deep_research.database.models import Setting
|
|
from local_deep_research.utilities.db_utils import get_db_session
|
|
|
|
|
|
def populate_search_engines():
|
|
"""Populate search engine settings in the database"""
|
|
|
|
# Define search engines with their properties
|
|
search_engines = {
|
|
"searxng": {
|
|
"display_name": "SearXNG",
|
|
"description": "Privacy-focused metasearch engine",
|
|
"strengths": ["Privacy", "No tracking", "Multiple sources"],
|
|
},
|
|
"google": {
|
|
"display_name": "Google",
|
|
"description": "Google search engine",
|
|
"strengths": ["Comprehensive", "Fast", "Relevant results"],
|
|
},
|
|
"bing": {
|
|
"display_name": "Bing",
|
|
"description": "Microsoft Bing search engine",
|
|
"strengths": ["Good for technical queries", "Image search", "News"],
|
|
},
|
|
"duckduckgo": {
|
|
"display_name": "DuckDuckGo",
|
|
"description": "Privacy-focused search engine",
|
|
"strengths": ["Privacy", "No tracking", "Instant answers"],
|
|
},
|
|
"wikipedia": {
|
|
"display_name": "Wikipedia",
|
|
"description": "Wikipedia search",
|
|
"strengths": ["Encyclopedic content", "Reliable", "Detailed"],
|
|
},
|
|
"arxiv": {
|
|
"display_name": "arXiv",
|
|
"description": "Scientific paper repository",
|
|
"strengths": ["Academic papers", "Research", "Preprints"],
|
|
},
|
|
"pubmed": {
|
|
"display_name": "PubMed",
|
|
"description": "Medical research database",
|
|
"strengths": ["Medical research", "Clinical studies", "Healthcare"],
|
|
},
|
|
"semantic_scholar": {
|
|
"display_name": "Semantic Scholar",
|
|
"description": "AI-powered research tool",
|
|
"strengths": [
|
|
"Academic search",
|
|
"Citation analysis",
|
|
"AI insights",
|
|
],
|
|
},
|
|
}
|
|
|
|
session = get_db_session()
|
|
|
|
try:
|
|
# Add web search engines
|
|
for engine_name, props in search_engines.items():
|
|
# Display name
|
|
display_setting = Setting(
|
|
key=f"search.engine.web.{engine_name}.display_name",
|
|
value=props["display_name"],
|
|
type="SEARCH",
|
|
category="search",
|
|
name=f"{engine_name} Display Name",
|
|
description=f"Display name for {engine_name}",
|
|
)
|
|
existing = (
|
|
session.query(Setting)
|
|
.filter_by(key=display_setting.key)
|
|
.first()
|
|
)
|
|
if not existing:
|
|
session.add(display_setting)
|
|
logger.info(f"Added {display_setting.key}")
|
|
|
|
# Description
|
|
desc_setting = Setting(
|
|
key=f"search.engine.web.{engine_name}.description",
|
|
value=props["description"],
|
|
type="SEARCH",
|
|
category="search",
|
|
name=f"{engine_name} Description",
|
|
description=f"Description for {engine_name}",
|
|
)
|
|
existing = (
|
|
session.query(Setting).filter_by(key=desc_setting.key).first()
|
|
)
|
|
if not existing:
|
|
session.add(desc_setting)
|
|
logger.info(f"Added {desc_setting.key}")
|
|
|
|
# Strengths
|
|
strengths_setting = Setting(
|
|
key=f"search.engine.web.{engine_name}.strengths",
|
|
value=props["strengths"],
|
|
type="SEARCH",
|
|
category="search",
|
|
name=f"{engine_name} Strengths",
|
|
description=f"Strengths of {engine_name}",
|
|
)
|
|
existing = (
|
|
session.query(Setting)
|
|
.filter_by(key=strengths_setting.key)
|
|
.first()
|
|
)
|
|
if not existing:
|
|
session.add(strengths_setting)
|
|
logger.info(f"Added {strengths_setting.key}")
|
|
|
|
# Commit all changes
|
|
session.commit()
|
|
logger.info("Successfully populated search engine settings")
|
|
|
|
# Verify by querying
|
|
search_settings = (
|
|
session.query(Setting)
|
|
.filter(
|
|
Setting.type == "SEARCH", Setting.key.contains("display_name")
|
|
)
|
|
.all()
|
|
)
|
|
|
|
logger.info(f"Total search engine settings: {len(search_settings)}")
|
|
for setting in search_settings:
|
|
logger.info(f" {setting.key}: {setting.value}")
|
|
|
|
except Exception:
|
|
logger.exception("Error populating search engines")
|
|
session.rollback()
|
|
finally:
|
|
session.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# Need to set this for test user database
|
|
os.environ["LDR_CURRENT_USER"] = "testuser"
|
|
populate_search_engines()
|