How qtencent7/savor works
Project Type & Purpose
• This is a full-stack application split between a React/TypeScript frontend and a Python backend powered by FastAPI.
• The purpose is to allow users to input a news topic, then run AI-driven query optimization to use search engines (DuckDuckGo or Google) to fetch and analyze news results.
File Structure
• The project is clearly separated into two main directories:
• Frontend: Contains React code (with subdirectories for assets, components, styles, and API requests) and configuration files (e.g., tsconfig, vite.config).
• Backend: Contains a simple FastAPI application (app.py), with dependency management using requirements.txt and environment variable configuration.
• Notice additional files for managing environmental settings for proper integration with external APIs (OpenAI, DeepSeek, SERPAPI, etc).
Core Components to Highlight
a. Frontend Component
• React application that handles user interaction.
• Submodules like UI Components (e.g., Chat.tsx), API request handling (under src/requests), and styling layers (Less files in src/styles).
• Entry point (main.tsx) and overall state flow managing user input and display.
b. Backend Component
• FastAPI application (app.py) that processes requests from the frontend.
• Endpoints responsible for handling search queries, integrating with the DuckDuckGo/Google APIs, and processing the AI responses.
• Dependency management and configuration details (using .env for API keys and search engine selection).
c. External Services
• DuckDuckGo and Google (for search functionality)
• OpenAI API (for AI-driven query optimization and analysis)
• DeepSeek/SERPAPI (as part of the search process)
• As external components that interact with the backend.
d. Data Flow & Interactions
• The frontend sends the user search input to the backend.
• The backend then communicates with external search engines and the AI services.
• Processed search results return to the backend and then are forwarded to the frontend for display.
• Optionally, future planned components like chat history might be added, so leave room for those extensions.