mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-10 20:35:17 +02:00
Merge pull request #408 from MODSetter/dev
chore: updated docs & refactored sst_service.py
This commit is contained in:
commit
fa39176b82
10 changed files with 195 additions and 173 deletions
|
|
@ -785,20 +785,25 @@ async def process_file_in_background(
|
|||
)
|
||||
|
||||
# Determine STT service type
|
||||
stt_service_type = "local" if app_config.STT_SERVICE and app_config.STT_SERVICE.startswith("local/") else "external"
|
||||
|
||||
stt_service_type = (
|
||||
"local"
|
||||
if app_config.STT_SERVICE
|
||||
and app_config.STT_SERVICE.startswith("local/")
|
||||
else "external"
|
||||
)
|
||||
|
||||
# Check if using local STT service
|
||||
if stt_service_type == "local":
|
||||
# Use local Faster-Whisper for transcription
|
||||
from app.services.stt_service import stt_service
|
||||
|
||||
|
||||
try:
|
||||
result = stt_service.transcribe_file(file_path)
|
||||
transcribed_text = result.get("text", "")
|
||||
|
||||
|
||||
if not transcribed_text:
|
||||
raise ValueError("Transcription returned empty text")
|
||||
|
||||
|
||||
# Add metadata about the transcription
|
||||
transcribed_text = (
|
||||
f"# Transcription of {filename}\n\n{transcribed_text}"
|
||||
|
|
@ -806,9 +811,9 @@ async def process_file_in_background(
|
|||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=422,
|
||||
detail=f"Failed to transcribe audio file {filename}: {str(e)}"
|
||||
detail=f"Failed to transcribe audio file {filename}: {e!s}",
|
||||
) from e
|
||||
|
||||
|
||||
await task_logger.log_task_progress(
|
||||
log_entry,
|
||||
f"Local STT transcription completed: {filename}",
|
||||
|
|
@ -828,13 +833,17 @@ async def process_file_in_background(
|
|||
"api_key": app_config.STT_SERVICE_API_KEY,
|
||||
}
|
||||
if app_config.STT_SERVICE_API_BASE:
|
||||
transcription_kwargs["api_base"] = app_config.STT_SERVICE_API_BASE
|
||||
|
||||
transcription_response = await atranscription(**transcription_kwargs)
|
||||
transcription_kwargs["api_base"] = (
|
||||
app_config.STT_SERVICE_API_BASE
|
||||
)
|
||||
|
||||
transcription_response = await atranscription(
|
||||
**transcription_kwargs
|
||||
)
|
||||
|
||||
# Extract the transcribed text
|
||||
transcribed_text = transcription_response.get("text", "")
|
||||
|
||||
|
||||
if not transcribed_text:
|
||||
raise ValueError("Transcription returned empty text")
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
import os
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from faster_whisper import WhisperModel
|
||||
|
||||
from app.config import config
|
||||
|
||||
|
||||
class STTService:
|
||||
"""Local Speech-to-Text service using Faster-Whisper."""
|
||||
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize STT service with model from STT_SERVICE config."""
|
||||
# Parse model from STT_SERVICE (e.g., "local/base" or "local/tiny")
|
||||
|
|
@ -20,8 +20,8 @@ class STTService:
|
|||
self.model_size = stt_service.split("/", 1)[1]
|
||||
else:
|
||||
self.model_size = "base" # fallback
|
||||
self._model: Optional[WhisperModel] = None
|
||||
|
||||
self._model: WhisperModel | None = None
|
||||
|
||||
def _get_model(self) -> WhisperModel:
|
||||
"""Lazy load the Whisper model."""
|
||||
if self._model is None:
|
||||
|
|
@ -33,49 +33,53 @@ class STTService:
|
|||
num_workers=1, # Single worker for stability
|
||||
)
|
||||
return self._model
|
||||
|
||||
def transcribe_file(self, audio_path: str, language: Optional[str] = None) -> dict:
|
||||
|
||||
def transcribe_file(self, audio_path: str, language: str | None = None) -> dict:
|
||||
"""Transcribe audio file to text.
|
||||
|
||||
|
||||
Args:
|
||||
audio_path: Path to audio file
|
||||
language: Optional language code (e.g., "en", "es")
|
||||
|
||||
|
||||
Returns:
|
||||
Dict with transcription text and metadata
|
||||
"""
|
||||
model = self._get_model()
|
||||
|
||||
|
||||
# Transcribe with optimized settings
|
||||
segments, info = model.transcribe(
|
||||
audio_path,
|
||||
language=language,
|
||||
beam_size=1, # Faster inference
|
||||
best_of=1, # Single pass
|
||||
best_of=1, # Single pass
|
||||
temperature=0, # Deterministic output
|
||||
vad_filter=True, # Voice activity detection
|
||||
vad_parameters=dict(min_silence_duration_ms=500),
|
||||
vad_parameters={"min_silence_duration_ms": 500},
|
||||
)
|
||||
|
||||
|
||||
# Combine all segments
|
||||
text = " ".join(segment.text.strip() for segment in segments)
|
||||
|
||||
|
||||
return {
|
||||
"text": text,
|
||||
"language": info.language,
|
||||
"language_probability": info.language_probability,
|
||||
"duration": info.duration,
|
||||
}
|
||||
|
||||
def transcribe_bytes(self, audio_bytes: bytes, filename: str = "audio.wav",
|
||||
language: Optional[str] = None) -> dict:
|
||||
|
||||
def transcribe_bytes(
|
||||
self,
|
||||
audio_bytes: bytes,
|
||||
filename: str = "audio.wav",
|
||||
language: str | None = None,
|
||||
) -> dict:
|
||||
"""Transcribe audio from bytes.
|
||||
|
||||
|
||||
Args:
|
||||
audio_bytes: Audio file bytes
|
||||
filename: Original filename for format detection
|
||||
language: Optional language code
|
||||
|
||||
|
||||
Returns:
|
||||
Dict with transcription text and metadata
|
||||
"""
|
||||
|
|
@ -84,7 +88,7 @@ class STTService:
|
|||
with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as tmp_file:
|
||||
tmp_file.write(audio_bytes)
|
||||
tmp_path = tmp_file.name
|
||||
|
||||
|
||||
try:
|
||||
return self.transcribe_file(tmp_path, language)
|
||||
finally:
|
||||
|
|
@ -93,4 +97,4 @@ class STTService:
|
|||
|
||||
|
||||
# Global STT service instance
|
||||
stt_service = STTService()
|
||||
stt_service = STTService()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export default function DocumentsTable() {
|
|||
created_at: true,
|
||||
});
|
||||
const [pageIndex, setPageIndex] = useState(0);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
const [pageSize, setPageSize] = useState(50);
|
||||
const [sortKey, setSortKey] = useState<SortKey>("title");
|
||||
const [sortDesc, setSortDesc] = useState(false);
|
||||
const [selectedIds, setSelectedIds] = useState<Set<number>>(new Set());
|
||||
|
|
|
|||
|
|
@ -334,9 +334,13 @@ ResearchModeSelector.displayName = "ResearchModeSelector";
|
|||
const LLMSelector = React.memo(() => {
|
||||
const { search_space_id } = useParams();
|
||||
const searchSpaceId = Number(search_space_id);
|
||||
|
||||
|
||||
const { llmConfigs, loading: llmLoading, error } = useLLMConfigs(searchSpaceId);
|
||||
const { preferences, updatePreferences, loading: preferencesLoading } = useLLMPreferences(searchSpaceId);
|
||||
const {
|
||||
preferences,
|
||||
updatePreferences,
|
||||
loading: preferencesLoading,
|
||||
} = useLLMPreferences(searchSpaceId);
|
||||
|
||||
const isLoading = llmLoading || preferencesLoading;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,138 +1,153 @@
|
|||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Plus, Trash2 } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
|
||||
interface InferenceParamsEditorProps {
|
||||
params: Record<string, number | string>;
|
||||
setParams: (newParams: Record<string, number | string>) => void;
|
||||
params: Record<string, number | string>;
|
||||
setParams: (newParams: Record<string, number | string>) => void;
|
||||
}
|
||||
|
||||
const PARAM_KEYS = ["temperature", "max_tokens", "top_k", "top_p"] as const;
|
||||
|
||||
export default function InferenceParamsEditor({
|
||||
params,
|
||||
setParams,
|
||||
}: InferenceParamsEditorProps) {
|
||||
const [selectedKey, setSelectedKey] = useState<string>("");
|
||||
const [value, setValue] = useState<string>("");
|
||||
export default function InferenceParamsEditor({ params, setParams }: InferenceParamsEditorProps) {
|
||||
const [selectedKey, setSelectedKey] = useState<string>("");
|
||||
const [value, setValue] = useState<string>("");
|
||||
|
||||
const handleAdd = () => {
|
||||
if (!selectedKey || value === "") return;
|
||||
const handleAdd = () => {
|
||||
if (!selectedKey || value === "") return;
|
||||
|
||||
if (params[selectedKey]) {
|
||||
alert(`${selectedKey} already exists`);
|
||||
return;
|
||||
}
|
||||
if (params[selectedKey]) {
|
||||
alert(`${selectedKey} already exists`);
|
||||
return;
|
||||
}
|
||||
|
||||
const numericValue = Number(value);
|
||||
const numericValue = Number(value);
|
||||
|
||||
if ((selectedKey === "temperature" || selectedKey === "top_p") && (isNaN(numericValue) || numericValue < 0 || numericValue > 1)) {
|
||||
alert("Value must be a number between 0 and 1");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
(selectedKey === "temperature" || selectedKey === "top_p") &&
|
||||
(isNaN(numericValue) || numericValue < 0 || numericValue > 1)
|
||||
) {
|
||||
alert("Value must be a number between 0 and 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((selectedKey === "max_tokens" || selectedKey === "top_k") && (!Number.isInteger(numericValue) || numericValue < 0)) {
|
||||
alert("Value must be a non-negative integer");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
(selectedKey === "max_tokens" || selectedKey === "top_k") &&
|
||||
(!Number.isInteger(numericValue) || numericValue < 0)
|
||||
) {
|
||||
alert("Value must be a non-negative integer");
|
||||
return;
|
||||
}
|
||||
|
||||
setParams({
|
||||
...params,
|
||||
[selectedKey]: isNaN(numericValue) ? value : numericValue,
|
||||
});
|
||||
setParams({
|
||||
...params,
|
||||
[selectedKey]: isNaN(numericValue) ? value : numericValue,
|
||||
});
|
||||
|
||||
setSelectedKey("");
|
||||
setValue("");
|
||||
};
|
||||
setSelectedKey("");
|
||||
setValue("");
|
||||
};
|
||||
|
||||
const handleDelete = (key: string) => {
|
||||
const newParams = { ...params };
|
||||
delete newParams[key];
|
||||
setParams(newParams);
|
||||
};
|
||||
const handleDelete = (key: string) => {
|
||||
const newParams = { ...params };
|
||||
delete newParams[key];
|
||||
setParams(newParams);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6 p-2 sm:p-0">
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-[1fr_1fr_auto] md:gap-3 items-end">
|
||||
<div className="flex flex-col space-y-1">
|
||||
<Label htmlFor="param-key" className="text-sm font-medium">Parameter Key</Label>
|
||||
<Select value={selectedKey} onValueChange={setSelectedKey}>
|
||||
<SelectTrigger id="param-key" className="w-full">
|
||||
<SelectValue placeholder="Select parameter" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{PARAM_KEYS.map((key) => (
|
||||
<SelectItem key={key} value={key}>{key}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
return (
|
||||
<div className="space-y-6 p-2 sm:p-0">
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-[1fr_1fr_auto] md:gap-3 items-end">
|
||||
<div className="flex flex-col space-y-1">
|
||||
<Label htmlFor="param-key" className="text-sm font-medium">
|
||||
Parameter Key
|
||||
</Label>
|
||||
<Select value={selectedKey} onValueChange={setSelectedKey}>
|
||||
<SelectTrigger id="param-key" className="w-full">
|
||||
<SelectValue placeholder="Select parameter" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{PARAM_KEYS.map((key) => (
|
||||
<SelectItem key={key} value={key}>
|
||||
{key}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col space-y-1">
|
||||
<Label htmlFor="param-value" className="text-sm font-medium">Value</Label>
|
||||
<Input
|
||||
id="param-value"
|
||||
placeholder="Enter value (e.g., 0.7 or 512)"
|
||||
value={value}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
className="w-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col space-y-1">
|
||||
<Label htmlFor="param-value" className="text-sm font-medium">
|
||||
Value
|
||||
</Label>
|
||||
<Input
|
||||
id="param-value"
|
||||
placeholder="Enter value (e.g., 0.7 or 512)"
|
||||
value={value}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
className="w-full"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
className="w-full md:w-auto h-10 mt-0"
|
||||
onClick={handleAdd}
|
||||
disabled={!selectedKey || value === ""}
|
||||
>
|
||||
<Plus className="w-4 h-4 mr-2" /> Add Parameter
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
className="w-full md:w-auto h-10 mt-0"
|
||||
onClick={handleAdd}
|
||||
disabled={!selectedKey || value === ""}
|
||||
>
|
||||
<Plus className="w-4 h-4 mr-2" /> Add Parameter
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<hr className="my-4" />
|
||||
<hr className="my-4" />
|
||||
|
||||
{Object.keys(params).length > 0 && (
|
||||
<div className="border rounded-lg shadow-sm overflow-x-auto">
|
||||
<table className="min-w-full text-left text-sm divide-y divide-gray-200">
|
||||
<thead className="bg-black dark:bg-black">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-xs font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300">Key</th>
|
||||
<th className="px-4 py-3 text-xs font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300">Value</th>
|
||||
<th className="px-4 py-3 text-xs font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300 sr-only md:not-sr-only">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-200 bg-black dark:bg-black">
|
||||
{Object.entries(params).map(([key, val]) => (
|
||||
<tr key={key} className="hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors">
|
||||
<td className="px-4 py-3 font-medium text-gray-900 dark:text-white">{key}</td>
|
||||
<td className="px-4 py-3 text-gray-700 dark:text-gray-300">{val.toString()}</td>
|
||||
<td className="px-4 py-3">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-700 dark:text-red-500"
|
||||
onClick={() => handleDelete(key)}
|
||||
aria-label={`Delete parameter ${key}`}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</Button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
{Object.keys(params).length > 0 && (
|
||||
<div className="border rounded-lg shadow-sm overflow-x-auto">
|
||||
<table className="min-w-full text-left text-sm divide-y divide-gray-200">
|
||||
<thead className="bg-black dark:bg-black">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-xs font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300">
|
||||
Key
|
||||
</th>
|
||||
<th className="px-4 py-3 text-xs font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300">
|
||||
Value
|
||||
</th>
|
||||
<th className="px-4 py-3 text-xs font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300 sr-only md:not-sr-only">
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-200 bg-black dark:bg-black">
|
||||
{Object.entries(params).map(([key, val]) => (
|
||||
<tr key={key} className="hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors">
|
||||
<td className="px-4 py-3 font-medium text-gray-900 dark:text-white">{key}</td>
|
||||
<td className="px-4 py-3 text-gray-700 dark:text-gray-300">{val.toString()}</td>
|
||||
<td className="px-4 py-3">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-700 dark:text-red-500"
|
||||
onClick={() => handleDelete(key)}
|
||||
aria-label={`Delete parameter ${key}`}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</Button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import {
|
|||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { LLM_PROVIDERS } from "@/contracts/enums/llm-providers";
|
||||
import { LANGUAGES } from "@/contracts/enums/languages";
|
||||
import { LLM_PROVIDERS } from "@/contracts/enums/llm-providers";
|
||||
import { type CreateLLMConfig, useLLMConfigs } from "@/hooks/use-llm-configs";
|
||||
|
||||
import InferenceParamsEditor from "../inference-params-editor";
|
||||
|
|
@ -223,7 +223,6 @@ export function AddProviderStep({
|
|||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{formData.provider === "CUSTOM" && (
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ Before you begin, ensure you have:
|
|||
| RERANKERS_MODEL_NAME | Name of the reranker model (e.g., `ms-marco-MiniLM-L-12-v2`) |
|
||||
| RERANKERS_MODEL_TYPE | Type of reranker model (e.g., `flashrank`) |
|
||||
| TTS_SERVICE | Text-to-Speech API provider for Podcasts (e.g., `local/kokoro`, `openai/tts-1`). See [supported providers](https://docs.litellm.ai/docs/text_to_speech#supported-providers) |
|
||||
| TTS_SERVICE_API_KEY | API key for the Text-to-Speech service |
|
||||
| TTS_SERVICE_API_KEY | (Optional if local) API key for the Text-to-Speech service |
|
||||
| TTS_SERVICE_API_BASE | (Optional) Custom API base URL for the Text-to-Speech service |
|
||||
| STT_SERVICE | Speech-to-Text API provider for Podcasts (e.g., `openai/whisper-1`). See [supported providers](https://docs.litellm.ai/docs/audio_transcription#supported-providers) |
|
||||
| STT_SERVICE_API_KEY | API key for the Speech-to-Text service |
|
||||
| STT_SERVICE | Speech-to-Text API provider for Audio Files (e.g., `local/base`, `openai/whisper-1`). See [supported providers](https://docs.litellm.ai/docs/audio_transcription#supported-providers) |
|
||||
| STT_SERVICE_API_KEY | (Optional if local) API key for the Speech-to-Text service |
|
||||
| STT_SERVICE_API_BASE | (Optional) Custom API base URL for the Speech-to-Text service |
|
||||
| FIRECRAWL_API_KEY | API key for Firecrawl service for web crawling |
|
||||
| ETL_SERVICE | Document parsing service: `UNSTRUCTURED` (supports 34+ formats), `LLAMACLOUD` (supports 50+ formats including legacy document types), or `DOCLING` (local processing, supports PDF, Office docs, images, HTML, CSV) |
|
||||
|
|
|
|||
|
|
@ -62,12 +62,11 @@ Edit the `.env` file and set the following variables:
|
|||
| RERANKERS_MODEL_NAME | Name of the reranker model (e.g., `ms-marco-MiniLM-L-12-v2`) |
|
||||
| RERANKERS_MODEL_TYPE | Type of reranker model (e.g., `flashrank`) |
|
||||
| TTS_SERVICE | Text-to-Speech API provider for Podcasts (e.g., `local/kokoro`, `openai/tts-1`). See [supported providers](https://docs.litellm.ai/docs/text_to_speech#supported-providers) |
|
||||
| TTS_SERVICE_API_KEY | API key for the Text-to-Speech service |
|
||||
| TTS_SERVICE_API_BASE | (Optional) Custom API base URL for the Text-to-Speech service |
|
||||
| STT_SERVICE | Speech-to-Text API provider for Podcasts (e.g., `openai/whisper-1`). See [supported providers](https://docs.litellm.ai/docs/audio_transcription#supported-providers) |
|
||||
| STT_SERVICE_API_KEY | API key for the Speech-to-Text service |
|
||||
| STT_SERVICE_API_BASE | (Optional) Custom API base URL for the Speech-to-Text service |
|
||||
| FIRECRAWL_API_KEY | API key for Firecrawl service for web crawling |
|
||||
| TTS_SERVICE_API_KEY | (Optional if local) API key for the Text-to-Speech service |
|
||||
| TTS_SERVICE_API_BASE | (Optional) Custom API base URL for the Text-to-Speech service |
|
||||
| STT_SERVICE | Speech-to-Text API provider for Audio Files (e.g., `local/base`, `openai/whisper-1`). See [supported providers](https://docs.litellm.ai/docs/audio_transcription#supported-providers) |
|
||||
| STT_SERVICE_API_KEY | (Optional if local) API key for the Speech-to-Text service |
|
||||
| STT_SERVICE_API_BASE | (Optional) Custom API base URL for the Speech-to-Text service |
|
||||
| ETL_SERVICE | Document parsing service: `UNSTRUCTURED` (supports 34+ formats), `LLAMACLOUD` (supports 50+ formats including legacy document types), or `DOCLING` (local processing, supports PDF, Office docs, images, HTML, CSV) |
|
||||
| UNSTRUCTURED_API_KEY | API key for Unstructured.io service for document parsing (required if ETL_SERVICE=UNSTRUCTURED) |
|
||||
| LLAMA_CLOUD_API_KEY | API key for LlamaCloud service for document parsing (required if ETL_SERVICE=LLAMACLOUD) |
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import 'dotenv/config';
|
||||
import { defineConfig } from 'drizzle-kit';
|
||||
import "dotenv/config";
|
||||
import { defineConfig } from "drizzle-kit";
|
||||
|
||||
export default defineConfig({
|
||||
out: './drizzle',
|
||||
schema: './app/db/schema.ts',
|
||||
dialect: 'postgresql',
|
||||
dbCredentials: {
|
||||
url: process.env.DATABASE_URL!,
|
||||
},
|
||||
out: "./drizzle",
|
||||
schema: "./app/db/schema.ts",
|
||||
dialect: "postgresql",
|
||||
dbCredentials: {
|
||||
url: process.env.DATABASE_URL!,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -337,12 +337,7 @@ export function useConnectorEditPage(connectorId: number, searchSpaceId: string)
|
|||
const originalSafesearch = originalConfig.SEARXNG_SAFESEARCH;
|
||||
if (safesearchRaw) {
|
||||
const parsed = Number(safesearchRaw);
|
||||
if (
|
||||
Number.isNaN(parsed) ||
|
||||
!Number.isInteger(parsed) ||
|
||||
parsed < 0 ||
|
||||
parsed > 2
|
||||
) {
|
||||
if (Number.isNaN(parsed) || !Number.isInteger(parsed) || parsed < 0 || parsed > 2) {
|
||||
toast.error("SearxNG SafeSearch must be 0, 1, or 2.");
|
||||
setIsSaving(false);
|
||||
return;
|
||||
|
|
@ -521,10 +516,7 @@ export function useConnectorEditPage(connectorId: number, searchSpaceId: string)
|
|||
"SEARXNG_CATEGORIES",
|
||||
normalizeListInput(newlySavedConfig.SEARXNG_CATEGORIES).join(", ")
|
||||
);
|
||||
editForm.setValue(
|
||||
"SEARXNG_LANGUAGE",
|
||||
newlySavedConfig.SEARXNG_LANGUAGE || ""
|
||||
);
|
||||
editForm.setValue("SEARXNG_LANGUAGE", newlySavedConfig.SEARXNG_LANGUAGE || "");
|
||||
editForm.setValue(
|
||||
"SEARXNG_SAFESEARCH",
|
||||
newlySavedConfig.SEARXNG_SAFESEARCH === null ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue