feat(agent): Implement recursion limit handling and emergency synthesis for search process

This commit is contained in:
Willie Zutz 2025-07-13 13:20:16 -06:00
parent 18fdb192d8
commit 1e40244183
13 changed files with 249 additions and 70 deletions

View file

@ -41,7 +41,6 @@ The API accepts a JSON object in the request body, where you define the focus mo
### Request Parameters
- **`chatModel`** (object, optional): Defines the chat model to be used for the query. For model details you can send a GET request at `http://localhost:3000/api/models`. Make sure to use the key value (For example "gpt-4o-mini" instead of the display name "GPT 4 omni mini").
- `provider`: Specifies the provider for the chat model (e.g., `openai`, `ollama`).
- `name`: The specific model from the chosen provider (e.g., `gpt-4o-mini`).
- Optional fields for custom OpenAI configuration:
@ -49,16 +48,13 @@ The API accepts a JSON object in the request body, where you define the focus mo
- `customOpenAIKey`: The API key for a custom OpenAI instance.
- **`embeddingModel`** (object, optional): Defines the embedding model for similarity-based searching. For model details you can send a GET request at `http://localhost:3000/api/models`. Make sure to use the key value (For example "text-embedding-3-large" instead of the display name "Text Embedding 3 Large").
- `provider`: The provider for the embedding model (e.g., `openai`).
- `name`: The specific embedding model (e.g., `text-embedding-3-large`).
- **`focusMode`** (string, required): Specifies which focus mode to use. Available modes:
- `webSearch`, `academicSearch`, `localResearch`, `chat`, `wolframAlphaSearch`, `youtubeSearch`, `redditSearch`.
- **`optimizationMode`** (string, optional): Specifies the optimization mode to control the balance between performance and quality. Available modes:
- `speed`: Prioritize speed and get the quickest possible answer. Minimum effort retrieving web content. - Only uses SearXNG result previews.
- `agent`: Use an agentic workflow to answer complex multi-part questions. This mode requires a model that is trained for tool use.

View file

@ -17,22 +17,26 @@ cp sample.config.toml config.toml
General application settings.
#### SIMILARITY_MEASURE
- **Type**: String
- **Options**: `"cosine"` or `"dot"`
- **Default**: `"cosine"`
- **Description**: The similarity measure used for embedding comparisons in search results ranking.
#### KEEP_ALIVE
- **Type**: String
- **Default**: `"5m"`
- **Description**: How long to keep Ollama models loaded into memory. Use time suffixes like `"5m"` for 5 minutes, `"1h"` for 1 hour, or `"-1m"` for indefinite.
#### BASE_URL
- **Type**: String
- **Default**: `""` (empty)
- **Description**: Optional base URL override. When set, overrides the detected URL for OpenSearch and other public URLs.
#### HIDDEN_MODELS
- **Type**: Array of Strings
- **Default**: `[]` (empty array)
- **Description**: Array of model names to hide from the user interface and API responses. Hidden models will not appear in model selection lists but can still be used if directly specified.
@ -47,30 +51,39 @@ General application settings.
Model provider configurations. Each provider has its own subsection.
#### [MODELS.OPENAI]
- **API_KEY**: Your OpenAI API key
#### [MODELS.GROQ]
- **API_KEY**: Your Groq API key
#### [MODELS.ANTHROPIC]
- **API_KEY**: Your Anthropic API key
#### [MODELS.GEMINI]
- **API_KEY**: Your Google Gemini API key
#### [MODELS.CUSTOM_OPENAI]
Configuration for OpenAI-compatible APIs (like LMStudio, vLLM, etc.)
- **API_KEY**: API key for the custom endpoint
- **API_URL**: Base URL for the OpenAI-compatible API
- **MODEL_NAME**: Name of the model to use
#### [MODELS.OLLAMA]
- **API_URL**: Ollama server URL (e.g., `"http://host.docker.internal:11434"`)
#### [MODELS.DEEPSEEK]
- **API_KEY**: Your DeepSeek API key
#### [MODELS.LM_STUDIO]
- **API_URL**: LM Studio server URL (e.g., `"http://host.docker.internal:1234"`)
### [API_ENDPOINTS]
@ -78,6 +91,7 @@ Configuration for OpenAI-compatible APIs (like LMStudio, vLLM, etc.)
External service endpoints.
#### SEARXNG
- **Type**: String
- **Description**: SearxNG API URL for web search functionality
- **Example**: `"http://localhost:32768"`
@ -97,16 +111,19 @@ Some configurations can also be set via environment variables, which take preced
The `HIDDEN_MODELS` setting allows server administrators to control which models are visible to users:
### How It Works
1. Models listed in `HIDDEN_MODELS` are filtered out of API responses
2. The settings UI shows all models (including hidden ones) for management
3. Hidden models can still be used if explicitly specified in API calls
### Managing Hidden Models
1. **Via Configuration File**: Edit the `HIDDEN_MODELS` array in `config.toml`
2. **Via Settings UI**: Use the "Model Visibility" section in the settings page
3. **Via API**: Use the `/api/config` endpoint to update the configuration
### API Behavior
- **Default**: `/api/models` returns only visible models
- **Include Hidden**: `/api/models?include_hidden=true` returns all models (for admin use)
@ -129,6 +146,7 @@ The `HIDDEN_MODELS` setting allows server administrators to control which models
### Configuration Validation
The application validates configuration on startup and will log errors for:
- Invalid TOML syntax
- Missing required fields
- Invalid URLs or API endpoints