Merge upstream/dev: take upstream's roles-claim evaluation

Upstream now reads the roles claim whenever a claim name is configured, with an access-token fallback, which supersedes the change in this branch.
This commit is contained in:
Classic298 2026-09-21 15:06:04 +02:00
commit 87358b4e10
214 changed files with 74930 additions and 54996 deletions

View file

@ -22,6 +22,9 @@ ENABLE_RAG_CSV_SUMMARY=false
# Set to true to preserve backing file records, storage blobs, and per-file vectors when files are removed from knowledge bases.
ENABLE_KNOWLEDGE_FILE_RETENTION=false
# Comma-separated chunk metadata keys to expose to the model alongside retrieved content.
RAG_SOURCE_METADATA_KEYS=''
# Set to false to disable workspace Tools and Functions.
ENABLE_PLUGINS=true

View file

@ -12,6 +12,8 @@ body:
Before submitting, search open and closed [Issues](https://github.com/open-webui/open-webui/issues) and [Discussions](https://github.com/open-webui/open-webui/discussions). The issue may already be reported or fixed on `dev`.
**Test on the latest release AND on `dev`, right before you submit this report, not last week.** A huge share of reports are for bugs already fixed on `dev`, sometimes weeks earlier, because the reporter only tested an old version and never rechecked. Reports that don't reproduce on latest and on current `dev` at submission time will be closed without further discussion, no exceptions.
Please do not open a code pull request for this report unless a maintainer asks for one, or the change is only i18n/localization. If you want to share code as reference, include it here as a local diff or patch. Actionable reproduction details are the most useful next step.
Security vulnerabilities must not be reported publicly. Use the [GitHub security page](https://github.com/open-webui/open-webui/security) instead.
@ -23,12 +25,10 @@ body:
options:
- label: I searched open and closed issues and discussions for an existing report.
required: true
- label: I checked whether this is already fixed on the `dev` branch or latest source.
- label: I reproduced this bug on the latest release AND on the current `dev` branch, right before submitting this report. I did not just check an old version or rely on a check from days ago.
required: true
- label: I understand that maintainers want a well-written issue before any code pull request.
required: true
- label: I am using the latest available version of Open WebUI for my install method.
required: true
- label: This is not a security vulnerability.
required: true

View file

@ -741,6 +741,10 @@ else:
except Exception:
PGVECTOR_IVFFLAT_LISTS = 100
PGVECTOR_ITERATIVE_SCAN = os.getenv('PGVECTOR_ITERATIVE_SCAN', 'relaxed_order').strip().lower()
if PGVECTOR_ITERATIVE_SCAN not in ('off', 'relaxed_order', 'strict_order'):
PGVECTOR_ITERATIVE_SCAN = 'relaxed_order'
# openGauss
OPENGAUSS_DB_URL = os.getenv('OPENGAUSS_DB_URL', DATABASE_URL)
@ -1298,6 +1302,12 @@ TAVILY_API_KEY = os.getenv('TAVILY_API_KEY', '')
TAVILY_EXTRACT_DEPTH = os.getenv('TAVILY_EXTRACT_DEPTH', 'basic')
STAAN_API_KEY = os.getenv('STAAN_API_KEY', '')
STAAN_MARKET = os.getenv('STAAN_MARKET', 'en-us')
STAAN_MAX_SNIPPETS = int(os.getenv('STAAN_MAX_SNIPPETS', '0'))
PLAYWRIGHT_WS_URL = os.getenv('PLAYWRIGHT_WS_URL', '')
PLAYWRIGHT_TIMEOUT = int(os.getenv('PLAYWRIGHT_TIMEOUT', '10000'))
@ -3018,6 +3028,9 @@ DEFAULT_CONFIG = {
'web.search.sougou_api_sk': SOUGOU_API_SK,
'web.search.tavily_api_key': TAVILY_API_KEY,
'web.search.tavily_extract_depth': TAVILY_EXTRACT_DEPTH,
'web.search.staan_api_key': STAAN_API_KEY,
'web.search.staan_market': STAAN_MARKET,
'web.search.staan_max_snippets': STAAN_MAX_SNIPPETS,
'web.loader.playwright_ws_url': PLAYWRIGHT_WS_URL,
'web.loader.playwright_timeout': PLAYWRIGHT_TIMEOUT,
'web.loader.firecrawl_api_key': FIRECRAWL_API_KEY,

View file

@ -371,6 +371,9 @@ ENABLE_QUERIES_CACHE = os.getenv('ENABLE_QUERIES_CACHE', 'False').lower() == 'tr
ENABLE_ADMIN_CHAT_ACCESS = os.getenv('ENABLE_ADMIN_CHAT_ACCESS', 'True').lower() == 'true'
RAG_SYSTEM_CONTEXT = os.getenv('RAG_SYSTEM_CONTEXT', 'False').lower() == 'true'
# Empty by default: chunk metadata also holds internal bookkeeping (file hashes, collection names, scores).
RAG_SOURCE_METADATA_KEYS = [key.strip() for key in os.getenv('RAG_SOURCE_METADATA_KEYS', '').split(',') if key.strip()]
####################################
# REDIS
####################################
@ -385,6 +388,14 @@ try:
except ValueError:
REDIS_RESPONSE_STREAM_TTL = 3600
# Seconds a task survives without a heartbeat. 0 disables expiry.
try:
REDIS_TASK_TTL = int(os.getenv('REDIS_TASK_TTL', '300'))
if REDIS_TASK_TTL != 0 and REDIS_TASK_TTL < 60:
REDIS_TASK_TTL = 300
except ValueError:
REDIS_TASK_TTL = 300
REDIS_SENTINEL_HOSTS = os.getenv('REDIS_SENTINEL_HOSTS', '')
REDIS_SENTINEL_PORT = os.getenv('REDIS_SENTINEL_PORT', '26379')

View file

@ -74,6 +74,7 @@ from open_webui.config import (
seed_registered_defaults,
)
from open_webui.constants import ERROR_MESSAGES, TASKS
from open_webui.utils.recurrence import RecurrenceEvaluationTimeout
from open_webui.env import (
USE_SLIM,
AIOHTTP_CLIENT_SESSION_SSL,
@ -107,12 +108,14 @@ from open_webui.env import (
MAX_BODY_LOG_SIZE,
# Redis
REDIS_KEY_PREFIX,
REDIS_TASK_TTL,
REDIS_URL,
RESET_CONFIG_ON_START,
SAFE_MODE,
SCIM_TOKEN,
VERSION,
WEBSOCKET_HEARTBEAT_INTERVAL,
WEBSOCKET_MANAGER,
# Admin Account Runtime Creation
WEBUI_ADMIN_EMAIL,
WEBUI_ADMIN_NAME,
@ -189,6 +192,7 @@ from open_webui.socket.main import (
get_user_id_from_session_pool,
periodic_session_pool_cleanup,
periodic_usage_pool_cleanup,
redis_event_listener,
)
from open_webui.socket.main import (
app as socket_app,
@ -200,6 +204,7 @@ from open_webui.tasks import (
list_task_ids_by_item_id,
list_tasks,
redis_task_command_listener,
redis_task_heartbeat,
stop_item_tasks,
stop_task,
) # Import from tasks.py
@ -386,6 +391,11 @@ async def lifespan(app: FastAPI):
if app.state.redis is not None:
app.state.redis_task_command_listener = asyncio.create_task(redis_task_command_listener(app))
if REDIS_TASK_TTL > 0:
app.state.redis_task_heartbeat = asyncio.create_task(redis_task_heartbeat(app))
if WEBSOCKET_MANAGER == 'redis':
app.state.redis_event_listener = asyncio.create_task(redis_event_listener())
app.state.periodic_usage_pool_cleanup = asyncio.create_task(periodic_usage_pool_cleanup())
app.state.periodic_session_pool_cleanup = asyncio.create_task(periodic_session_pool_cleanup())
@ -473,6 +483,12 @@ async def lifespan(app: FastAPI):
if hasattr(app.state, 'redis_task_command_listener'):
app.state.redis_task_command_listener.cancel()
if hasattr(app.state, 'redis_task_heartbeat'):
app.state.redis_task_heartbeat.cancel()
if hasattr(app.state, 'redis_event_listener'):
app.state.redis_event_listener.cancel()
app.state.periodic_usage_pool_cleanup.cancel()
app.state.periodic_session_pool_cleanup.cancel()
app.state.scheduler_worker_loop.cancel()
@ -495,6 +511,12 @@ app = FastAPI(
lifespan=lifespan,
)
@app.exception_handler(RecurrenceEvaluationTimeout)
async def recurrence_timeout_handler(request: Request, exc: RecurrenceEvaluationTimeout):
return JSONResponse(status_code=400, content={'detail': str(exc)})
# Used by readiness checks to gate traffic until startup work is done.
app.state.startup_complete = False
@ -1464,8 +1486,8 @@ async def chat_completion(
async def run_initial_title_generation():
try:
await background_tasks_handler(title_ctx)
except Exception as e:
log.debug('Error generating initial chat title: %s', e)
except Exception:
log.exception('Error generating initial chat title')
asyncio.create_task(run_initial_title_generation())
else:
@ -1637,8 +1659,8 @@ async def chat_completion(
# When the upstream provider returns an error (e.g. HTTP 400
# content-filter, quota exceeded), generate_chat_completion
# returns a JSONResponse instead of raising. Detect this and
# raise so the except-block below emits chat:message:error +
# chat:tasks:cancel, unblocking the frontend.
# raise so the except-block below emits a terminal
# chat:message:error, unblocking the frontend.
if isinstance(response, JSONResponse) and response.status_code >= 400:
raise Exception(get_response_error_detail(response))
@ -1674,6 +1696,7 @@ async def chat_completion(
{
'parentId': metadata.get('user_message_id', None),
'error': {'content': error_detail},
'done': True,
},
)
@ -1682,12 +1705,9 @@ async def chat_completion(
await event_emitter(
{
'type': 'chat:message:error',
'data': {'error': {'content': error_detail}},
'data': {'error': {'content': error_detail}, 'done': True},
}
)
await event_emitter(
{'type': 'chat:tasks:cancel'},
)
except Exception:
pass

View file

@ -312,6 +312,7 @@ class AutomationTable:
rows = result.scalars().all()
from open_webui.utils.automations import next_run_ns
from open_webui.utils.recurrence import RecurrenceEvaluationTimeout
# Batch-fetch user timezones so rescheduling respects each
# user's local timezone instead of falling back to server time.
@ -323,13 +324,20 @@ class AutomationTable:
tz_result = await db.execute(select(User.id, User.timezone).where(User.id.in_(user_ids)))
timezone_by_user_id = {uid: tz for uid, tz in tz_result.all()}
claimed = []
for row in rows:
try:
next_run_at = await next_run_ns(row.data.get('rrule', ''), tz=timezone_by_user_id.get(row.user_id))
except RecurrenceEvaluationTimeout:
log.warning('Skipping automation %s: recurrence evaluation timed out', row.id)
continue
row.last_run_at = now_ns
row.next_run_at = next_run_ns(row.data.get('rrule', ''), tz=timezone_by_user_id.get(row.user_id))
row.next_run_at = next_run_at
claimed.append(row)
await db.commit()
return [AutomationModel.model_validate(r) for r in rows]
return [AutomationModel.model_validate(r) for r in claimed]
####################

View file

@ -8,7 +8,7 @@ from open_webui.constants import ERROR_MESSAGES
from open_webui.models.access_grants import AccessGrantModel, AccessGrants
from open_webui.models.groups import Groups
from open_webui.models.users import User, UserModel, UserResponse
from pydantic import BaseModel, ConfigDict, Field, field_validator
from pydantic import BaseModel, ConfigDict, Field
from sqlalchemy import (
JSON,
BigInteger,
@ -179,6 +179,20 @@ class CalendarUpdateForm(BaseModel):
access_grants: Optional[list[dict]] = None
async def validate_calendar_rrule(value: Optional[str]) -> None:
if value:
from open_webui.utils.recurrence import rrule_interval_seconds
try:
interval = await rrule_interval_seconds(value)
except ValueError:
raise
except Exception as e:
raise ValueError(ERROR_MESSAGES.AUTOMATION_INVALID_RRULE(e)) from e
if interval is not None and interval < MIN_CALENDAR_RRULE_INTERVAL_SECONDS:
raise ValueError(ERROR_MESSAGES.CALENDAR_RRULE_TOO_FREQUENT)
class CalendarEventForm(BaseModel):
calendar_id: str
title: str
@ -193,22 +207,6 @@ class CalendarEventForm(BaseModel):
meta: Optional[dict] = None
attendees: Optional[list[dict]] = None
@field_validator('rrule')
@classmethod
def reject_sub_daily_rrule(cls, value: Optional[str]) -> Optional[str]:
if value:
from open_webui.utils.automations import rrule_interval_seconds
try:
interval = rrule_interval_seconds(value)
except ValueError:
raise
except Exception as e:
raise ValueError(ERROR_MESSAGES.AUTOMATION_INVALID_RRULE(e))
if interval is not None and interval < MIN_CALENDAR_RRULE_INTERVAL_SECONDS:
raise ValueError(ERROR_MESSAGES.CALENDAR_RRULE_TOO_FREQUENT)
return value
class CalendarEventUpdateForm(BaseModel):
calendar_id: Optional[str] = None
@ -225,22 +223,6 @@ class CalendarEventUpdateForm(BaseModel):
is_cancelled: Optional[bool] = None
attendees: Optional[list[dict]] = None
@field_validator('rrule')
@classmethod
def reject_sub_daily_rrule(cls, value: Optional[str]) -> Optional[str]:
if value:
from open_webui.utils.automations import rrule_interval_seconds
try:
interval = rrule_interval_seconds(value)
except ValueError:
raise
except Exception as e:
raise ValueError(ERROR_MESSAGES.AUTOMATION_INVALID_RRULE(e))
if interval is not None and interval < MIN_CALENDAR_RRULE_INTERVAL_SECONDS:
raise ValueError(ERROR_MESSAGES.CALENDAR_RRULE_TOO_FREQUENT)
return value
class RSVPForm(BaseModel):
status: str # 'accepted' | 'declined' | 'tentative' | 'pending'
@ -465,6 +447,7 @@ class CalendarEventTable:
async def insert_new_event(
self, user_id: str, form_data: CalendarEventForm, db: Optional[AsyncSession] = None
) -> Optional[CalendarEventModel]:
await validate_calendar_rrule(form_data.rrule)
async with get_async_db_context(db) as db:
now = int(time.time_ns())
event = CalendarEvent(
@ -695,6 +678,7 @@ class CalendarEventTable:
async def update_event_by_id(
self, id: str, form_data: CalendarEventUpdateForm, db: Optional[AsyncSession] = None
) -> Optional[CalendarEventModel]:
await validate_calendar_rrule(form_data.rrule)
async with get_async_db_context(db) as db:
result = await db.execute(select(CalendarEvent).filter(CalendarEvent.id == id))
event = result.scalars().first()

View file

@ -258,6 +258,7 @@ class ChatForm(BaseModel):
class ChatImportForm(ChatForm):
meta: dict | None = {}
pinned: bool | None = False
archived: bool | None = False
current_message_id: str | None = None
created_at: int | None = None
updated_at: int | None = None
@ -304,6 +305,7 @@ class ChatTitleIdResponse(BaseModel):
last_read_at: int | None = None
snippet: str | None = None
active: bool = False
archived: bool = False
class SharedChatResponse(BaseModel):
@ -644,6 +646,7 @@ class ChatTable:
'meta': form_data.meta,
'variables': form_data.variables or {},
'pinned': form_data.pinned,
'archived': form_data.archived,
'folder_id': form_data.folder_id,
'current_message_id': form_data.current_message_id or self.get_current_message_id(form_data.chat),
'created_at': (form_data.created_at if form_data.created_at else int(time.time())),
@ -1985,10 +1988,8 @@ class ChatTable:
]
# Extract folder names
folders = await Folders.search_folders_by_names(
user_id,
[word.replace('folder:', '') for word in search_text_words if word.startswith('folder:')],
)
folder_names = [word.replace('folder:', '') for word in search_text_words if word.startswith('folder:')]
folders = await Folders.search_folders_by_names(user_id, folder_names)
folder_ids = [folder.id for folder in folders]
is_pinned = None
@ -2032,7 +2033,7 @@ class ChatTable:
else:
stmt = stmt.filter(Chat.share_id.is_(None))
if folder_ids:
if folder_names:
stmt = stmt.filter(Chat.folder_id.in_(folder_ids))
# Check if the database dialect is either 'sqlite' or 'postgresql'
@ -2535,18 +2536,15 @@ class ChatTable:
except Exception:
return False
async def move_chats_by_user_id_and_folder_id(
async def move_chats_by_folder_id(
self,
user_id: str,
folder_id: str,
new_folder_id: str | None,
db: AsyncSession | None = None,
) -> bool:
try:
async with get_async_db_context(db) as session:
await session.execute(
update(Chat).filter_by(user_id=user_id, folder_id=folder_id).values(folder_id=new_folder_id)
)
await session.execute(update(Chat).filter_by(folder_id=folder_id).values(folder_id=new_folder_id))
await session.commit()
return True

View file

@ -506,14 +506,16 @@ class PromptsTable:
)
# Update prompt fields
prompt.name = form_data.name
prompt.command = form_data.command
prompt.content = form_data.content
prompt.data = form_data.data or prompt.data
prompt.meta = form_data.meta or prompt.meta
if form_data.tags is not None:
prompt.tags = form_data.tags
if form_data.is_production:
prompt.name = form_data.name
prompt.content = form_data.content
prompt.data = form_data.data or prompt.data
prompt.meta = form_data.meta or prompt.meta
if form_data.tags is not None:
prompt.tags = form_data.tags
if form_data.access_grants is not None:
await AccessGrants.set_access_grants('prompt', prompt.id, form_data.access_grants, db=session)
@ -531,7 +533,7 @@ class PromptsTable:
'command': prompt.command,
'data': form_data.data or {},
'meta': form_data.meta or {},
'tags': prompt.tags or [],
'tags': form_data.tags if form_data.tags is not None else (prompt.tags or []),
'access_grants': [grant.model_dump() for grant in current_access_grants],
}

View file

@ -803,7 +803,9 @@ class UsersTable:
return None
scim = dict(user.scim or {})
scim[provider] = {'external_id': external_id}
user.scim = scim
if scim != user.scim:
user.scim = scim
user.updated_at = int(time.time())
await session.commit()
return UserModel.model_validate(user)

View file

@ -91,6 +91,7 @@ known_source_ext = [
'yaml',
'yml',
'toml',
'svg',
]
known_archive_ext = {'docx', 'epub', 'odt', 'pptx', 'xlsx'}
@ -290,8 +291,17 @@ class DoclingLoader:
)
if r.ok:
result = r.json()
# Docling reports failed and skipped conversions inside HTTP 200 responses.
conversion_status = result.get('status')
if conversion_status in ['failure', 'skipped']:
error_details = (
'; '.join(filter(None, (error.get('error_message') for error in result.get('errors', []))))
or 'no error message provided'
)
raise Exception(f'Error calling Docling: conversion status {conversion_status} - {error_details}')
document_data = result.get('document', {})
md_content = document_data.get('md_content', '')
md_content = document_data.get('md_content') or ''
text = md_content or '<No text content found>'
metadata = {'Content-Type': self.mime_type} if self.mime_type else {}

View file

@ -34,6 +34,7 @@ from open_webui.env import (
ENABLE_RETRIEVAL_UNSCOPED_COLLECTIONS,
MPS_INFERENCE_LOCK,
OFFLINE_MODE,
RAG_SOURCE_METADATA_KEYS,
USE_SLIM,
)
from open_webui.models.access_grants import AccessGrants
@ -1361,6 +1362,11 @@ async def filter_accessible_collections(
return validated
def filter_source_metadata(metadata: dict) -> dict:
"""Keep only the chunk metadata keys the operator allowed the model to see."""
return {key: metadata[key] for key in RAG_SOURCE_METADATA_KEYS if metadata.get(key) is not None}
async def get_sources_from_items(
request,
items,

View file

@ -311,6 +311,7 @@ class OpenGaussClient(VectorDBBase):
results = query.all()
if not results:
self.session.rollback()
return None
ids = [[result.id for result in results]]
@ -333,6 +334,7 @@ class OpenGaussClient(VectorDBBase):
results = query.all()
if not results:
self.session.rollback()
return None
ids = [[result.id for result in results]]

View file

@ -8,6 +8,7 @@ from open_webui.config import (
PGVECTOR_HNSW_M,
PGVECTOR_INDEX_METHOD,
PGVECTOR_INITIALIZE_MAX_VECTOR_LENGTH,
PGVECTOR_ITERATIVE_SCAN,
PGVECTOR_IVFFLAT_LISTS,
PGVECTOR_PGCRYPTO,
PGVECTOR_PGCRYPTO_KEY,
@ -154,6 +155,7 @@ class PgvectorClient(VectorDBBase):
index_method, index_options = self._vector_index_configuration()
self._ensure_vector_index(index_method, index_options)
self._ensure_text_search_index()
self.iterative_scan_sql = self._iterative_scan_setting(index_method)
self.session.execute(
text(
@ -223,6 +225,9 @@ class PgvectorClient(VectorDBBase):
)
if not existing_index_def:
if index_method == 'ivfflat' and not self._has_enough_ivfflat_training_rows():
return
index_sql = (
f'CREATE INDEX IF NOT EXISTS {index_name} '
f'ON document_chunk USING {index_method} (vector {VECTOR_OPCLASS})'
@ -237,6 +242,38 @@ class PgvectorClient(VectorDBBase):
f' {index_options}' if index_options else '',
)
def _has_enough_ivfflat_training_rows(self) -> bool:
# ivfflat samples 50 rows per list to place its centroids, so recall stays poor until the table holds that many
min_training_rows = 50 * PGVECTOR_IVFFLAT_LISTS
row_count = self.session.execute(
text('SELECT count(*) FROM (SELECT 1 FROM document_chunk LIMIT :min_training_rows) AS sample'),
{'min_training_rows': min_training_rows},
).scalar()
if row_count < min_training_rows:
log.info(
"Deferring vector index 'idx_document_chunk_vector' until document_chunk holds %s rows to cluster on, "
'it has %s. Searches run as an exact scan until then.',
min_training_rows,
row_count,
)
return False
return True
def _iterative_scan_setting(self, index_method: str) -> Optional[str]:
if PGVECTOR_ITERATIVE_SCAN == 'off':
return None
version = self.session.execute(text("SELECT extversion FROM pg_extension WHERE extname = 'vector'")).scalar()
version_parts = [int(part) for part in (version or '').split('.') if part.isdigit()]
if version_parts[:2] < [0, 8]:
log.info('Iterative scan needs pgvector 0.8 or newer, the server has %s.', version or 'none')
return None
# ivfflat only accepts relaxed_order
mode = 'relaxed_order' if index_method == 'ivfflat' else PGVECTOR_ITERATIVE_SCAN
return f'SET LOCAL {index_method}.iterative_scan = {mode}'
def _ensure_text_search_index(self) -> None:
if PGVECTOR_PGCRYPTO:
return
@ -503,6 +540,9 @@ class PgvectorClient(VectorDBBase):
.order_by(query_vectors.c.qid, subq.c.distance)
)
if self.iterative_scan_sql:
self.session.execute(text(self.iterative_scan_sql))
result_proxy = self.session.execute(stmt)
results = result_proxy.all()
@ -512,6 +552,7 @@ class PgvectorClient(VectorDBBase):
metadatas = [[] for _ in range(num_queries)]
if not results:
self.session.rollback()
return SearchResult(
ids=ids,
distances=distances,
@ -631,6 +672,7 @@ class PgvectorClient(VectorDBBase):
results = query.all()
if not results:
self.session.rollback()
return None
ids = [[result.id for result in results]]
@ -670,6 +712,7 @@ class PgvectorClient(VectorDBBase):
results = query.all()
if not results:
self.session.rollback()
return None
ids = [[result.id for result in results]]

View file

@ -0,0 +1,60 @@
from __future__ import annotations
import requests
from open_webui.retrieval.web.main import SearchResult, get_filtered_results
def search_staan(
api_key: str,
query: str,
count: int,
filter_list: list[str] | None = None,
market: str | None = None,
max_snippets: int | None = None,
) -> list[SearchResult]:
"""Search using Staan's Web Search API and return the results as a list of SearchResult objects.
Args:
api_key (str): A Staan API key
query (str): The query to search for
count (int): The maximum number of results to return
filter_list (list[str] | None): The domains to allow or block
market (str | None): The market to search in, e.g. 'en-us'
max_snippets (int | None): The maximum extra snippets to request per result
Returns:
A list of SearchResult objects.
"""
url = 'https://api.staan.ai/v2/search/web'
headers = {
'Accept': 'application/json',
'Authorization': f'Bearer {api_key}',
}
params = {'q': query, 'market': market}
if max_snippets:
params['extra_snippets'] = 'true'
params['max_snippets'] = max_snippets
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
results = response.json().get('web', {}).get('results', [])
if filter_list:
results = get_filtered_results(results, filter_list)
return [
SearchResult(
link=result.get('url', ''),
title=result.get('title'),
snippet=_build_snippet(result),
)
for result in results[:count]
]
def _build_snippet(result: dict) -> str:
"""Combine the snippet and the extra snippets list into a single string."""
parts = [result.get('snippet')]
parts.extend(extra.get('chunk') for extra in result.get('extra_snippets', []))
return '\n\n'.join(part for part in parts if part)

View file

@ -297,8 +297,8 @@ async def update_audio_config(request: Request, form_data: AudioConfigUpdateForm
raise HTTPException(400, 'Local TTS is unavailable in slim. Select an external text-to-speech engine.')
await Config.upsert(
{
**config_updates(form_data.tts.model_dump(), TTS_CONFIG_KEYS),
**config_updates(form_data.stt.model_dump(), STT_CONFIG_KEYS),
**config_updates(form_data.tts.model_dump(exclude_unset=True), TTS_CONFIG_KEYS),
**config_updates(form_data.stt.model_dump(exclude_unset=True), STT_CONFIG_KEYS),
}
)

View file

@ -1752,6 +1752,7 @@ async def token_exchange(
user=user,
user_data=user_data,
provider=provider,
access_token=form_data.token,
db=db,
)
if await Config.get('oauth.enable_group_mapping'):

View file

@ -87,7 +87,7 @@ async def check_automation_limits(request, user, rrule_str: str, db, is_create:
if min_interval:
min_interval = int(min_interval)
if min_interval > 0:
interval = rrule_interval_seconds(rrule_str)
interval = await rrule_interval_seconds(rrule_str)
if interval is not None and interval < min_interval:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
@ -150,7 +150,7 @@ async def enrich_automation(automation: AutomationModel, db: AsyncSession, tz: s
return AutomationResponse(
**automation.model_dump(),
last_run=last_run,
next_runs=next_n_runs_ns(automation.data['rrule'], tz=tz),
next_runs=await next_n_runs_ns(automation.data['rrule'], tz=tz),
)
@ -216,7 +216,7 @@ async def create_new_automation(
await check_automation_folder_access(form_data.folder_id, user, db)
await check_automation_channel_access(form_data, user, db)
try:
validate_rrule(form_data.data.rrule, tz=user.timezone)
await validate_rrule(form_data.data.rrule, tz=user.timezone)
except ValueError as e:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
@ -226,7 +226,7 @@ async def create_new_automation(
await check_automation_limits(request, user, form_data.data.rrule, db, is_create=True)
tz = user.timezone
automation = await Automations.insert(user.id, form_data, next_run_ns(form_data.data.rrule, tz=tz), db=db)
automation = await Automations.insert(user.id, form_data, await next_run_ns(form_data.data.rrule, tz=tz), db=db)
response = await enrich_automation(automation, db, tz=tz)
await publish_event(
request,
@ -276,7 +276,7 @@ async def update_automation_by_id(
await check_automation_channel_access(form_data, user, db)
try:
validate_rrule(form_data.data.rrule, tz=user.timezone)
await validate_rrule(form_data.data.rrule, tz=user.timezone)
except ValueError as e:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
@ -286,7 +286,7 @@ async def update_automation_by_id(
await check_automation_limits(request, user, form_data.data.rrule, db, is_create=False)
tz = user.timezone
updated = await Automations.update_by_id(id, form_data, next_run_ns(form_data.data.rrule, tz=tz), db=db)
updated = await Automations.update_by_id(id, form_data, await next_run_ns(form_data.data.rrule, tz=tz), db=db)
response = await enrich_automation(updated, db, tz=tz)
await publish_event(
request,
@ -313,7 +313,7 @@ async def toggle_automation_by_id(
await check_automations_permission(request, user)
automation = await Automations.get_by_id(id, db=db)
check_automation_access(automation, user)
toggled = await Automations.toggle(id, next_run_ns(automation.data['rrule'], tz=user.timezone), db=db)
toggled = await Automations.toggle(id, await next_run_ns(automation.data['rrule'], tz=user.timezone), db=db)
response = await enrich_automation(toggled, db, tz=user.timezone)
await publish_event(
request,

View file

@ -273,7 +273,10 @@ async def get_events(
async def create_event(request: Request, form_data: CalendarEventForm, user: UserModel = Depends(get_verified_user)):
await check_calendar_permission(request, user)
await _check_calendar_access(form_data.calendar_id, user, 'write')
event = await CalendarEvents.insert_new_event(user.id, form_data)
try:
event = await CalendarEvents.insert_new_event(user.id, form_data)
except ValueError as e:
raise HTTPException(status_code=422, detail=str(e)) from e
await publish_event(
request,
EVENTS.CALENDAR_EVENT_CREATED,
@ -325,7 +328,10 @@ async def update_event(
if form_data.calendar_id is not None and form_data.calendar_id != event.calendar_id:
await _check_calendar_access(form_data.calendar_id, user, 'write')
updated = await CalendarEvents.update_event_by_id(event_id, form_data)
try:
updated = await CalendarEvents.update_event_by_id(event_id, form_data)
except ValueError as e:
raise HTTPException(status_code=422, detail=str(e)) from e
if not updated:
raise HTTPException(status_code=500, detail='Failed to update')
await publish_event(

View file

@ -888,6 +888,7 @@ async def search_user_chats(
created_at=chat.created_at,
last_read_at=chat.last_read_at,
snippet=chat_search_snippet(chat.chat, search_text),
archived=chat.archived,
)
)
@ -1592,7 +1593,7 @@ async def delete_chat_by_id(
# Cancel any in-flight LLM tasks (streaming, title/tags generation) before
# deleting the chat to prevent orphaned requests.
await stop_item_tasks(request.app.state.redis, id)
await Chats.delete_orphan_tags_for_user(chat.meta.get('tags', []), user.id, threshold=1, db=db)
await Chats.delete_orphan_tags_for_user(chat.meta.get('tags', []), chat.user_id, threshold=1, db=db)
# Cascade to internal child chats spawned from this one.
for child_id in await Chats.get_internal_chat_ids_by_parent_id(id, chat.user_id):
@ -1690,15 +1691,6 @@ async def fork_chat_by_id(
history = (chat.chat or {}).get('history') or {}
messages_map = await Chats.get_messages_map_by_chat_id(id) or history.get('messages') or {}
if any(
message.get('role') == 'assistant' and message.get('done') is False
for message in messages_map.values()
if isinstance(message, dict)
):
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail='Wait for the current response to finish before forking.',
)
source_message_id = (
(form_data.message_id if form_data else None) or chat.current_message_id or history.get('currentId')
@ -1715,6 +1707,22 @@ async def fork_chat_by_id(
detail=detail,
) from exc
# An unfinished message is stale unless it is awaiting tool approval
for message in fork_history['messages'].values():
if message.get('role') != 'assistant' or message.get('done') is not False:
continue
output = message.get('output')
if isinstance(output, list) and any(
isinstance(item, dict)
and item.get('type') == 'function_call'
and item.get('status') in {'pending', 'queued', 'requires_approval'}
for item in output
):
continue
message['done'] = True
updated_chat = {**(chat.chat or {})}
updated_chat.pop('currentId', None)
updated_chat.update(

View file

@ -401,7 +401,7 @@ async def update_folder_parent_id_by_id(
form_data.parent_id, user.id, folder.name, db=db
)
if existing_folder:
if existing_folder and existing_folder.id != id:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ERROR_MESSAGES.DEFAULT('Folder already exists'),
@ -683,7 +683,7 @@ async def delete_folder_by_id(
folder_owner_id = folder.user_id
folder_ids = await Folders.get_folder_ids_by_id_and_user_id_in_subtree(id, folder_owner_id, db=db)
if await Chats.count_chats_by_folder_ids_and_user_id(folder_ids, folder_owner_id, db=db):
if delete_contents and await Chats.count_chats_by_folder_ids_and_user_id(folder_ids, folder_owner_id, db=db):
chat_delete_permission = await has_permission(
user.id, 'chat.delete', await Config.get('user.permissions'), db=db
)
@ -704,8 +704,8 @@ async def delete_folder_by_id(
for folder_id in folder_ids:
if delete_contents:
await Chats.delete_chats_by_user_id_and_folder_id(folder_owner_id, folder_id, db=db)
else:
await Chats.move_chats_by_user_id_and_folder_id(folder_owner_id, folder_id, None, db=db)
await Chats.move_chats_by_folder_id(folder_id, None, db=db)
# Clean up access grants for this folder
await AccessGrants.revoke_all_access('folder', folder_id, db=db)

View file

@ -329,38 +329,34 @@ def get_automatic1111_api_auth(image_config):
return f'Basic {auth1111_base64_encoded_string}'
@router.get('/config/url/verify')
async def verify_url(request: Request, user=Depends(get_admin_user)):
image_config = await get_image_config()
if image_config.IMAGE_GENERATION_ENGINE == 'automatic1111':
try:
session = await get_session()
async with session.get(
url=f'{image_config.AUTOMATIC1111_BASE_URL}/sdapi/v1/options',
headers={'authorization': get_automatic1111_api_auth(image_config)},
ssl=AIOHTTP_CLIENT_SESSION_SSL,
) as r:
r.raise_for_status()
return True
except Exception:
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.INVALID_URL)
elif image_config.IMAGE_GENERATION_ENGINE == 'comfyui':
headers = None
if image_config.COMFYUI_API_KEY:
headers = {'Authorization': f'Bearer {image_config.COMFYUI_API_KEY}'}
try:
session = await get_session()
async with session.get(
url=f'{image_config.COMFYUI_BASE_URL}/object_info',
headers=headers,
ssl=AIOHTTP_CLIENT_SESSION_SSL,
) as r:
r.raise_for_status()
return True
except Exception:
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.INVALID_URL)
class ConnectionVerificationForm(BaseModel):
engine: str
url: str
key: str | None = None
@router.post('/verify')
async def verify_connection(form_data: ConnectionVerificationForm, user=Depends(get_admin_user)):
url = form_data.url.rstrip('/')
headers = {}
if form_data.engine == 'automatic1111':
url = f'{url}/sdapi/v1/options'
if form_data.key is not None:
headers['Authorization'] = f'Basic {base64.b64encode(form_data.key.encode("utf-8")).decode("utf-8")}'
elif form_data.engine == 'comfyui':
url = f'{url}/object_info'
if form_data.key:
headers['Authorization'] = f'Bearer {form_data.key}'
else:
return True
raise HTTPException(status_code=400, detail='Unsupported image engine')
try:
session = await get_session()
async with session.get(url=url, headers=headers, ssl=AIOHTTP_CLIENT_SESSION_SSL) as r:
r.raise_for_status()
return True
except Exception:
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.INVALID_URL)
@router.get('/models')
@ -671,7 +667,9 @@ async def image_generations(
if image_url := image.get('url', None):
image_data, content_type = await get_image_data(
image_url,
{k: v for k, v in headers.items() if k != 'Content-Type'},
{k: v for k, v in headers.items() if k != 'Content-Type'}
if _is_same_origin(image_url, image_config.IMAGES_OPENAI_API_BASE_URL)
else None,
)
else:
image_data, content_type = await get_image_data(image['b64_json'])
@ -922,11 +920,8 @@ async def image_edits(
if data.startswith('http://') or data.startswith('https://'):
parsed = urlparse(data)
if (
parsed.netloc == urlparse(str(request.base_url)).netloc
and parsed.path.startswith('/api/v1/files/')
and '/content' in parsed.path
):
# Fetching /api/v1/files/{id}/content over the network would be unauthenticated.
if parsed.path.startswith('/api/v1/files/') and '/content' in parsed.path:
return await load_url_image(parsed.path)
# Validate URL to prevent SSRF attacks against local/private networks.
@ -1050,7 +1045,9 @@ async def image_edits(
if image_url := image.get('url', None):
image_data, content_type = await get_image_data(
image_url,
{k: v for k, v in headers.items() if k != 'Content-Type'},
{k: v for k, v in headers.items() if k != 'Content-Type'}
if _is_same_origin(image_url, image_config.IMAGES_EDIT_OPENAI_API_BASE_URL)
else None,
)
else:
image_data, content_type = await get_image_data(image['b64_json'])

View file

@ -554,14 +554,15 @@ async def update_note_by_id(
):
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT())
form_data.access_grants = await filter_allowed_access_grants(
await Config.get('user.permissions'),
user.id,
user.role,
form_data.access_grants,
'sharing.public_notes',
db=db,
)
if form_data.access_grants is not None:
form_data.access_grants = await filter_allowed_access_grants(
await Config.get('user.permissions'),
user.id,
user.role,
form_data.access_grants,
'sharing.public_notes',
db=db,
)
try:
note = await Notes.update_note_by_id(id, form_data, db=db)

View file

@ -1425,6 +1425,11 @@ def convert_to_responses_payload(payload: dict) -> dict:
converted_tools.append(tool)
responses_payload['tools'] = converted_tools
# Responses API expects a forced function choice as {"type": "function", "name": ...}
tool_choice = responses_payload.get('tool_choice')
if isinstance(tool_choice, dict) and isinstance(tool_choice.get('function'), dict):
responses_payload['tool_choice'] = {'type': 'function', 'name': tool_choice['function'].get('name', '')}
return responses_payload
@ -1432,17 +1437,32 @@ def convert_responses_result(response: dict) -> dict:
"""
Convert non-streaming Responses API result to Chat Completions format.
Extracts text from message output items so all downstream consumers
Extracts text and function calls from output items so all downstream consumers
(frontend tasks, get_content_from_response) work without modification.
"""
output_items = response.get('output', [])
content = ''
tool_calls = []
for item in output_items:
if item.get('type') == 'message':
for part in item.get('content', []):
if part.get('type') == 'output_text':
content += part.get('text', '')
elif item.get('type') == 'function_call':
arguments = item.get('arguments', '{}')
if not isinstance(arguments, str):
arguments = JSONCodec.dumps(arguments)
tool_calls.append(
{
'id': item.get('call_id', ''),
'type': 'function',
'function': {
'name': item.get('name', ''),
'arguments': arguments,
},
}
)
return {
'id': response.get('id', ''),
@ -1454,8 +1474,9 @@ def convert_responses_result(response: dict) -> dict:
'message': {
'role': 'assistant',
'content': content,
**({'tool_calls': tool_calls} if tool_calls else {}),
},
'finish_reason': 'stop',
'finish_reason': 'tool_calls' if tool_calls else 'stop',
}
],
'usage': response.get('usage', {}),

View file

@ -115,6 +115,7 @@ from open_webui.retrieval.web.serphouse import search_serphouse
from open_webui.retrieval.web.serply import search_serply
from open_webui.retrieval.web.serpstack import search_serpstack
from open_webui.retrieval.web.sougou import search_sougou
from open_webui.retrieval.web.staan import search_staan
from open_webui.retrieval.web.tavily import search_tavily
from open_webui.retrieval.web.utils import get_web_loader
from open_webui.retrieval.web.yacy import search_yacy
@ -380,6 +381,9 @@ RETRIEVAL_CONFIG_KEYS = {
'SERPSTACK_HTTPS': 'web.search.serpstack_https',
'SOUGOU_API_SID': 'web.search.sougou_api_sid',
'SOUGOU_API_SK': 'web.search.sougou_api_sk',
'STAAN_API_KEY': 'web.search.staan_api_key',
'STAAN_MARKET': 'web.search.staan_market',
'STAAN_MAX_SNIPPETS': 'web.search.staan_max_snippets',
'TAVILY_API_KEY': 'web.search.tavily_api_key',
'TAVILY_EXTRACT_DEPTH': 'web.search.tavily_extract_depth',
'TEXT_SPLITTER': 'rag.text_splitter',
@ -737,6 +741,9 @@ async def get_rag_config(request: Request, user=Depends(get_admin_user)):
'SERPLY_API_KEY': config.SERPLY_API_KEY,
'DDGS_BACKEND': config.DDGS_BACKEND,
'TAVILY_API_KEY': config.TAVILY_API_KEY,
'STAAN_API_KEY': config.STAAN_API_KEY,
'STAAN_MARKET': config.STAAN_MARKET,
'STAAN_MAX_SNIPPETS': config.STAAN_MAX_SNIPPETS,
'SEARCHAPI_API_KEY': config.SEARCHAPI_API_KEY,
'SEARCHAPI_ENGINE': config.SEARCHAPI_ENGINE,
'SERPAPI_API_KEY': config.SERPAPI_API_KEY,
@ -817,6 +824,9 @@ class WebConfig(BaseModel):
SERPLY_API_KEY: str | None = None
DDGS_BACKEND: str | None = None
TAVILY_API_KEY: str | None = None
STAAN_API_KEY: str | None = None
STAAN_MARKET: str | None = None
STAAN_MAX_SNIPPETS: int | None = None
SEARCHAPI_API_KEY: str | None = None
SEARCHAPI_ENGINE: str | None = None
SERPAPI_API_KEY: str | None = None
@ -1337,6 +1347,9 @@ async def update_rag_config(request: Request, form_data: ConfigForm, user=Depend
config.SERPLY_API_KEY = form_data.web.SERPLY_API_KEY
config.DDGS_BACKEND = form_data.web.DDGS_BACKEND
config.TAVILY_API_KEY = form_data.web.TAVILY_API_KEY
config.STAAN_API_KEY = form_data.web.STAAN_API_KEY
config.STAAN_MARKET = form_data.web.STAAN_MARKET
config.STAAN_MAX_SNIPPETS = form_data.web.STAAN_MAX_SNIPPETS
config.SEARCHAPI_API_KEY = form_data.web.SEARCHAPI_API_KEY
config.SEARCHAPI_ENGINE = form_data.web.SEARCHAPI_ENGINE
config.SERPAPI_API_KEY = form_data.web.SERPAPI_API_KEY
@ -1490,6 +1503,9 @@ async def update_rag_config(request: Request, form_data: ConfigForm, user=Depend
'SERPHOUSE_DOMAIN': config.SERPHOUSE_DOMAIN,
'SERPLY_API_KEY': config.SERPLY_API_KEY,
'TAVILY_API_KEY': config.TAVILY_API_KEY,
'STAAN_API_KEY': config.STAAN_API_KEY,
'STAAN_MARKET': config.STAAN_MARKET,
'STAAN_MAX_SNIPPETS': config.STAAN_MAX_SNIPPETS,
'SEARCHAPI_API_KEY': config.SEARCHAPI_API_KEY,
'SEARCHAPI_ENGINE': config.SEARCHAPI_ENGINE,
'SERPAPI_API_KEY': config.SERPAPI_API_KEY,
@ -2689,6 +2705,19 @@ async def search_web(request: Request, engine: str, query: str, user=None) -> li
)
else:
raise Exception('No TAVILY_API_KEY found in environment variables')
elif engine == 'staan':
if config.STAAN_API_KEY:
return await asyncio.to_thread(
search_staan,
config.STAAN_API_KEY,
query,
config.WEB_SEARCH_RESULT_COUNT,
config.WEB_SEARCH_DOMAIN_FILTER_LIST,
market=config.STAAN_MARKET,
max_snippets=config.STAAN_MAX_SNIPPETS,
)
else:
raise Exception('No STAAN_API_KEY found in environment variables')
elif engine == 'exa':
if config.EXA_API_KEY:
return await asyncio.to_thread(

View file

@ -753,31 +753,60 @@ async def patch_user(
)
update_data = {}
fields = {
'userName': 'email',
'displayName': 'name',
'emails[primary eq true].value': 'email',
'name.formatted': 'name',
}
for operation in patch_data.Operations:
op = operation.op.lower()
path = operation.path
value = operation.value
if op == 'replace':
if op not in ('add', 'replace', 'remove'):
return scim_error(400, f'Unsupported PATCH operation: {operation.op}')
if op == 'remove':
if not path:
return scim_error(400, 'Remove requires a path', 'noTarget')
if path != 'externalId':
return scim_error(400, f'Removing {path} is not supported', 'mutability')
values = {path: None}
elif path is None:
if not isinstance(operation.value, dict) or not operation.value:
return scim_error(400, 'A pathless operation requires an attribute object', 'invalidValue')
values = operation.value
else:
values = {path: operation.value}
for path, value in values.items():
if path == 'active':
if not isinstance(value, bool):
return scim_error(400, 'active must be a boolean', 'invalidValue')
# Same guard as update_user: never demote an existing admin via SCIM.
if user.role != 'admin':
update_data['role'] = 'user' if value else 'pending'
elif path == 'userName':
update_data['email'] = value
elif path == 'displayName':
update_data['name'] = value
elif path == 'emails[primary eq true].value':
update_data['email'] = value
elif path == 'name.formatted':
update_data['name'] = value
elif path in fields:
if not isinstance(value, str):
return scim_error(400, f'{path} must be a string', 'invalidValue')
update_data[fields[path]] = value
elif path == 'externalId':
if value is not None and not isinstance(value, str):
return scim_error(400, 'externalId must be a string or null', 'invalidValue')
provider = get_scim_provider()
await Users.update_user_scim_by_id(user_id, provider, value, db=db)
scim = dict(update_data.get('scim', user.scim) or {})
scim[provider] = {'external_id': value}
update_data['scim'] = scim
else:
return scim_error(400, f'Unsupported PATCH path: {path}', 'invalidPath')
# Validate all operations before persisting once, and leave identical writes unchanged.
update_data = {key: value for key, value in update_data.items() if value != getattr(user, key)}
user_updated_fields = ['externalId' if field == 'scim' else field for field in update_data if field != 'role']
# Update user
if update_data:
update_data['updated_at'] = int(time.time())
updated_user = await Users.update_user_by_id(user_id, update_data, db=db)
if not updated_user:
raise HTTPException(
@ -788,7 +817,6 @@ async def patch_user(
updated_user = user
role_changed = updated_user.role != user.role
user_updated_fields = [field for field in update_data.keys() if field != 'role']
if user_updated_fields:
await publish_event(

View file

@ -27,7 +27,7 @@ from open_webui.models.tools import (
)
from open_webui.utils.access_control import (
filter_allowed_access_grants,
has_access,
has_connection_access,
has_permission,
)
from open_webui.utils.auth import get_admin_user, get_verified_user
@ -102,7 +102,7 @@ async def get_tools(
)
# OpenAPI Tool Servers
server_access_grants = {}
server_connections = {}
for server in await get_tool_servers(request):
server_idx = server.get('idx', 0)
connections = await Config.get('tool_server.connections', [])
@ -113,10 +113,8 @@ async def get_tools(
)
continue
connection = connections[server_idx]
server_config = connection.get('config', {})
server_id = f'server:{server.get("id")}'
server_access_grants[server_id] = server_config.get('access_grants', [])
server_connections[server_id] = connection
tools.append(
ToolUserResponse(
@ -149,10 +147,8 @@ async def get_tools(
user.id, f'mcp:{server_id}'
)
server_config = server.get('config') or {}
tool_id = f'server:mcp:{info.get("id")}'
server_access_grants[tool_id] = server_config.get('access_grants', [])
server_connections[tool_id] = server
tools.append(
ToolUserResponse(
@ -181,12 +177,10 @@ async def get_tools(
tool
for tool in tools
if not str(tool.id).startswith('server:')
or await has_access(
user.id,
'read',
server_access_grants.get(str(tool.id), []),
or await has_connection_access(
user,
server_connections[str(tool.id)],
user_group_ids,
db=db,
)
]

View file

@ -6,6 +6,7 @@ import logging
import random
import sys
import time
from contextlib import suppress
from typing import Any
import pycrdt as Y
@ -38,17 +39,23 @@ from open_webui.models.folders import Folders
from open_webui.models.notes import Notes, NoteUpdateForm
from open_webui.models.users import UserNameResponse, Users
from open_webui.socket.utils import RedisDict, RedisLock, YdocManager
from open_webui.tasks import create_task, stop_item_tasks
from open_webui.tasks import (
REDIS_PUBSUB_MAX_RECONNECT_INTERVAL,
REDIS_PUBSUB_RECONNECT_INTERVAL,
create_task,
stop_item_tasks,
)
from open_webui.utils.access_control import has_permission
from open_webui.utils.auth import get_verified_user_by_token
from open_webui.utils.chat_id import is_saved_chat_id
from open_webui.utils.json_codec import SOCKETIO_JSON
from open_webui.utils.json_codec import SOCKETIO_JSON, JSONCodec, dumps_bytes
from open_webui.utils.misc import get_output_text
from open_webui.utils.redis import (
build_sentinel_url,
get_redis_connection,
get_sentinels_from_env,
)
from redis.exceptions import RedisError
from socketio.packet import Packet
logging.basicConfig(stream=sys.stdout, level=GLOBAL_LOG_LEVEL)
@ -190,6 +197,11 @@ YDOC_MANAGER = YdocManager(
redis_key_prefix=f'{REDIS_KEY_PREFIX}:ydoc:documents',
)
REDIS_EVENT_CHANNEL = f'{REDIS_KEY_PREFIX}:direct_completion'
EVENT_QUEUES: dict[str, asyncio.Queue] = {}
EVENT_PUBLISH_LOCK = asyncio.Lock()
def get_session_pool_batches():
"""All session pool entries, in bounded batches for the Redis backing."""
@ -828,27 +840,28 @@ async def yjs_document_update(sid, data):
log.warning(f'User {user.get("id")} does not have write access to note {note_id}. Rejecting update.')
return
user_id = data.get('user_id', sid)
update = data.get('update') # List of bytes from frontend
update = data['update'] # List of bytes from frontend
if update:
user_id = data.get('user_id', sid)
await YDOC_MANAGER.append_to_updates(
document_id=document_id,
update=update, # Convert list of bytes to bytes
)
await YDOC_MANAGER.append_to_updates(
document_id=document_id,
update=update, # Convert list of bytes to bytes
)
# Broadcast update to all other users in the document
await sio.emit(
'ydoc:document:update',
{
'document_id': document_id,
'user_id': user_id,
'update': update,
'socket_id': sid, # Add socket_id to match frontend filtering
},
room=f'doc_{document_id}',
skip_sid=sid,
)
# Broadcast update to all other users in the document
await sio.emit(
'ydoc:document:update',
{
'document_id': document_id,
'user_id': user_id,
'update': update,
'socket_id': sid, # Add socket_id to match frontend filtering
},
room=f'doc_{document_id}',
skip_sid=sid,
)
async def debounced_save():
await asyncio.sleep(0.5)
@ -948,6 +961,62 @@ async def disconnect(sid, reason=None):
# print(f"Unknown session ID {sid} disconnected")
async def redis_event_listener() -> None:
"""Route events received over Redis to their local queues."""
reconnect_interval = REDIS_PUBSUB_RECONNECT_INTERVAL
while True:
pubsub = None
try:
# RedisCluster can't route a pubsub subscribe until initialize() fills its slot cache.
await REDIS.initialize()
pubsub = REDIS.pubsub()
await pubsub.subscribe(REDIS_EVENT_CHANNEL)
reconnect_interval = REDIS_PUBSUB_RECONNECT_INTERVAL
async for message in pubsub.listen():
if message['type'] != 'message':
continue
event = JSONCodec.loads(message['data'])
queue = EVENT_QUEUES.get(event['channel'])
if queue is not None:
await queue.put(event['data'])
log.warning('Redis event listener stopped. Retrying.')
except asyncio.CancelledError:
raise
except Exception:
log.exception('Redis event listener failed. Retrying.')
finally:
if pubsub:
with suppress(Exception):
await pubsub.aclose()
await asyncio.sleep(reconnect_interval)
reconnect_interval = min(reconnect_interval * 2, REDIS_PUBSUB_MAX_RECONNECT_INTERVAL)
@sio.on('*')
async def socket_event_handler(event: Any, sid: str, *args: Any) -> None:
"""Route user-owned stream events to a local queue or another worker."""
if not isinstance(event, str) or event.count(':') != 2 or not args:
return
user = await get_socket_session_user(sid)
if not user or user.get('id') != event.split(':', 1)[0]:
return
queue = EVENT_QUEUES.get(event)
if queue is not None:
await queue.put(args[0])
elif WEBSOCKET_MANAGER == 'redis':
try:
async with EVENT_PUBLISH_LOCK:
await REDIS.publish(REDIS_EVENT_CHANNEL, dumps_bytes({'channel': event, 'data': args[0]}))
except RedisError as e:
log.debug('Failed to relay socket event %s: %s', event, e)
async def _make_channel_emitter(request_info):
"""Event emitter that routes pipeline output to a channel message.

View file

@ -6,7 +6,7 @@ from uuid import uuid4
from redis.asyncio import Redis
from open_webui.env import REDIS_KEY_PREFIX, REDIS_RESPONSE_STREAM_TTL
from open_webui.env import REDIS_KEY_PREFIX, REDIS_RESPONSE_STREAM_TTL, REDIS_TASK_TTL
from open_webui.utils.json_codec import JSONCodec, dumps_bytes
log = logging.getLogger(__name__)
@ -66,13 +66,28 @@ async def redis_task_command_listener(app):
reconnect_interval = min(reconnect_interval * 2, REDIS_PUBSUB_MAX_RECONNECT_INTERVAL)
async def redis_task_heartbeat(app):
redis: Redis = app.state.redis
while True:
await asyncio.sleep(REDIS_TASK_TTL / 4)
try:
pipe = redis.pipeline(transaction=False)
for task_id in list(tasks):
# EXPIRE cannot recreate a task already removed by cleanup.
pipe.expire(f'{REDIS_TASKS_KEY}:{task_id}', REDIS_TASK_TTL)
await pipe.execute()
except Exception:
log.exception('Redis task heartbeat failed')
### ------------------------------
### REDIS-ENABLED HANDLERS
### ------------------------------
async def redis_save_task(redis: Redis, task_id: str, item_id: str | None):
pipe = redis.pipeline()
pipe = redis.pipeline(transaction=False)
pipe.set(f'{REDIS_TASKS_KEY}:{task_id}', '1', ex=REDIS_TASK_TTL or None)
pipe.hset(REDIS_TASKS_KEY, task_id, item_id or '')
if item_id:
pipe.sadd(f'{REDIS_ITEM_TASKS_KEY}:{item_id}', task_id)
@ -80,25 +95,36 @@ async def redis_save_task(redis: Redis, task_id: str, item_id: str | None):
async def redis_cleanup_task(redis: Redis, task_id: str, item_id: str | None):
pipe = redis.pipeline()
pipe = redis.pipeline(transaction=False)
pipe.delete(f'{REDIS_TASKS_KEY}:{task_id}')
pipe.hdel(REDIS_TASKS_KEY, task_id)
pipe.hdel(REDIS_RESPONSE_STREAMS_KEY, task_id)
if item_id:
pipe.srem(f'{REDIS_ITEM_TASKS_KEY}:{item_id}', task_id)
await pipe.execute()
# Remove the set key entirely if no tasks remain for this item
if await redis.scard(f'{REDIS_ITEM_TASKS_KEY}:{item_id}') == 0:
await redis.delete(f'{REDIS_ITEM_TASKS_KEY}:{item_id}')
else:
await pipe.execute()
await pipe.execute()
async def redis_list_tasks(redis: Redis) -> list[str]:
return list(await redis.hkeys(REDIS_TASKS_KEY))
async def redis_list_tasks(redis: Redis, item_id: str | None = None) -> list[str]:
task_ids = list(
await redis.smembers(f'{REDIS_ITEM_TASKS_KEY}:{item_id}')
if item_id is not None
else await redis.hkeys(REDIS_TASKS_KEY)
)
if not task_ids or REDIS_TASK_TTL == 0:
return task_ids
pipe = redis.pipeline(transaction=False)
for task_id in task_ids:
pipe.exists(f'{REDIS_TASKS_KEY}:{task_id}')
async def redis_list_item_tasks(redis: Redis, item_id: str) -> list[str]:
return list(await redis.smembers(f'{REDIS_ITEM_TASKS_KEY}:{item_id}'))
active = []
for task_id, exists in zip(task_ids, await pipe.execute()):
if exists:
active.append(task_id)
else:
task_item_id = item_id if item_id is not None else await redis.hget(REDIS_TASKS_KEY, task_id)
await redis_cleanup_task(redis, task_id, task_item_id or None)
return active
async def redis_send_command(redis: Redis, command: dict):
@ -166,7 +192,7 @@ async def list_task_ids_by_item_id(redis, id):
List all tasks associated with a specific ID.
"""
if redis:
return await redis_list_item_tasks(redis, id)
return await redis_list_tasks(redis, id)
return list(item_tasks.get(id, []))

View file

@ -29,7 +29,7 @@ from open_webui.models.memories import Memories
from open_webui.models.messages import Message, Messages
from open_webui.models.notes import Notes
from open_webui.models.users import UserModel
from open_webui.retrieval.utils import get_content_from_url
from open_webui.retrieval.utils import filter_source_metadata, get_content_from_url
from open_webui.retrieval.vector.async_client import ASYNC_VECTOR_DB_CLIENT
from open_webui.routers.images import (
CreateImageForm,
@ -526,6 +526,7 @@ async def ask_user(
Use this when the next step depends on user intent, preference, or a tradeoff that cannot be inferred safely.
:param questions: 1-3 question objects, each with id, header, question, and 2-3 options. Each option needs label and description.
List the option you recommend first; the UI labels the first option Recommended.
:param allow_other: Whether users may enter a free-form answer instead of choosing one of the options
:param timeout_ms: How long the browser should keep the prompt open before cancelling it
:return: JSON with status and answers keyed by question id
@ -2461,6 +2462,7 @@ async def grep_chat_files(
"""
Search exact text across files attached to the current chat.
Pass file_id from the attached_files block to search one file.
Auto-detected regex uses RE2 syntax; no lookarounds/backreferences, and shorthand classes are ASCII-only.
:param pattern: The text pattern to search for
:param file_id: Optional attached file ID to search within a single file
@ -2609,6 +2611,7 @@ async def query_chat_files(
for idx, doc in enumerate(documents):
metadata = metadatas[idx] if idx < len(metadatas) and isinstance(metadatas[idx], dict) else {}
chunk = {
**filter_source_metadata(metadata),
'content': doc,
'source': metadata.get('source', metadata.get('name', source_info.get('name', 'Unknown'))),
'file_id': metadata.get('file_id', source_info.get('id', '')),
@ -2636,6 +2639,7 @@ async def grep_knowledge_files(
Search for exact text across knowledge files. Returns matching lines with line numbers.
Unlike query_knowledge_files (semantic/vector search), this performs exact string matching.
Automatically detects regex patterns (e.g. "error|warn", "version \\d+").
Regex uses RE2 syntax; no lookarounds/backreferences, and shorthand character classes are ASCII-only.
Helpful for literal strings, identifiers, error messages, or regex-style searches.
:param pattern: The text pattern to search for (regex auto-detected)
@ -3321,6 +3325,7 @@ async def query_knowledge_files(
for idx, doc in enumerate(documents):
chunk_info = {
**filter_source_metadata(metadatas[idx]),
'content': doc,
'source': metadatas[idx].get('source', metadatas[idx].get('name', 'Unknown')),
'file_id': metadatas[idx].get('file_id', ''),
@ -3344,6 +3349,7 @@ async def query_knowledge_files(
for idx, doc in enumerate(documents):
metadata = metadatas[idx] if idx < len(metadatas) else {}
chunk_info = {
**filter_source_metadata(metadata),
'content': doc,
'source': metadata.get('source', metadata.get('name', knowledge.name)),
'file_id': metadata.get('file_id', f'external-{knowledge.id}'),
@ -3762,7 +3768,7 @@ async def create_automation(
# Validate the RRULE
try:
validate_rrule(rrule, tz=user.timezone)
await validate_rrule(rrule, tz=user.timezone)
except ValueError as e:
return JSONCodec.dumps({'error': f'Invalid schedule: {e}'})
@ -3788,7 +3794,7 @@ async def create_automation(
is_active=True,
)
automation = await Automations.insert(user_id, form, next_run_ns(rrule, tz=tz))
automation = await Automations.insert(user_id, form, await next_run_ns(rrule, tz=tz))
return JSONCodec.dumps(
{
@ -3799,7 +3805,7 @@ async def create_automation(
'model_id': model_id,
'target': automation.data.get('target'),
'is_active': automation.is_active,
'next_runs': next_n_runs_ns(rrule, tz=tz),
'next_runs': await next_n_runs_ns(rrule, tz=tz),
},
ensure_ascii=False,
)
@ -3870,7 +3876,7 @@ async def update_automation(
# Validate RRULE if changed
if rrule is not None:
try:
validate_rrule(new_rrule, tz=user.timezone)
await validate_rrule(new_rrule, tz=user.timezone)
except ValueError as e:
return JSONCodec.dumps({'error': f'Invalid schedule: {e}'})
@ -3892,7 +3898,7 @@ async def update_automation(
is_active=automation.is_active,
)
updated = await Automations.update_by_id(automation_id, form, next_run_ns(new_rrule, tz=tz))
updated = await Automations.update_by_id(automation_id, form, await next_run_ns(new_rrule, tz=tz))
return JSONCodec.dumps(
{
@ -3903,7 +3909,7 @@ async def update_automation(
'model_id': new_model_id,
'target': updated.data.get('target'),
'is_active': updated.is_active,
'next_runs': next_n_runs_ns(new_rrule, tz=tz),
'next_runs': await next_n_runs_ns(new_rrule, tz=tz),
},
ensure_ascii=False,
)
@ -3971,7 +3977,7 @@ async def list_automations(
'rrule': rrule,
'is_active': item.is_active,
'last_run_at': item.last_run_at,
'next_runs': next_n_runs_ns(rrule, tz=user.timezone if user else None),
'next_runs': await next_n_runs_ns(rrule, tz=user.timezone if user else None),
}
)
@ -4018,7 +4024,7 @@ async def toggle_automation(
rrule = automation.data.get('rrule', '')
toggled = await Automations.toggle(
automation_id,
next_run_ns(rrule, tz=user.timezone if user else None),
await next_run_ns(rrule, tz=user.timezone if user else None),
)
return JSONCodec.dumps(

View file

@ -17,7 +17,7 @@ from collections.abc import Callable
from contextlib import contextmanager
from typing import Optional
import regex
import re2
from fastapi import Request
from open_webui.env import (
@ -31,12 +31,9 @@ log = logging.getLogger(__name__)
DEFAULT_HEAD_LINES = 10
DEFAULT_TAIL_LINES = 10
# Matching time allowed per tool call. Backtracking cost is exponential in the length of the
# matched text, so capping the pattern or the line does not bound it.
# Total matching time allowed per tool call, checked between RE2's linear-time searches.
MATCH_BUDGET_SECONDS = 2.0
MAX_REGEX_QUANTIFIER_COUNT = 2_000
MAX_REGEX_QUANTIFIER_EXPANSION = 100_000
_COUNTED_QUANTIFIER_RE = re.compile(r'(?<!\\)\{(\d+)(?:,\d*)?\}')
MAX_SEARCH_PATTERN_LENGTH = 4_096
class MatchBudgetExceeded(Exception):
@ -90,48 +87,36 @@ def normalize_regex(pattern: str) -> str:
return pattern.replace(r'\|', '|').replace(r'\|', '|')
def validate_regex_quantifiers(pattern: str) -> str | None:
"""Reject counted quantifiers that make regex compilation expand too much."""
quantifier_expansion = 1
for quantifier in _COUNTED_QUANTIFIER_RE.finditer(pattern):
count_text = quantifier.group(1)
count = int(count_text) if len(count_text) <= 6 else MAX_REGEX_QUANTIFIER_COUNT + 1
if count > MAX_REGEX_QUANTIFIER_COUNT:
return f'Regex quantifier counts over {MAX_REGEX_QUANTIFIER_COUNT:g} are not supported'
# ponytail: conservative expansion catches nested quantifier bombs without mirroring regex syntax.
quantifier_expansion *= max(count, 1)
if quantifier_expansion > MAX_REGEX_QUANTIFIER_EXPANSION:
return 'Regex quantifiers expand too much, lower the counts'
return None
def build_matcher(pattern: str, case_insensitive: bool = False, use_regex: bool = False) -> tuple:
"""Build a matcher function. Returns (match_fn, error_str_or_None)."""
if len(pattern) > MAX_SEARCH_PATTERN_LENGTH:
return None, f'Search patterns over {MAX_SEARCH_PATTERN_LENGTH} characters are not supported'
if not use_regex and is_regex_pattern(pattern):
use_regex = True
if use_regex:
normalized = normalize_regex(pattern)
quantifier_error = validate_regex_quantifiers(normalized)
if quantifier_error:
return None, quantifier_error
try:
re_flags = regex.IGNORECASE if case_insensitive else 0
compiled = regex.compile(normalized, re_flags)
except regex.error as e:
return None, f'Invalid regex: {e}'
options = re2.Options()
options.case_sensitive = not case_insensitive
options.max_mem = 1 << 20 # Bound compiled programs and the engine's matching cache to 1 MiB.
options.log_errors = False
compiled = re2.compile(normalized, options=options)
except re2.error as e:
return None, f'Invalid or unsupported regex (RE2 syntax): {e}'
budget = _active_budget.get() or MatchBudget()
def matches(line: str) -> bool:
started = time.monotonic()
try:
# A negative timeout disables it, so an exhausted budget must not reach search().
if budget.remaining <= 0:
raise TimeoutError
return bool(compiled.search(line, timeout=budget.remaining))
matched = bool(compiled.search(line))
if time.monotonic() - started >= budget.remaining:
raise TimeoutError
return matched
except TimeoutError:
raise MatchBudgetExceeded(f'Search exceeded {MATCH_BUDGET_SECONDS:g}s, narrow the pattern') from None
finally:
@ -1188,6 +1173,7 @@ async def kb_exec(
Pipes: grep "auth" | head -5
Files: reference by path (docs/api/auth.md), filename, or file ID
Regex: RE2 syntax; no lookarounds/backreferences. Shorthand character classes are ASCII-only.
:param command: A filesystem command string
:return: Command output as text

View file

@ -328,6 +328,10 @@ async def invalidate_token(request, token):
ttl = exp - int(datetime.now(UTC).timestamp()) # Calculate time-to-live for the token
if ttl > 0:
# Revoked tokens must not be able to disconnect newer sessions.
if not await is_valid_token(decoded, request.app.state.redis):
return
# Store the revoked token in Redis with an expiration time
await request.app.state.redis.set(
f'{REDIS_KEY_PREFIX}:auth:token:{jti}:revoked',
@ -335,6 +339,12 @@ async def invalidate_token(request, token):
ex=ttl,
)
user_id = decoded.get('id')
if user_id:
from open_webui.socket.main import disconnect_user_sessions
await disconnect_user_sessions(user_id)
async def revoke_user_tokens(request, user_id: str):
"""Reject every token already issued to a user. Requires Redis."""
@ -356,6 +366,10 @@ async def revoke_user_tokens(request, user_id: str):
ex=int(expires_delta.total_seconds()) if expires_delta else None,
)
from open_webui.socket.main import disconnect_user_sessions
await disconnect_user_sessions(user_id)
def extract_token_from_auth_header(auth_header: str):
return auth_header[len('Bearer ') :]

View file

@ -20,12 +20,10 @@ import logging
import os
import random
import time
from datetime import datetime, timedelta
from datetime import timedelta
from typing import Optional
from uuid import uuid4
from zoneinfo import ZoneInfo
from dateutil.rrule import HOURLY, MINUTELY, SECONDLY, rruleset, rrulestr
from fastapi import Request
from fastapi.security import HTTPAuthorizationCredentials
from open_webui.constants import ERROR_MESSAGES
@ -39,6 +37,13 @@ from open_webui.models.messages import MessageForm
from open_webui.models.users import Users
from open_webui.utils.auth import create_token
from open_webui.utils.misc import parse_duration
from open_webui.utils.recurrence import (
_resolve_tz,
next_n_runs_ns,
next_run_ns,
rrule_interval_seconds,
validate_rrule,
)
from open_webui.utils.task import prompt_template
from open_webui.utils.terminals import get_terminal_server_url
from starlette.datastructures import Headers
@ -50,153 +55,6 @@ TIMER_POLL_INTERVAL = int(os.getenv('TIMER_POLL_INTERVAL', '1'))
CALENDAR_ALERT_LOOKAHEAD_MINUTES = int(os.getenv('CALENDAR_ALERT_LOOKAHEAD_MINUTES', '10'))
####################
# RRULE Helpers
####################
def _resolve_tz(tz: str = None) -> Optional[ZoneInfo]:
"""Safely resolve a timezone string to ZoneInfo.
Returns None (→ server-local fallback) when *tz* is empty, None,
or an unrecognised IANA key. Logs a warning on bad keys so
misconfiguration is visible in the server logs.
"""
if not tz:
return None
try:
return ZoneInfo(tz)
except (KeyError, Exception):
log.warning('Unknown timezone %r — falling back to server time', tz)
return None
def _parse_rule(s: str, now: Optional[datetime] = None):
"""Parse RRULE with clock-aligned DTSTART for sub-daily frequencies.
SECONDLY/MINUTELY/HOURLY rules use a fixed epoch DTSTART (2000-01-01 00:00)
so intervals snap to clock boundaries (e.g. every 5min = :00, :05, :10).
"""
upper = s.upper()
if 'EXRULE' in upper:
raise ValueError('EXRULE is not supported in recurrence rules')
parsed = rrulestr(s, ignoretz=True)
rules = parsed._rrule if isinstance(parsed, rruleset) else [parsed]
if len(rules) > 1:
raise ValueError('only one RRULE is supported per recurrence rule')
rule = rules[0]
start = rule._dtstart.replace(tzinfo=None)
anchor = now or datetime.now()
lines = s.splitlines()
stripped = '\n'.join(line for line in lines if not line.upper().startswith('DTSTART')) or s
has_dtstart = any(line.upper().startswith('DTSTART') for line in lines)
step = {
SECONDLY: timedelta(seconds=rule._interval),
MINUTELY: timedelta(minutes=rule._interval),
HOURLY: timedelta(hours=rule._interval),
}.get(rule._freq)
if step is None:
if not rule._dtstart.tzinfo:
return parsed
return rrulestr(stripped, dtstart=start, ignoretz=True)
if rule._interval < 1:
raise ValueError('RRULE INTERVAL must be a positive integer')
dtstart = None
if has_dtstart:
emitted = ((anchor - start) // step) if anchor > start else 0
emitted *= len(rule._byminute or (0,)) * len(rule._bysecond or (0,))
if emitted <= 100_000:
if rule._dtstart.tzinfo:
dtstart = start
else:
return parsed
if not has_dtstart or dtstart is None:
epoch = datetime(2000, 1, 1)
dtstart = epoch + ((anchor - epoch) // step) * step
return rrulestr(stripped, dtstart=dtstart, ignoretz=True)
def validate_rrule(s: str, tz: str = None) -> None:
"""Raise ValueError if the RRULE is malformed or exhausted.
When *tz* is provided the "now" reference uses the user's local
clock so that near-future schedules are not incorrectly rejected
on servers whose system clock is ahead (e.g. UTC vs US timezones).
"""
upper = s.upper()
if 'COUNT=' in upper and 'DTSTART' not in upper:
raise ValueError(ERROR_MESSAGES.AUTOMATION_COUNT_REQUIRES_DTSTART)
zi = _resolve_tz(tz)
now = datetime.now(zi).replace(tzinfo=None) if zi else datetime.now()
try:
rule = _parse_rule(s, now)
except Exception as e:
raise ValueError(ERROR_MESSAGES.AUTOMATION_INVALID_RRULE(e))
if rule.after(now) is None:
raise ValueError(ERROR_MESSAGES.AUTOMATION_NO_FUTURE_RUNS)
def next_run_ns(s: str, tz: str = None) -> Optional[int]:
"""Next occurrence as epoch nanoseconds, respecting user timezone."""
zi = _resolve_tz(tz)
now = datetime.now(zi) if zi else datetime.now()
now_naive = now.replace(tzinfo=None)
dt = _parse_rule(s, now_naive).after(now_naive)
if dt is None:
return None
if zi:
dt = dt.replace(tzinfo=zi)
return int(dt.timestamp() * 1_000_000_000)
def next_n_runs_ns(s: str, n: int = 5, tz: str = None) -> list[int]:
"""Compute next N occurrences for UI preview.
Uses the user's timezone for the starting "now" so that the
preview matches the user's local clock (same as next_run_ns).
"""
zi = _resolve_tz(tz)
result = []
now = datetime.now(zi).replace(tzinfo=None) if zi else datetime.now()
rule = _parse_rule(s, now)
dt = now
for _ in range(n):
dt = rule.after(dt)
if not dt:
break
if zi:
dt_tz = dt.replace(tzinfo=zi)
result.append(int(dt_tz.timestamp() * 1_000_000_000))
else:
result.append(int(dt.timestamp() * 1_000_000_000))
return result
def rrule_interval_seconds(s: str) -> Optional[int]:
"""Approximate interval between recurrences in seconds.
Returns None for one-shot (COUNT=1) schedules or rules
with fewer than two future occurrences.
"""
if 'COUNT=1' in s:
return None
s = '\n'.join(line for line in s.splitlines() if not line.upper().startswith('DTSTART')) or s
now = datetime.now()
rule = _parse_rule(s, now)
first = rule.after(now)
if first is None:
return None
second = rule.after(first)
if second is None:
return None
return int((second - first).total_seconds())
############################
# Worker Loop
############################

View file

@ -44,7 +44,7 @@ def expand_recurring_event(
original_start_ns = event_dict['start_at']
original_start = to_local_datetime(original_start_ns)
rule_str = '\n'.join(line for line in rrule_str.splitlines() if not line.upper().startswith('DTSTART')) or rrule_str
rule_str = '\n'.join(part for part in rrule_str.split() if not part.upper().startswith('DTSTART')) or rrule_str
try:
# Anchor to the event's real start so day-of-week / day-of-month are correct

View file

@ -23,9 +23,9 @@ from open_webui.routers.pipelines import (
process_pipeline_outlet_filter,
)
from open_webui.socket.main import (
EVENT_QUEUES,
get_event_call,
get_event_emitter,
sio,
)
from open_webui.utils.filter import (
get_filter_functions,
@ -71,19 +71,8 @@ async def generate_direct_chat_completion(
logging.info('WebSocket channel: %s', channel)
if form_data.get('stream'):
q = asyncio.Queue()
async def message_listener(sid, data):
"""
Handle received socket messages and push them into the queue.
"""
await q.put(data)
def remove_message_listener():
sio.handlers['/'].pop(channel, None)
# Register the listener
sio.on(channel, message_listener)
queue = asyncio.Queue()
EVENT_QUEUES[channel] = queue
# Start processing chat completion in background
try:
@ -103,16 +92,15 @@ async def generate_direct_chat_completion(
status = res.get('status', False)
except BaseException:
remove_message_listener()
EVENT_QUEUES.pop(channel, None)
raise
if status:
# Define a generator to stream responses
async def event_generator():
nonlocal q
try:
while True:
data = await q.get() # Wait for new messages
data = await queue.get() # Wait for new messages
if isinstance(data, dict):
if 'done' in data and data['done']:
break # Stop streaming when 'done' is received
@ -127,16 +115,16 @@ async def generate_direct_chat_completion(
log.debug('Error in event generator: %s', e)
pass
finally:
remove_message_listener()
EVENT_QUEUES.pop(channel, None)
# Define a background task to run the event generator
async def background():
remove_message_listener()
EVENT_QUEUES.pop(channel, None)
# Return the streaming response
return StreamingResponse(event_generator(), media_type='text/event-stream', background=background)
else:
remove_message_listener()
EVENT_QUEUES.pop(channel, None)
raise Exception(str(res))
else:
res = await event_caller(

View file

@ -75,9 +75,16 @@ async def get_image_base64_from_url(url: str, user=None) -> Optional[str]:
# rebinding DNS answer that passed validate_url cannot reach an internal address.
async with get_ssrf_safe_session() as session:
async with session.get(
url, ssl=AIOHTTP_CLIENT_SESSION_SSL, allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS
url,
ssl=AIOHTTP_CLIENT_SESSION_SSL,
allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS,
headers={'Accept-Encoding': 'identity'},
) as response:
response.raise_for_status()
# Accept-Encoding is only a request; the sender can still compress and pick our decompressed size.
encodings = response.headers.getall('Content-Encoding', ())
if any(encoding.lower() not in ('', 'identity') for encoding in encodings):
return None
image_data = bytearray()
total = 0
async for chunk in response.content.iter_chunked(64 * 1024):

View file

@ -2,6 +2,7 @@ import ast
import asyncio
import base64
import copy
import html
import inspect
import json
import logging
@ -52,7 +53,7 @@ from open_webui.models.models import Models
from open_webui.models.notes import Notes
from open_webui.models.oauth_sessions import OAuthSessions
from open_webui.models.users import UserModel, Users
from open_webui.retrieval.utils import get_sources_from_items
from open_webui.retrieval.utils import filter_source_metadata, get_sources_from_items
from open_webui.routers.images import (
CreateImageForm,
EditImageForm,
@ -117,6 +118,7 @@ from open_webui.utils.misc import (
get_response_error_detail,
get_reasoning_details,
get_system_message,
is_raster_image_content_type,
is_string_allowed,
merge_system_messages,
prepend_to_first_user_message_content,
@ -951,11 +953,17 @@ def get_source_context(sources: list, source_ids: dict = None, include_content:
src_type = source.get('source', {}).get('type')
src_rid = source.get('source', {}).get('id')
body = doc if include_content else ''
extra_attrs = ''
for key, value in filter_source_metadata(meta).items():
if key in ('id', 'name', 'resource-type', 'resource-id'):
continue
extra_attrs += f' {key}="{html.escape(str(value))}"'
context_string += (
f'<source id="{source_ids[source_id]}"'
+ (f' name="{src_name}"' if src_name else '')
+ (f' resource-type="{src_type}"' if src_type else '')
+ (f' resource-id="{src_rid}"' if src_rid else '')
+ extra_attrs
+ f'>{body}</source>\n'
)
return context_string
@ -1258,6 +1266,14 @@ async def process_tool_result(
return tool_result, tool_result_files, tool_result_embeds
def parse_terminal_tool_result(tool_result: Any) -> dict:
try:
result = JSONCodec.loads(tool_result)
except (JSONCodec.JSONDecodeError, TypeError):
return {}
return result if isinstance(result, dict) else {}
async def terminal_event_handler(
tool_function_name: str,
tool_function_params: dict,
@ -1276,17 +1292,13 @@ async def terminal_event_handler(
if tool_function_name == 'display_file':
if tool_function_params.get('inline') is True:
return
path = tool_function_params.get('path', '')
result = parse_terminal_tool_result(tool_result)
# Open Terminal resolves the argument against the session cwd, so prefer its resolved path
path = result.get('path') or tool_function_params.get('path', '')
if not path:
return
# Only emit if the file actually exists
parsed = tool_result
if isinstance(parsed, str):
try:
parsed = JSONCodec.loads(parsed)
except (JSONCodec.JSONDecodeError, TypeError):
pass
if isinstance(parsed, dict) and parsed.get('exists') is False:
if result.get('exists') is False:
return
page = tool_function_params.get('page')
@ -1300,7 +1312,8 @@ async def terminal_event_handler(
}
)
elif tool_function_name in ('write_file', 'replace_file_content'):
path = tool_function_params.get('path', '')
result = parse_terminal_tool_result(tool_result)
path = result.get('path') or tool_function_params.get('path', '')
if not path:
return
await event_emitter(
@ -1725,7 +1738,7 @@ def get_images_from_messages(message_list):
for file in message.get('files', []):
if file.get('type') == 'image':
message_images.append(file.get('url'))
elif file.get('content_type', '').startswith('image/'):
elif is_raster_image_content_type(file.get('content_type')):
message_images.append(file.get('url'))
if message_images:
@ -2221,7 +2234,11 @@ async def load_messages_from_db(chat_id: str, message_id: str) -> Optional[list[
if not db_messages:
return None
return [{k: v for k, v in msg.items() if k in MESSAGE_REPLAY_KEYS} for msg in db_messages]
return [
{k: v for k, v in msg.items() if k in MESSAGE_REPLAY_KEYS}
for msg in db_messages
if not (msg.get('role') == 'assistant' and msg.get('error') and not msg.get('content') and not msg.get('output'))
]
def get_reasoning_format(model: dict) -> str | None:
@ -2273,6 +2290,8 @@ def process_messages_with_output(
if output_messages:
processed.extend(output_messages)
continue
if not message.get('content'):
continue
clean_message = dict(message)
for key in ('id', 'files', 'output', 'model', 'contextSummary', 'context_summary', 'usage'):
@ -2440,7 +2459,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
image_files = [
f
for f in message.get('files', [])
if f.get('type') == 'image' or (f.get('content_type') or '').startswith('image/')
if f.get('type') == 'image' or is_raster_image_content_type(f.get('content_type'))
]
if message.get('role') == 'user' and image_files:
text_content = message.get('content', '')
@ -2664,7 +2683,12 @@ async def process_chat_payload(request, form_data, user, metadata, model):
form_data['messages'],
)
if 'memory' in features and features['memory'] and await Config.get('memories.system_context.enable'):
if (
'memory' in features
and features['memory']
and await Config.get('memories.enable')
and await Config.get('memories.system_context.enable')
):
# features is client-supplied; re-check the permission the native FC path enforces.
if getattr(user, 'role', None) == 'admin' or await has_permission(
getattr(user, 'id', ''),
@ -3036,6 +3060,8 @@ async def process_chat_payload(request, form_data, user, metadata, model):
if direct_tool_servers:
for tool_server in direct_tool_servers:
if tool_server.get('is_terminal') is True and not terminal_capability:
continue
system_prompt = tool_server.pop('system_prompt', None)
if system_prompt:
form_data['messages'] = add_or_update_system_message(
@ -3053,6 +3079,13 @@ async def process_chat_payload(request, form_data, user, metadata, model):
'server': tool_server,
}
if terminal_id and terminal_capability:
from open_webui.utils.terminals import add_terminal_agents_md, get_terminal_agents_md
agents_md = await get_terminal_agents_md(request, user, metadata, extra_params)
if agents_md:
form_data['messages'] = add_terminal_agents_md(form_data['messages'], agents_md)
if mcp_clients:
metadata['mcp_clients'] = mcp_clients
@ -3100,6 +3133,50 @@ async def process_chat_payload(request, form_data, user, metadata, model):
if name not in tools_dict:
tools_dict[name] = tool_dict
# Only advertise user-shell tools when the originating browser has a connected shell.
shell_tools = {
name: tool
for name, tool in tools_dict.items()
if name in {'read_user_terminal', 'send_user_terminal_input'}
and (tool.get('type') == 'terminal' or tool.get('server', {}).get('is_terminal') is True)
}
selected = {
name
for name, tool in shell_tools.items()
if terminal_id
and (
tool.get('tool_id') == f'terminal:{terminal_id}'
or (tool.get('direct') and tool.get('server', {}).get('url') == terminal_id)
)
}
connected = False
if (
selected
and event_caller
and metadata.get('session_id')
and metadata.get('chat_id')
and not metadata.get('automation_id')
and not metadata.get('internal')
):
try:
state = await asyncio.wait_for(
event_caller(
{
'type': 'request:terminal:state',
'data': {'terminal_id': terminal_id, 'session_id': metadata['session_id']},
}
),
timeout=2,
)
connected = isinstance(state, dict) and state.get('connected') is True
except Exception:
# Old/disconnected browsers cannot confirm availability; other tools still work.
pass
for name in shell_tools:
if not connected or name not in selected:
tools_dict.pop(name)
if tools_dict:
# Always store resolved tools in metadata so downstream consumers
# (e.g. pipe functions) can access all tools including MCP and builtins.
@ -4162,13 +4239,14 @@ async def non_streaming_chat_response_handler(response, ctx):
metadata['message_id'],
{
'error': {'content': error},
'done': True,
},
)
if isinstance(error, str) or isinstance(error, dict):
await event_emitter(
{
'type': 'chat:message:error',
'data': {'error': {'content': error}},
'data': {'error': {'content': error}, 'done': True},
}
)

View file

@ -1223,6 +1223,12 @@ def strict_match_mime_type(supported: list[str] | str, header: str) -> str | Non
return None
def is_raster_image_content_type(content_type: str | None) -> bool:
"""Return True if the content type is an image that decodes as a bitmap; SVG is XML."""
base_content_type = (content_type or '').split(';')[0].strip().lower()
return base_content_type.startswith('image/') and base_content_type != 'image/svg+xml'
def extract_urls(text: str) -> list[str]:
# Regex pattern to match URLs
url_pattern = re.compile(r'(https?://[^\s]+)', re.IGNORECASE) # Matches http and https URLs

View file

@ -188,6 +188,16 @@ def _default_value(value):
return getattr(value, 'value', value)
def _get_roles_claim(claims: dict, claim: str) -> list | str | int | None:
"""Read nested or flat claims, preserving explicit empty values and zero."""
value = claims
for key in claim.split('.'):
value = value.get(key) if isinstance(value, dict) else None
if not isinstance(value, (list, str, int)):
value = claims.get(claim)
return value if isinstance(value, (list, str, int)) else None
async def get_oauth_runtime_config() -> SimpleNamespace:
keys = [key for key, _default in OAUTH_RUNTIME_CONFIG.values()]
stored = await Config.get_many(*keys)
@ -1505,7 +1515,7 @@ class OAuthManager:
log.error(f'Exception during token refresh for provider {provider}: {e}')
return None
async def get_user_role(self, user, user_data):
async def get_user_role(self, user, user_data, *, access_token: str | None = None):
auth_config = await get_oauth_runtime_config()
user_count = await Users.get_num_users()
if user and user_count == 1:
@ -1529,18 +1539,15 @@ class OAuthManager:
# Keep existing users at their current role unless the provider sent roles.
role = user.role if user else auth_config.DEFAULT_USER_ROLE
# Next block extracts the roles from the user data, accepting nested claims of any depth
if oauth_claim and oauth_allowed_roles:
claim_data = user_data
nested_claims = oauth_claim.split('.')
for nested_claim in nested_claims:
claim_data = claim_data.get(nested_claim, {})
# Try flat claim structure as alternative
if not claim_data:
claim_data = user_data.get(oauth_claim, {})
oauth_roles = []
if oauth_claim:
claim_data = _get_roles_claim(user_data, oauth_claim)
if claim_data is None and access_token is not None:
# The exchange endpoint has already validated this token with the provider's userinfo endpoint.
try:
token_claims = jwt.decode(access_token, options={'verify_signature': False})
claim_data = _get_roles_claim(token_claims, oauth_claim)
except jwt.PyJWTError as e:
log.debug('Token exchange: cannot decode token claims: %s', e)
if isinstance(claim_data, list):
oauth_roles = claim_data
@ -1553,6 +1560,10 @@ class OAuthManager:
elif isinstance(claim_data, int):
oauth_roles = [str(claim_data)]
if access_token is not None and not oauth_roles and oauth_allowed_roles and '*' not in oauth_allowed_roles:
log.warning('Token exchange denied: no readable roles claim in userinfo or the token')
raise HTTPException(status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED)
log.debug('Oauth Roles claim: %s', oauth_claim)
log.debug('User roles from oauth: %s', oauth_roles)
log.debug('Accepted user roles: %s', oauth_allowed_roles)
@ -1599,9 +1610,10 @@ class OAuthManager:
user_data,
provider,
*,
access_token: str | None = None,
db=None,
):
determined_role = await self.get_user_role(user, user_data)
determined_role = await self.get_user_role(user, user_data, access_token=access_token)
if user.role == determined_role:
return user

View file

@ -0,0 +1,171 @@
"""Recurrence calculations isolated from application/DB imports for worker processes."""
import logging
from datetime import datetime, timedelta
from typing import Optional
from zoneinfo import ZoneInfo
from anyio import fail_after, to_process
from dateutil.rrule import HOURLY, MINUTELY, SECONDLY, rruleset, rrulestr
from open_webui.constants import ERROR_MESSAGES
log = logging.getLogger(__name__)
RRULE_TIMEOUT_SECONDS = 2
class RecurrenceEvaluationTimeout(ValueError):
"""The evaluation budget expired; the schedule may still have occurrences."""
def _resolve_tz(tz: str = None) -> Optional[ZoneInfo]:
"""Safely resolve a timezone string to ZoneInfo.
Returns None (→ server-local fallback) when *tz* is empty, None,
or an unrecognised IANA key. Logs a warning on bad keys so
misconfiguration is visible in the server logs.
"""
if not tz:
return None
try:
return ZoneInfo(tz)
except (KeyError, Exception):
log.warning('Unknown timezone %r — falling back to server time', tz)
return None
def _parse_rule(s: str, now: Optional[datetime] = None):
"""Parse RRULE with clock-aligned DTSTART for sub-daily frequencies.
SECONDLY/MINUTELY/HOURLY rules use a fixed epoch DTSTART (2000-01-01 00:00)
so intervals snap to clock boundaries (e.g. every 5min = :00, :05, :10).
"""
upper = s.upper()
if 'EXRULE' in upper:
raise ValueError('EXRULE is not supported in recurrence rules')
parsed = rrulestr(s, ignoretz=True)
rules = parsed._rrule if isinstance(parsed, rruleset) else [parsed]
if len(rules) > 1:
raise ValueError('only one RRULE is supported per recurrence rule')
rule = rules[0]
start = rule._dtstart.replace(tzinfo=None)
anchor = now or datetime.now()
parts = s.split()
stripped = '\n'.join(part for part in parts if not part.upper().startswith('DTSTART')) or s
has_dtstart = any(part.upper().startswith('DTSTART') for part in parts)
step = {
SECONDLY: timedelta(seconds=rule._interval),
MINUTELY: timedelta(minutes=rule._interval),
HOURLY: timedelta(hours=rule._interval),
}.get(rule._freq)
if step is None:
if not rule._dtstart.tzinfo:
return parsed
return rrulestr(stripped, dtstart=start, ignoretz=True)
if rule._interval < 1:
raise ValueError('RRULE INTERVAL must be a positive integer')
dtstart = None
if has_dtstart:
emitted = ((anchor - start) // step) if anchor > start else 0
emitted *= len(rule._byminute or (0,)) * len(rule._bysecond or (0,))
if emitted <= 100_000:
if rule._dtstart.tzinfo:
dtstart = start
else:
return parsed
if not has_dtstart or dtstart is None:
epoch = datetime(2000, 1, 1)
dtstart = epoch + ((anchor - epoch) // step) * step
return rrulestr(stripped, dtstart=dtstart, ignoretz=True)
def _next_occurrences(s: str, now: datetime, n: int) -> list[datetime]:
rule = _parse_rule(s, now)
occurrences = []
for _ in range(n):
now = rule.after(now)
if now is None:
break
occurrences.append(now)
return occurrences
async def _get_next_occurrences(s: str, now: datetime, n: int) -> list[datetime]:
# A result-count or date limit cannot bound work before the first match.
try:
with fail_after(RRULE_TIMEOUT_SECONDS):
return await to_process.run_sync(_next_occurrences, s, now, n, cancellable=True)
except TimeoutError as e:
raise RecurrenceEvaluationTimeout('Schedule took too long to evaluate; simplify its recurrence rule.') from e
async def validate_rrule(s: str, tz: str = None) -> None:
"""Raise ValueError if the RRULE is malformed or exhausted.
When *tz* is provided the "now" reference uses the user's local
clock so that near-future schedules are not incorrectly rejected
on servers whose system clock is ahead (e.g. UTC vs US timezones).
"""
upper = s.upper()
if 'COUNT=' in upper and 'DTSTART' not in upper:
raise ValueError(ERROR_MESSAGES.AUTOMATION_COUNT_REQUIRES_DTSTART)
zi = _resolve_tz(tz)
now = datetime.now(zi).replace(tzinfo=None) if zi else datetime.now()
try:
occurrences = await _get_next_occurrences(s, now, 1)
except RecurrenceEvaluationTimeout:
raise
except Exception as e:
raise ValueError(ERROR_MESSAGES.AUTOMATION_INVALID_RRULE(e))
if not occurrences:
raise ValueError(ERROR_MESSAGES.AUTOMATION_NO_FUTURE_RUNS)
async def next_run_ns(s: str, tz: str = None) -> Optional[int]:
"""Next occurrence as epoch nanoseconds, respecting user timezone."""
zi = _resolve_tz(tz)
now = datetime.now(zi) if zi else datetime.now()
now_naive = now.replace(tzinfo=None)
occurrences = await _get_next_occurrences(s, now_naive, 1)
if not occurrences:
return None
dt = occurrences[0]
if zi:
dt = dt.replace(tzinfo=zi)
return int(dt.timestamp() * 1_000_000_000)
async def next_n_runs_ns(s: str, n: int = 5, tz: str = None) -> list[int]:
"""Compute next N occurrences for UI preview.
Uses the user's timezone for the starting "now" so that the
preview matches the user's local clock (same as next_run_ns).
"""
zi = _resolve_tz(tz)
result = []
now = datetime.now(zi).replace(tzinfo=None) if zi else datetime.now()
for dt in await _get_next_occurrences(s, now, n):
if zi:
dt_tz = dt.replace(tzinfo=zi)
result.append(int(dt_tz.timestamp() * 1_000_000_000))
else:
result.append(int(dt.timestamp() * 1_000_000_000))
return result
async def rrule_interval_seconds(s: str) -> Optional[int]:
"""Approximate interval between recurrences in seconds.
Returns None for one-shot (COUNT=1) schedules or rules
with fewer than two future occurrences.
"""
s = '\n'.join(part for part in s.split() if not part.upper().startswith('DTSTART')) or s
now = datetime.now()
occurrences = await _get_next_occurrences(s, now, 2)
if len(occurrences) < 2:
return None
return int((occurrences[1] - occurrences[0]).total_seconds())

View file

@ -1,5 +1,8 @@
"""Shared routing helpers for admin-configured terminal servers."""
import asyncio
import logging
import posixpath
from urllib.parse import quote
from open_webui.utils.chat_id import is_saved_chat_id
@ -9,6 +12,9 @@ TERMINAL_CONTEXT_DEFAULT = 'default'
TERMINAL_CONTEXT_TYPES = {'chat', 'automation'}
TERMINAL_CONTEXT_ID_SOURCES = {'chat': 'chat_id', 'automation': 'automation_id'}
TERMINAL_CHAT_UPLOAD_MODES = {'default', 'filesystem'}
MAX_AGENTS_MD_BYTES = 32 * 1024
log = logging.getLogger(__name__)
def is_terminal_orchestrator(connection: dict) -> bool:
@ -131,7 +137,14 @@ async def get_terminal_request_info(request, user, metadata: dict, extra_params:
connection = next((item for item in connections if item.get('id') == terminal_id), None)
if connection:
if not connection.get('enabled', True):
terminal_context = 'automation' if metadata.get('automation_id') else 'chat'
context_id = terminal_context_id(connection, metadata, terminal_context)
config = terminal_context_config(connection, terminal_context)
if (
not connection.get('enabled', True)
or not terminal_context_available(connection, terminal_context)
or (config.get('context_id') in {'chat_id', 'automation_id'} and not context_id)
):
return None
user_group_ids = {group.id for group in await Groups.get_groups_by_member_id(user_model.id)}
if not await has_connection_access(user_model, connection, user_group_ids):
@ -148,15 +161,17 @@ async def get_terminal_request_info(request, user, metadata: dict, extra_params:
headers['X-User-Id'] = user_model.id
if metadata.get('chat_id'):
headers['X-Session-Id'] = metadata['chat_id']
terminal_context = 'automation' if metadata.get('automation_id') else 'chat'
context_id = terminal_context_id(connection, metadata, terminal_context)
if context_id:
headers[TERMINAL_CONTEXT_HEADER] = context_id
return get_terminal_server_url(connection), headers, cookies
selector = str(terminal_id).rstrip('/')
direct_terminal = next(
(server for server in metadata.get('tool_servers') or [] if str(server.get('url') or '').rstrip('/') == selector),
(
server
for server in metadata.get('tool_servers') or []
if str(server.get('url') or '').rstrip('/') == selector
),
None,
)
if not direct_terminal:
@ -171,10 +186,70 @@ async def get_terminal_request_info(request, user, metadata: dict, extra_params:
return selector, headers, {}
async def get_terminal_skill(request, user, metadata: dict, skill_name: str, extra_params: dict | None = None) -> dict | None:
async def get_terminal_agents_md(request, user, metadata: dict, extra_params: dict | None = None) -> str | None:
"""Load the selected terminal user's home AGENTS.md afresh for this turn."""
import aiohttp
from open_webui.env import AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL
try:
async with asyncio.timeout(5):
terminal_request = await get_terminal_request_info(request, user, metadata, extra_params)
if not terminal_request:
return None
base_url, headers, cookies = terminal_request
async with aiohttp.ClientSession(
headers=headers, cookies=cookies, timeout=aiohttp.ClientTimeout(total=5), trust_env=True
) as session:
async with session.get(
f'{base_url.rstrip("/")}/files/cwd',
ssl=AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL,
allow_redirects=False,
) as response:
if response.status != 200:
log.debug('Skipping terminal AGENTS.md: home lookup returned HTTP %s', response.status)
return None
data = await response.json()
home = data.get('home') if isinstance(data, dict) else None
if not isinstance(home, str) or not posixpath.isabs(home):
return None
path = posixpath.join(home, 'AGENTS.md')
async with session.get(
f'{base_url.rstrip("/")}/files/read',
params={'path': path},
ssl=AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL,
allow_redirects=False,
) as response:
if response.status == 404:
return None
response.raise_for_status()
data = await response.json()
content = data.get('content') if isinstance(data, dict) else None
if not isinstance(content, str) or not content.strip():
return None
if len(content.encode('utf-8')) > MAX_AGENTS_MD_BYTES:
log.warning('Skipping terminal AGENTS.md: exceeds %s bytes', MAX_AGENTS_MD_BYTES)
return None
return f'# AGENTS.md\n\n{content}'
except Exception as e:
log.debug('Failed to load terminal AGENTS.md (%s)', type(e).__name__)
return None
def add_terminal_agents_md(messages: list[dict], agents_md: str) -> list[dict]:
"""Place file instructions before user requests without changing their content."""
for index, message in enumerate(messages):
if message.get('role') == 'user':
return [*messages[:index], {'role': 'user', 'content': agents_md}, *messages[index:]]
return messages
async def get_terminal_skill(
request, user, metadata: dict, skill_name: str, extra_params: dict | None = None
) -> dict | None:
from urllib.parse import quote
import aiohttp
from open_webui.env import AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL, AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA
terminal_request = await get_terminal_request_info(request, user, metadata, extra_params)

View file

@ -542,6 +542,7 @@ async def get_builtin_tools(
# Helper to check user-level feature permission (admins always pass)
user = extra_params.get('__user__', {})
config = await Config.get_many(
'memories.enable',
'web.search.enable',
'image_generation.enable',
'images.edit.enable',
@ -655,6 +656,7 @@ async def get_builtin_tools(
# Add memory tools when memory is enabled and the model allows this builtin category.
if (
is_builtin_tool_enabled('memory')
and config.get('memories.enable')
and features.get('memory')
and get_model_capability('memory')
and await has_user_permission('memories')

View file

@ -19,7 +19,8 @@ authlib==1.7.2
joserfc==1.7.4
requests==2.34.2
regex==2026.5.9 # supports a per-search timeout, which `re` does not
regex==2026.5.9
google-re2==1.1.20251105 # bounded compilation and linear-time knowledge searches
aiohttp==3.13.5 # do not update to 3.13.3 - broken
aiodns==3.6.1 # keep pinned: 4.x pulls pycares 5 (c-ares 1.34.6) which breaks DNS on some hosts (#28013, #28215); opt-in via AIOHTTP_CLIENT_ASYNC_DNS_RESOLVER
aiocache==0.12.3

View file

@ -14,7 +14,8 @@ authlib==1.7.2
joserfc==1.7.4
requests==2.34.2
regex==2026.5.9 # supports a per-search timeout, which `re` does not
regex==2026.5.9
google-re2==1.1.20251105 # bounded compilation and linear-time knowledge searches
aiohttp==3.13.5 # do not update to 3.13.3 - broken
aiodns==3.6.1 # keep pinned: 4.x pulls pycares 5 (c-ares 1.34.6) which breaks DNS on some hosts (#28013, #28215); opt-in via AIOHTTP_CLIENT_ASYNC_DNS_RESOLVER
aiocache==0.12.3

View file

@ -26,7 +26,7 @@ export default {
namespaceSeparator: false,
output: 'src/lib/i18n/locales/$LOCALE/$NAMESPACE.json',
pluralSeparator: '_',
input: 'src/**/*.{js,svelte}',
input: 'src/**/*.{js,ts,svelte}',
sort: true,
verbose: true,
failOnWarnings: false,

View file

@ -50,6 +50,7 @@ dependencies = [
"tiktoken==0.13.0",
"regex==2026.5.9",
"google-re2==1.1.20251105",
"mcp==1.27.2",
"openai==2.29.0",

View file

@ -11,18 +11,31 @@ const packages = [
'regex',
'sympy',
'tiktoken',
'seaborn',
'pytz',
'black',
'openai',
'openpyxl'
'openai'
];
// Pure-Python packages whose wheels must be downloaded from PyPI and saved into
// static/pyodide/ so that the browser can install them offline via micropip.
// Packages already provided by the Pyodide distribution (click, platformdirs,
// typing_extensions, etc.) do NOT need to be listed here.
const pypiPackages = ['black', 'pathspec', 'mypy_extensions', 'pytokens'];
// Spell them canonically (dashed): that is the only form pyodide resolves lock entries by.
const pypiPackages = [
'black',
'pathspec',
'mypy-extensions',
'pytokens',
'openpyxl',
'et-xmlfile',
'seaborn'
];
const pypiDepends = {
black: ['click', 'mypy-extensions', 'packaging', 'pathspec', 'platformdirs', 'pytokens'],
openpyxl: ['et-xmlfile'],
seaborn: ['matplotlib', 'numpy', 'pandas']
};
import { loadPyodide } from 'pyodide';
import { setGlobalDispatcher, ProxyAgent } from 'undici';
@ -175,19 +188,18 @@ async function downloadPyPIWheels() {
}
// Inject into pyodide-lock.json so micropip resolves locally
const normalizedName = pkg.replace(/-/g, '_');
if (!lockData.packages[normalizedName]) {
lockData.packages[normalizedName] = {
name: normalizedName,
if (!lockData.packages[pkg]) {
lockData.packages[pkg] = {
name: pkg,
version: version,
file_name: wheel.filename,
install_dir: 'site',
sha256: wheel.digests?.sha256 || '',
package_type: 'package',
imports: [normalizedName],
depends: []
imports: [pkg.replace(/-/g, '_')],
depends: pypiDepends[pkg] || []
};
console.log(` Added ${normalizedName}==${version} to pyodide-lock.json`);
console.log(` Added ${pkg}==${version} to pyodide-lock.json`);
}
}
@ -195,6 +207,31 @@ async function downloadPyPIWheels() {
console.log('Updated pyodide-lock.json with PyPI packages');
}
// A package with no bundled wheel is installed from PyPI in the user's browser instead.
async function verifyBundledWheels() {
const lockPath = 'static/pyodide/pyodide-lock.json';
const lockData = JSON.parse(await readFile(lockPath, 'utf-8'));
const missing = [];
for (const pkg of new Set([...packages, ...pypiPackages, ...Object.values(pypiDepends).flat()])) {
const entry = lockData.packages[pkg.toLowerCase().replace(/[-_.]+/g, '-')];
if (!entry) {
missing.push(pkg);
continue;
}
try {
await access(`static/pyodide/${entry.file_name}`);
} catch {
missing.push(pkg);
}
}
if (missing.length) {
throw new Error(`No wheel bundled for: ${missing.join(', ')}`);
}
console.log('All listed packages are bundled');
}
initNetworkProxyFromEnv();
if (process.env.USE_SLIM === 'true') {
// Rebuild generated assets so a previous full build cannot leave bundled wheels behind.
@ -216,4 +253,5 @@ if (process.env.USE_SLIM === 'true') {
await downloadPackages();
await copyPyodide();
await downloadPyPIWheels();
await verifyBundledWheels();
}

View file

@ -53,7 +53,7 @@ export type CalendarEventForm = {
start_at: number;
end_at?: number;
all_day?: boolean;
rrule?: string;
rrule?: string | null;
color?: string;
location?: string | null;
data?: Record<string, any>;

View file

@ -67,16 +67,20 @@ export const updateConfig = async (token: string = '', config: object) => {
return res;
};
export const verifyConfigUrl = async (token: string = '') => {
export const verifyConnection = async (
token: string = '',
connection: { engine: string; url: string; key?: string | null }
) => {
let error = null;
const res = await fetch(`${IMAGES_API_BASE_URL}/config/url/verify`, {
method: 'GET',
const res = await fetch(`${IMAGES_API_BASE_URL}/verify`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
...(token && { authorization: `Bearer ${token}` })
}
},
body: JSON.stringify(connection)
})
.then(async (res) => {
if (!res.ok) throw await res.json();

View file

@ -1,10 +1,10 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const exportModels = async (token: string, ids: string[]) => {
export const exportModels = async (token: string, ids?: string[]) => {
const query = new URLSearchParams();
ids.forEach((id) => query.append('ids', id));
if (!ids.length) return [];
const response = await fetch(`${WEBUI_API_BASE_URL}/models/export?${query}`, {
(ids ?? []).forEach((id) => query.append('ids', id));
if (ids && !ids.length) return [];
const response = await fetch(`${WEBUI_API_BASE_URL}/models/export${ids ? `?${query}` : ''}`, {
headers: { authorization: `Bearer ${token}` }
});
if (!response.ok) throw await response.json();

View file

@ -559,15 +559,15 @@
class=" text-xs text-gray-700 dark:text-gray-300"
>
{#if ['', 'openapi'].includes(type)}
{$i18n.t('OpenAPI')}
{$i18n.t('settings.admin.integrations.openApi.label')}
{:else if type === 'mcp'}
{$i18n.t('MCP')}
{$i18n.t('settings.admin.integrations.mcp.label')}
<span class="text-gray-500">{$i18n.t('Streamable HTTP')}</span>
{/if}
</button>
{:else}
<div class="text-xs text-gray-700 dark:text-gray-300">
{$i18n.t('OpenAPI')}
{$i18n.t('settings.personal.tools.openApi.label')}
</div>
{/if}
</div>

View file

@ -41,7 +41,7 @@
const closeModal = async () => {
localStorage.version = $config.version;
await settings.set({ ...$settings, ...{ version: $config.version } });
await updateUserSettings(localStorage.token, { ui: $settings });
await updateUserSettings(localStorage.token, { ui: { version: $config.version } });
show = false;
};

View file

@ -321,11 +321,11 @@
<th
scope="col"
class="px-2.5 py-2 font-normal cursor-pointer select-none w-3"
on:click={() => setSortKey('user')}
on:click={() => setSortKey('username')}
>
<div class="flex gap-1.5 items-center justify-end">
{$i18n.t('User')}
{#if orderBy === 'user'}
{#if orderBy === 'username'}
<span class="font-normal">
{#if direction === 'asc'}
<ChevronUp className="size-2" />

View file

@ -244,7 +244,9 @@
dispatch('save');
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Audio')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.audio.title')}
</h2>
{#if $config?.features?.slim === true}
<p class="mb-4 text-xs text-gray-500">
{$i18n.t(
@ -254,10 +256,10 @@
{/if}
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<AdminSettingSection title={$i18n.t('Speech-to-Text')} first>
<AdminSettingSection title={$i18n.t('settings.admin.audio.sections.speechToText.title')} first>
<AdminSettingRow
label={$i18n.t('Speech-to-Text Engine')}
description={$i18n.t('Choose the transcription provider used for audio input.')}
label={$i18n.t('settings.admin.audio.speechToTextEngine.label')}
description={$i18n.t('settings.admin.audio.speechToTextEngine.description')}
>
<SettingsSelect bind:value={STT_ENGINE} placeholder={$i18n.t('Select an engine')}>
<option value="" disabled={$config?.features?.slim === true}
@ -273,8 +275,8 @@
{#if STT_ENGINE !== 'web'}
<AdminSettingField
label={$i18n.t('Supported MIME Types')}
description={$i18n.t('Comma-separated audio or video MIME types accepted for upload.')}
label={$i18n.t('settings.admin.audio.supportedMimeTypes.label')}
description={$i18n.t('settings.admin.audio.supportedMimeTypes.description')}
>
<input
class={inputClass}
@ -286,26 +288,26 @@
{#if STT_ENGINE === 'openai'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('API Base URL')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttOpenaiApiBaseUrl.label')}>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.audio.sttOpenaiApiBaseUrl.label')}
bind:value={STT_OPENAI_API_BASE_URL}
required
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttOpenaiApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.sttOpenaiApiKey.label')}
bind:value={STT_OPENAI_API_KEY}
/>
</AdminSettingField>
</div>
<AdminSettingRow
label={$i18n.t('Request Format')}
description={$i18n.t('Select how audio is sent to the OpenAI-compatible endpoint.')}
label={$i18n.t('settings.admin.audio.requestFormat.label')}
description={$i18n.t('settings.admin.audio.requestFormat.description')}
>
<SettingsSelect bind:value={STT_OPENAI_API_REQUEST_FORMAT}>
<option value="multipart">{$i18n.t('Multipart Upload')}</option>
@ -313,7 +315,7 @@
</SettingsSelect>
</AdminSettingRow>
<AdminSettingField label={$i18n.t('STT Model')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttModel.label')}>
<input
list="stt-openai-model-list"
class={inputClass}
@ -325,17 +327,17 @@
</datalist>
</AdminSettingField>
{:else if STT_ENGINE === 'deepgram'}
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttDeepgramApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.sttDeepgramApiKey.label')}
bind:value={STT_DEEPGRAM_API_KEY}
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('STT Model')}
description={$i18n.t('Leave model field empty to use the default model.')}
label={$i18n.t('settings.admin.audio.sttModel.label')}
description={$i18n.t('settings.admin.audio.sttModel.description')}
>
<input
class={inputClass}
@ -349,38 +351,38 @@
</div>
</AdminSettingField>
{:else if STT_ENGINE === 'azure'}
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttAzureApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.sttAzureApiKey.label')}
bind:value={STT_AZURE_API_KEY}
required
/>
</AdminSettingField>
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('Azure Region')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttAzureRegion.label')}>
<input
class={inputClass}
bind:value={STT_AZURE_REGION}
placeholder={$i18n.t('e.g., westus (leave blank for eastus)')}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Language Locales')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.languageLocales.label')}>
<input
class={inputClass}
bind:value={STT_AZURE_LOCALES}
placeholder={$i18n.t('e.g., en-US,ja-JP (leave blank for auto-detect)')}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Endpoint URL')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttAzureBaseUrl.label')}>
<input
class={inputClass}
bind:value={STT_AZURE_BASE_URL}
placeholder={$i18n.t('(leave blank for to use commercial endpoint)')}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Max Speakers')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.maxSpeakers.label')}>
<input
class={inputClass}
bind:value={STT_AZURE_MAX_SPEAKERS}
@ -390,26 +392,26 @@
</div>
{:else if STT_ENGINE === 'mistral'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('API Base URL')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttMistralApiBaseUrl.label')}>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.audio.sttMistralApiBaseUrl.label')}
bind:value={STT_MISTRAL_API_BASE_URL}
required
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.sttMistralApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.sttMistralApiKey.label')}
bind:value={STT_MISTRAL_API_KEY}
/>
</AdminSettingField>
</div>
<AdminSettingField
label={$i18n.t('STT Model')}
description={$i18n.t('Leave empty to use the default model (voxtral-mini-latest).')}
label={$i18n.t('settings.admin.audio.mistralSttModel.label')}
description={$i18n.t('settings.admin.audio.mistralSttModel.description')}
>
<input class={inputClass} bind:value={STT_MODEL} placeholder="voxtral-mini-latest" />
<div class="mt-1 {linkedHelpClass}">
@ -420,10 +422,8 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Use Chat Completions API')}
description={$i18n.t(
'Use /v1/chat/completions endpoint instead of /v1/audio/transcriptions for potentially better accuracy.'
)}
label={$i18n.t('settings.admin.audio.useChatCompletionsApi.label')}
description={$i18n.t('settings.admin.audio.useChatCompletionsApi.description')}
let:labelId
>
<Switch bind:state={STT_MISTRAL_USE_CHAT_COMPLETIONS} ariaLabelledbyId={labelId} />
@ -433,8 +433,8 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingField
label={$i18n.t('STT Model')}
description={$i18n.t('Open WebUI uses faster-whisper internally.')}
label={$i18n.t('settings.admin.audio.sttWhisperModel.label')}
description={$i18n.t('settings.admin.audio.sttWhisperModel.description')}
>
<div class="flex w-full gap-2">
<input
@ -449,7 +449,7 @@
sttModelUpdateHandler();
}}
disabled={STT_WHISPER_MODEL_LOADING}
aria-label={$i18n.t('Update model')}
aria-label={$i18n.t('settings.admin.audio.updateModel.label')}
>
{#if STT_WHISPER_MODEL_LOADING}
<Spinner />
@ -481,19 +481,15 @@
{/if}
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Text-to-Speech')}>
<AdminSettingSection title={$i18n.t('settings.admin.audio.sections.textToSpeech.title')}>
<AdminSettingRow
label={$i18n.t('Text-to-Speech Engine')}
description={$i18n.t('Choose the speech provider used for assistant audio output.')}
label={$i18n.t('settings.admin.audio.textToSpeechEngine.label')}
description={$i18n.t('settings.admin.audio.textToSpeechEngine.description')}
>
<SettingsSelect
bind:value={TTS_ENGINE}
placeholder={$i18n.t('Select a mode')}
on:change={async (e) => {
await updateConfigHandler();
await getVoices();
await getModels();
const value = (e.currentTarget as HTMLSelectElement).value;
if (value === 'openai') {
@ -506,6 +502,10 @@
TTS_VOICE = '';
TTS_MODEL = '';
}
await updateConfigHandler();
await getVoices();
await getModels();
}}
>
<option value="">{$i18n.t('Web API')}</option>
@ -521,50 +521,50 @@
{#if TTS_ENGINE === 'openai'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('API Base URL')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsOpenaiApiBaseUrl.label')}>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.audio.ttsOpenaiApiBaseUrl.label')}
bind:value={TTS_OPENAI_API_BASE_URL}
required
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsOpenaiApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.ttsOpenaiApiKey.label')}
bind:value={TTS_OPENAI_API_KEY}
/>
</AdminSettingField>
</div>
{:else if TTS_ENGINE === 'elevenlabs'}
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.ttsApiKey.label')}
bind:value={TTS_API_KEY}
required
/>
</AdminSettingField>
{:else if TTS_ENGINE === 'azure'}
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.ttsApiKey.label')}
bind:value={TTS_API_KEY}
required
/>
</AdminSettingField>
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('Azure Region')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsAzureSpeechRegion.label')}>
<input
class={inputClass}
bind:value={TTS_AZURE_SPEECH_REGION}
placeholder={$i18n.t('e.g., westus (leave blank for eastus)')}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Endpoint URL')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsAzureSpeechBaseUrl.label')}>
<input
class={inputClass}
bind:value={TTS_AZURE_SPEECH_BASE_URL}
@ -574,18 +574,18 @@
</div>
{:else if TTS_ENGINE === 'mistral'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('API Base URL')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsMistralApiBaseUrl.label')}>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.audio.ttsMistralApiBaseUrl.label')}
bind:value={TTS_MISTRAL_API_BASE_URL}
required
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsMistralApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.audio.ttsMistralApiKey.label')}
bind:value={TTS_MISTRAL_API_KEY}
/>
</AdminSettingField>
@ -593,7 +593,7 @@
{/if}
{#if TTS_ENGINE === ''}
<AdminSettingField label={$i18n.t('TTS Voice')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsVoice.label')}>
<SettingsSelect bind:value={TTS_VOICE} className="w-full">
<option value="" selected={TTS_VOICE !== ''}>{$i18n.t('Default')}</option>
{#each voices as voice}
@ -610,8 +610,8 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingField
label={$i18n.t('TTS Model')}
description={$i18n.t('Open WebUI uses SpeechT5 and CMU Arctic speaker embeddings.')}
label={$i18n.t('settings.admin.audio.ttsModel.label')}
description={$i18n.t('settings.admin.audio.ttsModel.description')}
>
<input
list="tts-transformers-model-list"
@ -635,7 +635,7 @@
</AdminSettingField>
{:else if TTS_ENGINE === 'openai'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('TTS Voice')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsVoice.label')}>
<TTSVoiceInput
bind:value={TTS_VOICE}
voices={providerVoices}
@ -643,7 +643,7 @@
className={inputClass}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('TTS Model')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsModel.label')}>
<input
list="tts-model-list"
class={inputClass}
@ -653,10 +653,8 @@
</AdminSettingField>
</div>
<AdminSettingField
label={$i18n.t('Additional Parameters')}
description={$i18n.t(
'Enter additional OpenAI-compatible TTS request parameters as JSON.'
)}
label={$i18n.t('settings.admin.audio.additionalParameters.label')}
description={$i18n.t('settings.admin.audio.additionalParameters.description')}
>
<Textarea
className={textareaClass}
@ -666,7 +664,7 @@
</AdminSettingField>
{:else if TTS_ENGINE === 'elevenlabs' || TTS_ENGINE === 'mistral'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('TTS Voice')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsVoice.label')}>
<TTSVoiceInput
bind:value={TTS_VOICE}
voices={providerVoices}
@ -674,7 +672,7 @@
className={inputClass}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('TTS Model')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsModel.label')}>
<input
list="tts-model-list"
class={inputClass}
@ -685,7 +683,7 @@
</div>
{:else if TTS_ENGINE === 'azure'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('TTS Voice')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.ttsVoice.label')}>
<TTSVoiceInput
bind:value={TTS_VOICE}
voices={providerVoices}
@ -693,7 +691,7 @@
className={inputClass}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Output format')}>
<AdminSettingField label={$i18n.t('settings.admin.audio.outputFormat.label')}>
<input
class={inputClass}
bind:value={TTS_AZURE_SPEECH_OUTPUT_FORMAT}
@ -718,10 +716,8 @@
</datalist>
<AdminSettingRow
label={$i18n.t('Response Splitting')}
description={$i18n.t(
"Control how message text is split for TTS requests. 'Punctuation' splits into sentences, 'paragraphs' splits into paragraphs, and 'none' keeps the message as a single string."
)}
label={$i18n.t('settings.admin.audio.responseSplitting.label')}
description={$i18n.t('settings.admin.audio.responseSplitting.description')}
>
<SettingsSelect
aria-label={$i18n.t('Select how to split message text for TTS requests')}

View file

@ -131,15 +131,18 @@
<form class="flex h-full flex-col justify-between text-sm" on:submit|preventDefault={submitHandler}>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('Authentication')}
{$i18n.t('settings.admin.authentication.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if adminConfig !== null}
<AdminSettingSection title={$i18n.t('User Access')} first>
<AdminSettingSection
title={$i18n.t('settings.admin.authentication.sections.userAccess.title')}
first
>
<AdminSettingRow
label={$i18n.t('Default User Role')}
description={$i18n.t('Role assigned to new users when they create an account.')}
label={$i18n.t('settings.admin.authentication.defaultUserRole.label')}
description={$i18n.t('settings.admin.authentication.defaultUserRole.description')}
>
<SettingsSelect
bind:value={adminConfig.DEFAULT_USER_ROLE}
@ -152,8 +155,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Default Group')}
description={$i18n.t('Group assigned to new users by default.')}
label={$i18n.t('settings.admin.authentication.defaultGroup.label')}
description={$i18n.t('settings.admin.authentication.defaultGroup.description')}
>
<SettingsSelect
bind:value={adminConfig.DEFAULT_GROUP_ID}
@ -167,26 +170,24 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Login Form')}
description={$i18n.t(
'Show email and password sign-in on the login page. Set up SSO or LDAP before disabling. Disabling also blocks local sign-ups; password API access is unchanged.'
)}
label={$i18n.t('settings.admin.authentication.loginForm.label')}
description={$i18n.t('settings.admin.authentication.loginForm.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_LOGIN_FORM} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('New Sign Ups')}
description={$i18n.t('Allow new users to create accounts.')}
label={$i18n.t('settings.admin.authentication.newSignUps.label')}
description={$i18n.t('settings.admin.authentication.newSignUps.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_SIGNUP} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('API Keys')}
description={$i18n.t('Allow users to create API keys for programmatic access.')}
label={$i18n.t('settings.admin.authentication.apiKeys.label')}
description={$i18n.t('settings.admin.authentication.apiKeys.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_API_KEYS} ariaLabelledbyId={labelId} />
@ -194,8 +195,10 @@
{#if adminConfig?.ENABLE_API_KEYS}
<AdminSettingRow
label={$i18n.t('API Key Endpoint Restrictions')}
description={$i18n.t('Limit API keys to configured endpoints.')}
label={$i18n.t('settings.admin.authentication.apiKeyEndpointRestrictions.label')}
description={$i18n.t(
'settings.admin.authentication.apiKeyEndpointRestrictions.description'
)}
let:labelId
>
<Switch
@ -206,8 +209,8 @@
{#if adminConfig?.ENABLE_API_KEYS_ENDPOINT_RESTRICTIONS}
<AdminSettingField
label={$i18n.t('Allowed Endpoints')}
description={$i18n.t('Comma-separated API paths that API keys can access.')}
label={$i18n.t('settings.admin.authentication.allowedEndpoints.label')}
description={$i18n.t('settings.admin.authentication.allowedEndpoints.description')}
>
<input
class={inputClass}
@ -227,10 +230,8 @@
{/if}
<AdminSettingField
label={$i18n.t('JWT Expiration')}
description={$i18n.t(
"Valid time units: 's', 'm', 'h', 'd', 'w' or '-1' for no expiration."
)}
label={$i18n.t('settings.admin.authentication.jwtExpiration.label')}
description={$i18n.t('settings.admin.authentication.jwtExpiration.description')}
>
<input
class={inputClass}
@ -251,10 +252,12 @@
</AdminSettingField>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Pending Accounts')}>
<AdminSettingSection
title={$i18n.t('settings.admin.authentication.sections.pendingAccounts.title')}
>
<AdminSettingRow
label={$i18n.t('Admin Details')}
description={$i18n.t('Show admin contact details while an account waits for approval.')}
label={$i18n.t('settings.admin.authentication.adminDetails.label')}
description={$i18n.t('settings.admin.authentication.adminDetails.description')}
let:labelId
>
<Switch bind:state={adminConfig.SHOW_ADMIN_DETAILS} ariaLabelledbyId={labelId} />
@ -262,8 +265,8 @@
{#if adminConfig.SHOW_ADMIN_DETAILS}
<AdminSettingField
label={$i18n.t('Admin Contact Email')}
description={$i18n.t('Email shown in the pending account overlay.')}
label={$i18n.t('settings.admin.authentication.adminContactEmail.label')}
description={$i18n.t('settings.admin.authentication.adminContactEmail.description')}
>
<input
class={inputClass}
@ -275,8 +278,8 @@
{/if}
<AdminSettingField
label={$i18n.t('Pending User Overlay Title')}
description={$i18n.t('Custom title shown while an account waits for approval.')}
label={$i18n.t('settings.admin.authentication.pendingUserOverlayTitle.label')}
description={$i18n.t('settings.admin.authentication.pendingUserOverlayTitle.description')}
>
<Textarea
className={textareaClass}
@ -288,8 +291,10 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Pending User Overlay Content')}
description={$i18n.t('Custom message shown while an account waits for approval.')}
label={$i18n.t('settings.admin.authentication.pendingUserOverlayContent.label')}
description={$i18n.t(
'settings.admin.authentication.pendingUserOverlayContent.description'
)}
>
<Textarea
className={textareaClass}
@ -302,10 +307,10 @@
</AdminSettingSection>
{/if}
<AdminSettingSection title={$i18n.t('LDAP')}>
<AdminSettingSection title={$i18n.t('settings.admin.authentication.sections.ldap.title')}>
<AdminSettingRow
label={$i18n.t('LDAP')}
description={$i18n.t('Allow users to authenticate with an LDAP directory.')}
label={$i18n.t('settings.admin.authentication.ldap.label')}
description={$i18n.t('settings.admin.authentication.ldap.description')}
let:labelId
>
<Switch bind:state={ENABLE_LDAP} ariaLabelledbyId={labelId} />
@ -314,8 +319,8 @@
{#if ENABLE_LDAP}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Label')}
description={$i18n.t('Display name for this LDAP connection.')}
label={$i18n.t('settings.admin.authentication.label.label')}
description={$i18n.t('settings.admin.authentication.label.description')}
>
<input
class={inputClass}
@ -328,8 +333,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Host')}
description={$i18n.t('LDAP server hostname or IP address.')}
label={$i18n.t('settings.admin.authentication.host.label')}
description={$i18n.t('settings.admin.authentication.host.description')}
>
<input
class={inputClass}
@ -339,7 +344,10 @@
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Port')} description={$i18n.t('LDAP server port.')}>
<AdminSettingField
label={$i18n.t('settings.admin.authentication.port.label')}
description={$i18n.t('settings.admin.authentication.port.description')}
>
<Tooltip
placement="top-start"
content={$i18n.t('Default to 389 or 636 if TLS is enabled')}
@ -357,8 +365,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Application DN')}
description={$i18n.t('Bind DN used for directory search.')}
label={$i18n.t('settings.admin.authentication.applicationDn.label')}
description={$i18n.t('settings.admin.authentication.applicationDn.description')}
>
<Tooltip
content={$i18n.t('The Application Account DN you bind with for search')}
@ -373,8 +381,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Application DN Password')}
description={$i18n.t('Password for the bind DN.')}
label={$i18n.t('settings.admin.authentication.applicationDnPassword.label')}
description={$i18n.t('settings.admin.authentication.applicationDnPassword.description')}
>
<SensitiveInput
variant="settings"
@ -387,8 +395,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Attribute for Mail')}
description={$i18n.t('LDAP attribute used as the user email address.')}
label={$i18n.t('settings.admin.authentication.attributeForMail.label')}
description={$i18n.t('settings.admin.authentication.attributeForMail.description')}
>
<Tooltip
content={$i18n.t(
@ -406,8 +414,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Attribute for Username')}
description={$i18n.t('LDAP attribute used as the username.')}
label={$i18n.t('settings.admin.authentication.attributeForUsername.label')}
description={$i18n.t('settings.admin.authentication.attributeForUsername.description')}
>
<Tooltip
content={$i18n.t(
@ -426,8 +434,8 @@
</div>
<AdminSettingField
label={$i18n.t('Search Base')}
description={$i18n.t('Base DN used when searching for users.')}
label={$i18n.t('settings.admin.authentication.searchBase.label')}
description={$i18n.t('settings.admin.authentication.searchBase.description')}
>
<Tooltip content={$i18n.t('The base to search for users')} placement="top-start">
<input
@ -440,8 +448,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Search Filters')}
description={$i18n.t('LDAP filter used to match signing-in users.')}
label={$i18n.t('settings.admin.authentication.searchFilters.label')}
description={$i18n.t('settings.admin.authentication.searchFilters.description')}
>
<input
class={inputClass}
@ -458,8 +466,8 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('TLS')}
description={$i18n.t('Use TLS when connecting to the LDAP server.')}
label={$i18n.t('settings.admin.authentication.tls.label')}
description={$i18n.t('settings.admin.authentication.tls.description')}
let:labelId
>
<Switch bind:state={LDAP_SERVER.use_tls} ariaLabelledbyId={labelId} />
@ -467,8 +475,8 @@
{#if LDAP_SERVER.use_tls}
<AdminSettingField
label={$i18n.t('Certificate Path')}
description={$i18n.t('Certificate file used for TLS verification.')}
label={$i18n.t('settings.admin.authentication.certificatePath.label')}
description={$i18n.t('settings.admin.authentication.certificatePath.description')}
>
<input
class={inputClass}
@ -478,16 +486,16 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Validate Certificate')}
description={$i18n.t('Verify the LDAP server certificate when TLS is enabled.')}
label={$i18n.t('settings.admin.authentication.validateCertificate.label')}
description={$i18n.t('settings.admin.authentication.validateCertificate.description')}
let:labelId
>
<Switch bind:state={LDAP_SERVER.validate_cert} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Ciphers')}
description={$i18n.t('TLS cipher list for LDAP connections.')}
label={$i18n.t('settings.admin.authentication.ciphers.label')}
description={$i18n.t('settings.admin.authentication.ciphers.description')}
>
<Tooltip content={$i18n.t('Default to ALL')} placement="top-start">
<input
@ -503,8 +511,8 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingRow
label={$i18n.t('Group Mapping')}
description={$i18n.t('Map LDAP groups to Open WebUI groups.')}
label={$i18n.t('settings.admin.authentication.enableGroupManagement.label')}
description={$i18n.t('settings.admin.authentication.enableGroupManagement.description')}
let:labelId
>
<Switch bind:state={LDAP_SERVER.enable_group_management} ariaLabelledbyId={labelId} />
@ -512,16 +520,16 @@
{#if LDAP_SERVER.enable_group_management}
<AdminSettingRow
label={$i18n.t('Auto-Create Groups')}
description={$i18n.t('Create missing groups from LDAP groups.')}
label={$i18n.t('settings.admin.authentication.enableGroupCreation.label')}
description={$i18n.t('settings.admin.authentication.enableGroupCreation.description')}
let:labelId
>
<Switch bind:state={LDAP_SERVER.enable_group_creation} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Group Attribute')}
description={$i18n.t('LDAP attribute containing the user group memberships.')}
label={$i18n.t('settings.admin.authentication.groupAttribute.label')}
description={$i18n.t('settings.admin.authentication.groupAttribute.description')}
>
<Tooltip content={$i18n.t('Default to memberOf')} placement="top-start">
<input
@ -536,7 +544,9 @@
</AdminSettingSection>
{#if oauthConfig}
<AdminSettingSection title={$i18n.t('OAuth / OIDC')}>
<AdminSettingSection
title={$i18n.t('settings.admin.authentication.sections.oauthOidc.title')}
>
{#if !oauthEditable}
<div
class="rounded-lg bg-yellow-500/10 px-2 py-1.5 text-[0.6875rem] text-yellow-700 dark:text-yellow-200"
@ -553,8 +563,8 @@
disabled={!oauthEditable}
>
<AdminSettingRow
label={$i18n.t('OAuth / OIDC')}
description={$i18n.t('Allow users to authenticate with an OAuth / OIDC provider.')}
label={$i18n.t('settings.admin.authentication.oauthOidc.label')}
description={$i18n.t('settings.admin.authentication.oauthOidc.description')}
let:labelId
>
<Switch bind:state={oauthConfig.ENABLE_OAUTH} ariaLabelledbyId={labelId} />
@ -563,8 +573,8 @@
{#if oauthConfig.ENABLE_OAUTH}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Provider Name')}
description={$i18n.t('Display name shown for the OAuth provider.')}
label={$i18n.t('settings.admin.authentication.providerName.label')}
description={$i18n.t('settings.admin.authentication.providerName.description')}
>
<input
class={inputClass}
@ -574,8 +584,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Provider URL')}
description={$i18n.t('OpenID discovery URL for this provider.')}
label={$i18n.t('settings.admin.authentication.providerUrl.label')}
description={$i18n.t('settings.admin.authentication.providerUrl.description')}
>
<input
class={inputClass}
@ -587,8 +597,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Client ID')}
description={$i18n.t('OAuth client identifier from the provider.')}
label={$i18n.t('settings.admin.authentication.clientId.label')}
description={$i18n.t('settings.admin.authentication.clientId.description')}
>
<input
class={inputClass}
@ -598,8 +608,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Client Secret')}
description={$i18n.t('OAuth client secret from the provider.')}
label={$i18n.t('settings.admin.authentication.clientSecret.label')}
description={$i18n.t('settings.admin.authentication.clientSecret.description')}
>
<SensitiveInput
variant="settings"
@ -612,8 +622,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Redirect URI')}
description={$i18n.t('Callback URI registered with the provider.')}
label={$i18n.t('settings.admin.authentication.redirectUri.label')}
description={$i18n.t('settings.admin.authentication.redirectUri.description')}
>
<input
class={inputClass}
@ -623,8 +633,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Scopes')}
description={$i18n.t('OAuth scopes requested during sign-in.')}
label={$i18n.t('settings.admin.authentication.scopes.label')}
description={$i18n.t('settings.admin.authentication.scopes.description')}
>
<input
class={inputClass}
@ -636,8 +646,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Email Claim')}
description={$i18n.t('Claim used as the user email address.')}
label={$i18n.t('settings.admin.authentication.emailClaim.label')}
description={$i18n.t('settings.admin.authentication.emailClaim.description')}
>
<input
class={inputClass}
@ -647,8 +657,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Username Claim')}
description={$i18n.t('Claim used as the display name.')}
label={$i18n.t('settings.admin.authentication.usernameClaim.label')}
description={$i18n.t('settings.admin.authentication.usernameClaim.description')}
>
<input
class={inputClass}
@ -660,8 +670,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Picture Claim')}
description={$i18n.t('Claim used as the profile picture URL.')}
label={$i18n.t('settings.admin.authentication.pictureClaim.label')}
description={$i18n.t('settings.admin.authentication.pictureClaim.description')}
>
<input
class={inputClass}
@ -671,8 +681,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Sub Claim')}
description={$i18n.t('Claim used as the stable user identifier.')}
label={$i18n.t('settings.admin.authentication.subClaim.label')}
description={$i18n.t('settings.admin.authentication.subClaim.description')}
>
<input
class={inputClass}
@ -683,16 +693,18 @@
</div>
<AdminSettingRow
label={$i18n.t('OAuth Signup')}
description={$i18n.t('Allow users to create accounts through OAuth.')}
label={$i18n.t('settings.admin.authentication.oauthSignup.label')}
description={$i18n.t('settings.admin.authentication.oauthSignup.description')}
let:labelId
>
<Switch bind:state={oauthConfig.ENABLE_OAUTH_SIGNUP} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Merge Accounts by Email')}
description={$i18n.t('Link OAuth sign-ins to existing accounts with the same email.')}
label={$i18n.t('settings.admin.authentication.mergeAccountsByEmail.label')}
description={$i18n.t(
'settings.admin.authentication.mergeAccountsByEmail.description'
)}
let:labelId
>
<Switch
@ -702,18 +714,16 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Auto Redirect')}
description={$i18n.t(
'Send users directly to the OAuth provider from the sign-in page.'
)}
label={$i18n.t('settings.admin.authentication.autoRedirect.label')}
description={$i18n.t('settings.admin.authentication.autoRedirect.description')}
let:labelId
>
<Switch bind:state={oauthConfig.OAUTH_AUTO_REDIRECT} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Allowed Domains')}
description={$i18n.t('Email domains allowed to sign in with OAuth.')}
label={$i18n.t('settings.admin.authentication.allowedDomains.label')}
description={$i18n.t('settings.admin.authentication.allowedDomains.description')}
>
<input
class={inputClass}
@ -726,8 +736,8 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingRow
label={$i18n.t('Role Mapping')}
description={$i18n.t('Map OAuth claims to Open WebUI roles.')}
label={$i18n.t('settings.admin.authentication.roleMapping.label')}
description={$i18n.t('settings.admin.authentication.roleMapping.description')}
let:labelId
>
<Switch
@ -739,8 +749,8 @@
{#if oauthConfig.ENABLE_OAUTH_ROLE_MANAGEMENT}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Roles Claim')}
description={$i18n.t('Claim containing provider roles.')}
label={$i18n.t('settings.admin.authentication.rolesClaim.label')}
description={$i18n.t('settings.admin.authentication.rolesClaim.description')}
>
<input
class={inputClass}
@ -750,8 +760,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Admin Roles')}
description={$i18n.t('Provider roles that grant admin access.')}
label={$i18n.t('settings.admin.authentication.adminRoles.label')}
description={$i18n.t('settings.admin.authentication.adminRoles.description')}
>
<input
class={inputClass}
@ -762,8 +772,8 @@
</div>
<AdminSettingField
label={$i18n.t('Allowed Roles')}
description={$i18n.t('Provider roles allowed to sign in.')}
label={$i18n.t('settings.admin.authentication.allowedRoles.label')}
description={$i18n.t('settings.admin.authentication.allowedRoles.description')}
>
<input
class={inputClass}
@ -777,8 +787,10 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingRow
label={$i18n.t('Group Mapping')}
description={$i18n.t('Map OAuth claims to Open WebUI groups.')}
label={$i18n.t('settings.admin.authentication.enableOauthGroupManagement.label')}
description={$i18n.t(
'settings.admin.authentication.enableOauthGroupManagement.description'
)}
let:labelId
>
<Switch
@ -789,8 +801,10 @@
{#if oauthConfig.ENABLE_OAUTH_GROUP_MANAGEMENT}
<AdminSettingRow
label={$i18n.t('Auto-Create Groups')}
description={$i18n.t('Create missing groups from OAuth claims.')}
label={$i18n.t('settings.admin.authentication.enableOauthGroupCreation.label')}
description={$i18n.t(
'settings.admin.authentication.enableOauthGroupCreation.description'
)}
let:labelId
>
<Switch
@ -801,8 +815,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Group Claim')}
description={$i18n.t('Claim containing provider groups.')}
label={$i18n.t('settings.admin.authentication.groupClaim.label')}
description={$i18n.t('settings.admin.authentication.groupClaim.description')}
>
<input
class={inputClass}
@ -812,8 +826,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Blocked Groups')}
description={$i18n.t('Provider groups blocked from signing in.')}
label={$i18n.t('settings.admin.authentication.blockedGroups.label')}
description={$i18n.t('settings.admin.authentication.blockedGroups.description')}
>
<input
class={inputClass}
@ -825,8 +839,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Update Email')}
description={$i18n.t('Refresh the account email from OAuth on sign-in.')}
label={$i18n.t('settings.admin.authentication.updateEmail.label')}
description={$i18n.t('settings.admin.authentication.updateEmail.description')}
let:labelId
>
<Switch
@ -836,8 +850,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Update Name')}
description={$i18n.t('Refresh the account name from OAuth on sign-in.')}
label={$i18n.t('settings.admin.authentication.updateName.label')}
description={$i18n.t('settings.admin.authentication.updateName.description')}
let:labelId
>
<Switch
@ -847,8 +861,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Update Picture')}
description={$i18n.t('Refresh the profile picture from OAuth on sign-in.')}
label={$i18n.t('settings.admin.authentication.updatePicture.label')}
description={$i18n.t('settings.admin.authentication.updatePicture.description')}
let:labelId
>
<Switch

View file

@ -44,15 +44,18 @@
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('Code Execution')}
{$i18n.t('settings.admin.codeExecution.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if config}
<AdminSettingSection title={$i18n.t('Code Execution')} first>
<AdminSettingSection
title={$i18n.t('settings.admin.codeExecution.sections.codeExecution.title')}
first
>
<AdminSettingRow
label={$i18n.t('Enable Code Execution')}
description={$i18n.t('Allow models to run generated code and return execution results.')}
label={$i18n.t('settings.admin.codeExecution.enableCodeExecution.label')}
description={$i18n.t('settings.admin.codeExecution.enableCodeExecution.description')}
let:labelId
>
<Switch bind:state={config.ENABLE_CODE_EXECUTION} ariaLabelledbyId={labelId} />
@ -60,12 +63,12 @@
{#if config.ENABLE_CODE_EXECUTION}
<AdminSettingRow
label={$i18n.t('Code Execution Engine')}
label={$i18n.t('settings.admin.codeExecution.codeExecutionEngine.label')}
description={config.CODE_EXECUTION_ENGINE === 'jupyter'
? $i18n.t(
'Warning: Jupyter execution enables arbitrary code execution, posing severe security risks—proceed with extreme caution.'
'Warning: Jupyter execution enables arbitrary code execution, posing severe security risks\u2014proceed with extreme caution.'
)
: $i18n.t('Choose the runtime used for generated code blocks.')}
: $i18n.t('settings.admin.codeExecution.codeExecutionEngine.description')}
>
<SettingsSelect
bind:value={config.CODE_EXECUTION_ENGINE}
@ -81,8 +84,10 @@
{#if config.CODE_EXECUTION_ENGINE === 'jupyter'}
<AdminSettingField
label={$i18n.t('Jupyter URL')}
description={$i18n.t('Connect code execution to a Jupyter server endpoint.')}
label={$i18n.t('settings.admin.codeExecution.codeExecutionJupyterUrl.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeExecutionJupyterUrl.description'
)}
>
<input
class={inputClass}
@ -97,8 +102,10 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingRow
label={$i18n.t('Jupyter Auth')}
description={$i18n.t('Select how Open WebUI authenticates with the Jupyter server.')}
label={$i18n.t('settings.admin.codeExecution.codeExecutionJupyterAuth.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeExecutionJupyterAuth.description'
)}
>
<SettingsSelect
bind:value={config.CODE_EXECUTION_JUPYTER_AUTH}
@ -113,9 +120,11 @@
{#if config.CODE_EXECUTION_JUPYTER_AUTH}
<AdminSettingField
label={config.CODE_EXECUTION_JUPYTER_AUTH === 'password'
? $i18n.t('Jupyter Password')
: $i18n.t('Jupyter Token')}
description={$i18n.t('Credentials used to authenticate with the Jupyter server.')}
? $i18n.t('settings.admin.codeExecution.codeExecutionJupyterAuthPassword.label')
: $i18n.t('settings.admin.codeExecution.codeExecutionJupyterAuthToken.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeExecutionJupyterAuthPassword.description'
)}
>
{#if config.CODE_EXECUTION_JUPYTER_AUTH === 'password'}
<SensitiveInput
@ -138,8 +147,10 @@
{/if}
<AdminSettingField
label={$i18n.t('Code Execution Timeout')}
description={$i18n.t('Maximum runtime in seconds before execution is stopped.')}
label={$i18n.t('settings.admin.codeExecution.codeExecutionJupyterTimeout.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeExecutionJupyterTimeout.description'
)}
>
<input
class={inputClass}
@ -153,10 +164,12 @@
{/if}
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Code Interpreter')}>
<AdminSettingSection
title={$i18n.t('settings.admin.codeExecution.sections.codeInterpreter.title')}
>
<AdminSettingRow
label={$i18n.t('Enable Code Interpreter')}
description={$i18n.t('Allow models to use the code interpreter tool during chats.')}
label={$i18n.t('settings.admin.codeExecution.enableCodeInterpreter.label')}
description={$i18n.t('settings.admin.codeExecution.enableCodeInterpreter.description')}
let:labelId
>
<Switch bind:state={config.ENABLE_CODE_INTERPRETER} ariaLabelledbyId={labelId} />
@ -164,12 +177,12 @@
{#if config.ENABLE_CODE_INTERPRETER}
<AdminSettingRow
label={$i18n.t('Code Interpreter Engine')}
label={$i18n.t('settings.admin.codeExecution.codeInterpreterEngine.label')}
description={config.CODE_INTERPRETER_ENGINE === 'jupyter'
? $i18n.t(
'Warning: Jupyter execution enables arbitrary code execution, posing severe security risks—proceed with extreme caution.'
'Warning: Jupyter execution enables arbitrary code execution, posing severe security risks\u2014proceed with extreme caution.'
)
: $i18n.t('Choose the runtime used by the code interpreter tool.')}
: $i18n.t('settings.admin.codeExecution.codeInterpreterEngine.description')}
>
<SettingsSelect
bind:value={config.CODE_INTERPRETER_ENGINE}
@ -185,8 +198,10 @@
{#if config.CODE_INTERPRETER_ENGINE === 'jupyter'}
<AdminSettingField
label={$i18n.t('Jupyter URL')}
description={$i18n.t('Connect code interpreter to a Jupyter server endpoint.')}
label={$i18n.t('settings.admin.codeExecution.codeInterpreterJupyterUrl.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeInterpreterJupyterUrl.description'
)}
>
<input
class={inputClass}
@ -201,8 +216,10 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<AdminSettingRow
label={$i18n.t('Jupyter Auth')}
description={$i18n.t('Select how Open WebUI authenticates with the Jupyter server.')}
label={$i18n.t('settings.admin.codeExecution.codeInterpreterJupyterAuth.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeInterpreterJupyterAuth.description'
)}
>
<SettingsSelect
bind:value={config.CODE_INTERPRETER_JUPYTER_AUTH}
@ -217,9 +234,11 @@
{#if config.CODE_INTERPRETER_JUPYTER_AUTH}
<AdminSettingField
label={config.CODE_INTERPRETER_JUPYTER_AUTH === 'password'
? $i18n.t('Jupyter Password')
: $i18n.t('Jupyter Token')}
description={$i18n.t('Credentials used to authenticate with the Jupyter server.')}
? $i18n.t('settings.admin.codeExecution.codeInterpreterJupyterAuthPassword.label')
: $i18n.t('settings.admin.codeExecution.codeInterpreterJupyterAuthToken.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeInterpreterJupyterAuthPassword.description'
)}
>
{#if config.CODE_INTERPRETER_JUPYTER_AUTH === 'password'}
<SensitiveInput
@ -242,8 +261,10 @@
{/if}
<AdminSettingField
label={$i18n.t('Code Execution Timeout')}
description={$i18n.t('Maximum runtime in seconds before execution is stopped.')}
label={$i18n.t('settings.admin.codeExecution.codeInterpreterJupyterTimeout.label')}
description={$i18n.t(
'settings.admin.codeExecution.codeInterpreterJupyterTimeout.description'
)}
>
<input
class={inputClass}
@ -256,9 +277,9 @@
{/if}
<AdminSettingField
label={$i18n.t('Code Interpreter Prompt Template')}
label={$i18n.t('settings.admin.codeExecution.codeInterpreterPromptTemplate.label')}
description={$i18n.t(
'Leave empty to use the default prompt, or enter a custom prompt.'
'settings.admin.codeExecution.codeInterpreterPromptTemplate.description'
)}
>
<Textarea

View file

@ -233,12 +233,14 @@
/>
<form class="flex h-full flex-col justify-between text-sm" on:submit|preventDefault={submitHandler}>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Connections')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.connections.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if ENABLE_OPENAI_API !== null && ENABLE_OLLAMA_API !== null && connectionsConfig !== null}
<AdminSettingSection first>
<AdminSettingRow label={$i18n.t('OpenAI API')} let:labelId>
<AdminSettingRow label={$i18n.t('settings.admin.connections.openaiApi.label')} let:labelId>
<Switch
bind:state={ENABLE_OPENAI_API}
on:change={async () => {
@ -252,10 +254,10 @@
<div>
<div class="mb-2 flex items-center justify-between gap-4">
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Manage OpenAI API Connections')}
{$i18n.t('settings.admin.connections.manageOpenaiApiConnections.label')}
</div>
<Tooltip content={$i18n.t(`Add Connection`)}>
<Tooltip content={$i18n.t('settings.admin.connections.addConnection.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-700 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-gray-300"
on:click={() => {
@ -297,7 +299,7 @@
</div>
{/if}
<AdminSettingRow label={$i18n.t('Ollama API')} let:labelId>
<AdminSettingRow label={$i18n.t('settings.admin.connections.ollamaApi.label')} let:labelId>
<Switch
bind:state={ENABLE_OLLAMA_API}
on:change={async () => {
@ -311,10 +313,10 @@
<div>
<div class="mb-2 flex items-center justify-between gap-4">
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Manage Ollama API Connections')}
{$i18n.t('settings.admin.connections.manageOllamaApiConnections.label')}
</div>
<Tooltip content={$i18n.t(`Add Connection`)}>
<Tooltip content={$i18n.t('settings.admin.connections.addConnection.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-700 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-gray-300"
on:click={() => {
@ -351,7 +353,7 @@
</div>
<div class="mt-1 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t('Trouble accessing Ollama?')}
{$i18n.t('settings.admin.connections.manageOllamaApiConnections.description')}
<a
class="font-normal underline hover:text-gray-700 dark:hover:text-gray-300"
href="https://github.com/open-webui/open-webui#troubleshooting"
@ -364,12 +366,12 @@
{/if}
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('User Connections')}>
<AdminSettingSection
title={$i18n.t('settings.admin.connections.sections.userConnections.title')}
>
<AdminSettingRow
label={$i18n.t('Direct Connections')}
description={$i18n.t(
'Direct Connections allow users to connect to their own OpenAI compatible API endpoints.'
)}
label={$i18n.t('settings.admin.connections.directConnections.label')}
description={$i18n.t('settings.admin.connections.directConnections.description')}
let:labelId
>
<Switch
@ -382,35 +384,19 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Direct Integrations')}
description={$i18n.t(
'Show the Integrations tab for users with permission to manage their own tool and terminal connections, including admins. Hiding it does not disable existing connections.'
)}
let:labelId
>
<Switch
bind:state={connectionsConfig.ENABLE_DIRECT_INTEGRATIONS}
on:change={() => updateConnectionsHandler()}
ariaLabelledbyId={labelId}
/>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Cache Base Model List')}
description={$i18n.t(
'Base Model List Cache speeds up access by fetching base models only at startup or on settings save—faster, but may not show recent base model changes.'
)}
label={$i18n.t('settings.admin.connections.cacheBaseModelList.label')}
description={$i18n.t('settings.admin.connections.cacheBaseModelList.description')}
let:labelId
>
<div class="flex items-center gap-1.5">
{#if connectionsConfig.ENABLE_BASE_MODELS_CACHE}
<Tooltip content={$i18n.t('Refresh')}>
<Tooltip content={$i18n.t('settings.admin.connections.refreshModels.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-gray-300"
type="button"
disabled={modelListRefreshing}
on:click={refreshModelListHandler}
aria-label={$i18n.t('Refresh')}
aria-label={$i18n.t('settings.admin.connections.refreshModels.label')}
>
{#if modelListRefreshing}
<Spinner className="size-3.5" />

View file

@ -52,7 +52,9 @@
</script>
<div class="flex flex-col h-full justify-between text-sm">
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Database')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.db.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<input
@ -82,10 +84,10 @@
}}
/>
<AdminSettingSection title={$i18n.t('Config')} first>
<AdminSettingSection title={$i18n.t('settings.admin.db.sections.config.title')} first>
<AdminSettingRow
label={$i18n.t('Import Config')}
description={$i18n.t('Import admin configuration from a JSON export file.')}
label={$i18n.t('settings.admin.db.importConfig.label')}
description={$i18n.t('settings.admin.db.importConfig.description')}
>
<button
class={actionButtonClass}
@ -99,8 +101,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Export Config')}
description={$i18n.t('Download the current admin configuration as JSON.')}
label={$i18n.t('settings.admin.db.exportConfig.label')}
description={$i18n.t('settings.admin.db.exportConfig.description')}
>
<button
class={actionButtonClass}
@ -119,10 +121,10 @@
</AdminSettingSection>
{#if $config?.features.enable_admin_export ?? true}
<AdminSettingSection title={$i18n.t('Export')}>
<AdminSettingSection title={$i18n.t('settings.admin.db.sections.export.title')}>
<AdminSettingRow
label={$i18n.t('Database')}
description={$i18n.t('Download the application database when supported.')}
label={$i18n.t('settings.admin.db.database.label')}
description={$i18n.t('settings.admin.db.database.description')}
>
<button
class={actionButtonClass}
@ -133,13 +135,13 @@
}}
type="button"
>
{$i18n.t('Database')}
{$i18n.t('settings.admin.db.database.label')}
</button>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('All Chats')}
description={$i18n.t("Download every user's chat history as JSON.")}
label={$i18n.t('settings.admin.db.allChats.label')}
description={$i18n.t('settings.admin.db.allChats.description')}
>
<button class={actionButtonClass} on:click={exportAllUserChats} type="button">
{$i18n.t('Export')}
@ -147,8 +149,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Users')}
description={$i18n.t('Download all users as CSV.')}
label={$i18n.t('settings.admin.db.users.label')}
description={$i18n.t('settings.admin.db.users.description')}
>
<button class={actionButtonClass} on:click={exportUsers} type="button">
{$i18n.t('Export')}

View file

@ -421,7 +421,9 @@
submitHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Documents')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.documents.title')}
</h2>
{#if $config?.features?.slim === true}
<p class="mb-4 text-xs text-gray-500">
{$i18n.t(
@ -432,10 +434,13 @@
{#if RAGConfig}
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<AdminSettingSection title={$i18n.t('Content Extraction')} first>
<AdminSettingSection
title={$i18n.t('settings.admin.documents.sections.contentExtraction.title')}
first
>
<AdminSettingRow
label={$i18n.t('Content Extraction Engine')}
description={$i18n.t('Choose how uploaded documents are parsed before indexing.')}
label={$i18n.t('settings.admin.documents.contentExtractionEngine.label')}
description={$i18n.t('settings.admin.documents.contentExtractionEngine.description')}
>
<SettingsSelect bind:value={RAGConfig.CONTENT_EXTRACTION_ENGINE}>
<option value=""
@ -455,10 +460,8 @@
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Supported Media MIME Types')}
description={$i18n.t(
'Media upload MIME types the content extraction engine may process.'
)}
label={$i18n.t('settings.admin.documents.supportedMediaMimeTypes.label')}
description={$i18n.t('settings.admin.documents.supportedMediaMimeTypes.description')}
>
<input
class={inputClass}
@ -469,18 +472,16 @@
{#if RAGConfig.CONTENT_EXTRACTION_ENGINE === '' && $config?.features?.slim !== true}
<AdminSettingRow
label={$i18n.t('PDF Extract Images (OCR)')}
description={$i18n.t('Extract images from PDFs so OCR can process image-only pages.')}
label={$i18n.t('settings.admin.documents.pdfExtractImagesOcr.label')}
description={$i18n.t('settings.admin.documents.pdfExtractImagesOcr.description')}
let:labelId
>
<Switch bind:state={RAGConfig.PDF_EXTRACT_IMAGES} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('PDF Loader Mode')}
description={$i18n.t(
'Page mode creates one document per page. Single mode keeps pages together for chunking across boundaries.'
)}
label={$i18n.t('settings.admin.documents.pdfLoaderMode.label')}
description={$i18n.t('settings.admin.documents.pdfLoaderMode.description')}
>
<SettingsSelect bind:value={RAGConfig.PDF_LOADER_MODE}>
<option value="page">{$i18n.t('Page')}</option>
@ -489,8 +490,8 @@
</AdminSettingRow>
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'datalab_marker'}
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('Datalab Marker service endpoint used for document parsing.')}
label={$i18n.t('settings.admin.documents.datalabMarkerApiBaseUrl.label')}
description={$i18n.t('settings.admin.documents.datalabMarkerApiBaseUrl.description')}
>
<input
class={inputClass}
@ -500,8 +501,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key used to authenticate with Datalab Marker.')}
label={$i18n.t('settings.admin.documents.datalabMarkerApiKey.label')}
description={$i18n.t('settings.admin.documents.datalabMarkerApiKey.description')}
>
<SensitiveInput
variant="settings"
@ -512,8 +513,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Additional Config')}
description={$i18n.t('JSON options passed to Marker for advanced parsing behavior.')}
label={$i18n.t('settings.admin.documents.additionalConfig.label')}
description={$i18n.t('settings.admin.documents.additionalConfig.description')}
>
<Tooltip
content={$i18n.t(
@ -531,38 +532,36 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Use LLM')}
description={$i18n.t(
'Use an LLM to improve tables, forms, math, and layout detection.'
)}
label={$i18n.t('settings.admin.documents.useLlm.label')}
description={$i18n.t('settings.admin.documents.useLlm.description')}
let:labelId
>
<Switch bind:state={RAGConfig.DATALAB_MARKER_USE_LLM} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Skip Cache')}
description={$i18n.t('Skip cached Marker results and rerun inference.')}
label={$i18n.t('settings.admin.documents.skipCache.label')}
description={$i18n.t('settings.admin.documents.skipCache.description')}
let:labelId
>
<Switch bind:state={RAGConfig.DATALAB_MARKER_SKIP_CACHE} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Force OCR')}
description={$i18n.t('Run OCR on all PDF pages, even pages with embedded text.')}
label={$i18n.t('settings.admin.documents.forceOcr.label')}
description={$i18n.t('settings.admin.documents.forceOcr.description')}
let:labelId
>
<Switch bind:state={RAGConfig.DATALAB_MARKER_FORCE_OCR} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Paginate')}
description={$i18n.t('Separate output by page with page markers.')}
label={$i18n.t('settings.admin.documents.paginate.label')}
description={$i18n.t('settings.admin.documents.paginate.description')}
let:labelId
>
<Switch bind:state={RAGConfig.DATALAB_MARKER_PAGINATE} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Strip Existing OCR')}
description={$i18n.t('Remove existing OCR text and rerun OCR when Force OCR is off.')}
label={$i18n.t('settings.admin.documents.stripExistingOcr.label')}
description={$i18n.t('settings.admin.documents.stripExistingOcr.description')}
let:labelId
>
<Switch
@ -571,8 +570,8 @@
/>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Disable Image Extraction')}
description={$i18n.t('Do not extract images from PDFs during Marker processing.')}
label={$i18n.t('settings.admin.documents.disableImageExtraction.label')}
description={$i18n.t('settings.admin.documents.disableImageExtraction.description')}
let:labelId
>
<Switch
@ -581,15 +580,15 @@
/>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Format Lines')}
description={$i18n.t('Format lines to detect inline math and styles.')}
label={$i18n.t('settings.admin.documents.formatLines.label')}
description={$i18n.t('settings.admin.documents.formatLines.description')}
let:labelId
>
<Switch bind:state={RAGConfig.DATALAB_MARKER_FORMAT_LINES} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Output Format')}
description={$i18n.t('Text output format returned by Marker.')}
label={$i18n.t('settings.admin.documents.outputFormat.label')}
description={$i18n.t('settings.admin.documents.outputFormat.description')}
>
<SettingsSelect bind:value={RAGConfig.DATALAB_MARKER_OUTPUT_FORMAT}>
<option value="markdown">{$i18n.t('Markdown')}</option>
@ -600,8 +599,8 @@
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'external'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Document Loader URL')}
description={$i18n.t('External service endpoint used to load document content.')}
label={$i18n.t('settings.admin.documents.documentLoaderUrl.label')}
description={$i18n.t('settings.admin.documents.documentLoaderUrl.description')}
>
<input
class={inputClass}
@ -610,8 +609,10 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key sent to the external document loader.')}
label={$i18n.t('settings.admin.documents.externalDocumentLoaderApiKey.label')}
description={$i18n.t(
'settings.admin.documents.externalDocumentLoaderApiKey.description'
)}
>
<SensitiveInput
variant="settings"
@ -623,8 +624,8 @@
</div>
<AdminSettingField
label={$i18n.t('Headers')}
description={$i18n.t('Additional JSON headers sent to the external document loader.')}
label={$i18n.t('settings.admin.documents.headers.label')}
description={$i18n.t('settings.admin.documents.headers.description')}
>
<Tooltip
content={$i18n.t(
@ -644,7 +645,7 @@
on:click={() =>
(showExternalDocumentLoaderHeadersHint = !showExternalDocumentLoaderHeadersHint)}
>
{$i18n.t('Header variables')}
{$i18n.t('settings.admin.documents.headerVariables.label')}
</button>
{#if showExternalDocumentLoaderHeadersHint}
<div class="mt-1 text-[0.6875rem] leading-5 text-gray-500 dark:text-gray-400">
@ -667,8 +668,8 @@
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'tika'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Tika Server URL')}
description={$i18n.t('Tika server endpoint used for content extraction.')}
label={$i18n.t('settings.admin.documents.tikaServerUrl.label')}
description={$i18n.t('settings.admin.documents.tikaServerUrl.description')}
>
<input
class={inputClass}
@ -677,8 +678,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Tika Server Version')}
description={$i18n.t('Select the Tika server API version.')}
label={$i18n.t('settings.admin.documents.tikaServerVersion.label')}
description={$i18n.t('settings.admin.documents.tikaServerVersion.description')}
>
<SettingsSelect bind:value={RAGConfig.TIKA_SERVER_VERSION}>
<option value="3">{$i18n.t('Tika 3.x')}</option>
@ -689,8 +690,8 @@
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'docling'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Docling Server URL')}
description={$i18n.t('Docling service endpoint used for parsing.')}
label={$i18n.t('settings.admin.documents.doclingServerUrl.label')}
description={$i18n.t('settings.admin.documents.doclingServerUrl.description')}
>
<input
class={inputClass}
@ -699,8 +700,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key sent to Docling.')}
label={$i18n.t('settings.admin.documents.doclingApiKey.label')}
description={$i18n.t('settings.admin.documents.doclingApiKey.description')}
>
<SensitiveInput
variant="settings"
@ -712,8 +713,8 @@
</div>
<AdminSettingField
label={$i18n.t('Parameters')}
description={$i18n.t('Additional Docling parameters in JSON format.')}
label={$i18n.t('settings.admin.documents.doclingParams.label')}
description={$i18n.t('settings.admin.documents.doclingParams.description')}
>
<Textarea
className={textareaClass}
@ -725,8 +726,8 @@
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'document_intelligence'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Endpoint')}
description={$i18n.t('Document Intelligence endpoint used for parsing.')}
label={$i18n.t('settings.admin.documents.endpoint.label')}
description={$i18n.t('settings.admin.documents.endpoint.description')}
>
<input
class={inputClass}
@ -735,8 +736,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Key')}
description={$i18n.t('Credential used for Document Intelligence.')}
label={$i18n.t('settings.admin.documents.documentIntelligenceKey.label')}
description={$i18n.t('settings.admin.documents.documentIntelligenceKey.description')}
>
<SensitiveInput
variant="settings"
@ -748,8 +749,8 @@
</div>
<AdminSettingField
label={$i18n.t('Document Intelligence Model')}
description={$i18n.t('Model name used by Document Intelligence.')}
label={$i18n.t('settings.admin.documents.documentIntelligenceModel.label')}
description={$i18n.t('settings.admin.documents.documentIntelligenceModel.description')}
>
<input
class={inputClass}
@ -760,8 +761,8 @@
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'mistral_ocr'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('Mistral OCR service endpoint.')}
label={$i18n.t('settings.admin.documents.mistralOcrApiBaseUrl.label')}
description={$i18n.t('settings.admin.documents.mistralOcrApiBaseUrl.description')}
>
<input
class={inputClass}
@ -770,8 +771,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key sent to Mistral OCR.')}
label={$i18n.t('settings.admin.documents.mistralOcrApiKey.label')}
description={$i18n.t('settings.admin.documents.mistralOcrApiKey.description')}
>
<SensitiveInput
variant="settings"
@ -781,8 +782,8 @@
</AdminSettingField>
</div>
<AdminSettingRow
label={$i18n.t('Use Base64')}
description={$i18n.t('Send PDFs as base64 data URLs instead of uploading first.')}
label={$i18n.t('settings.admin.documents.useBase64.label')}
description={$i18n.t('settings.admin.documents.useBase64.description')}
let:labelId
>
<Switch bind:state={RAGConfig.MISTRAL_OCR_USE_BASE64} ariaLabelledbyId={labelId} />
@ -790,8 +791,8 @@
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'paddleocr_vl'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('PaddleOCR-vl service endpoint.')}
label={$i18n.t('settings.admin.documents.paddleocrVlBaseUrl.label')}
description={$i18n.t('settings.admin.documents.paddleocrVlBaseUrl.description')}
>
<input
class={inputClass}
@ -800,8 +801,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Token')}
description={$i18n.t('API token sent to PaddleOCR-vl.')}
label={$i18n.t('settings.admin.documents.apiToken.label')}
description={$i18n.t('settings.admin.documents.apiToken.description')}
>
<SensitiveInput
variant="settings"
@ -813,8 +814,8 @@
</div>
{:else if RAGConfig.CONTENT_EXTRACTION_ENGINE === 'mineru'}
<AdminSettingRow
label={$i18n.t('API Mode')}
description={$i18n.t('Choose the local or cloud MinerU API mode.')}
label={$i18n.t('settings.admin.documents.apiMode.label')}
description={$i18n.t('settings.admin.documents.apiMode.description')}
>
<SettingsSelect
bind:value={RAGConfig.MINERU_API_MODE}
@ -839,8 +840,8 @@
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('API URL')}
description={$i18n.t('MinerU API endpoint for the selected mode.')}
label={$i18n.t('settings.admin.documents.apiUrl.label')}
description={$i18n.t('settings.admin.documents.apiUrl.description')}
>
<input
class={inputClass}
@ -852,19 +853,20 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key used for MinerU cloud mode.')}
label={$i18n.t('settings.admin.documents.mineruApiKey.label')}
description={$i18n.t('settings.admin.documents.mineruApiKey.description')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('Enter MinerU API Key')}
required={false}
bind:value={RAGConfig.MINERU_API_KEY}
/>
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('API Timeout')}
description={$i18n.t('Maximum time in seconds to wait for MinerU API responses.')}
label={$i18n.t('settings.admin.documents.apiTimeout.label')}
description={$i18n.t('settings.admin.documents.apiTimeout.description')}
>
<input
class="w-16 rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 text-right text-xs text-gray-700 outline-hidden transition-colors focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
@ -876,8 +878,8 @@
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Parameters')}
description={$i18n.t('Advanced MinerU parsing parameters in JSON format.')}
label={$i18n.t('settings.admin.documents.mineruParams.label')}
description={$i18n.t('settings.admin.documents.mineruParams.description')}
>
<Textarea
className={textareaClass}
@ -888,8 +890,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('File Extensions')}
description={$i18n.t('Comma-separated extensions MinerU should handle.')}
label={$i18n.t('settings.admin.documents.fileExtensions.label')}
description={$i18n.t('settings.admin.documents.fileExtensions.description')}
>
<input
class={inputClass}
@ -900,9 +902,9 @@
{/if}
<AdminSettingRow
label={$i18n.t('Bypass Embedding and Retrieval')}
label={$i18n.t('settings.admin.documents.bypassEmbeddingAndRetrieval.label')}
description={RAGConfig.BYPASS_EMBEDDING_AND_RETRIEVAL
? $i18n.t('Inject the entire content as context for comprehensive processing.')
? $i18n.t('settings.admin.documents.bypassEmbeddingAndRetrieval.description')
: $i18n.t('Use segmented retrieval for focused and relevant context.')}
let:labelId
>
@ -914,8 +916,8 @@
{#if !RAGConfig.BYPASS_EMBEDDING_AND_RETRIEVAL}
<AdminSettingRow
label={$i18n.t('Text Splitter')}
description={$i18n.t('Choose how extracted text is split before indexing.')}
label={$i18n.t('settings.admin.documents.textSplitter.label')}
description={$i18n.t('settings.admin.documents.textSplitter.description')}
>
<SettingsSelect bind:value={RAGConfig.TEXT_SPLITTER}>
<option value="">{$i18n.t('Default')} ({$i18n.t('Character')})</option>
@ -928,8 +930,8 @@
{#if RAGConfig.TEXT_SPLITTER === 'token_transformers'}
<AdminSettingField
label={$i18n.t('Tokenizer Model')}
description={$i18n.t('Tokenizer model used for transformer token splitting.')}
label={$i18n.t('settings.admin.documents.tokenizerModel.label')}
description={$i18n.t('settings.admin.documents.tokenizerModel.description')}
>
<input
class={inputClass}
@ -942,10 +944,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Markdown Header Text Splitter')}
description={$i18n.t(
'Split documents by markdown headers before character or token splitting.'
)}
label={$i18n.t('settings.admin.documents.markdownHeaderTextSplitter.label')}
description={$i18n.t('settings.admin.documents.markdownHeaderTextSplitter.description')}
let:labelId
>
<Switch
@ -956,8 +956,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Chunk Size')}
description={$i18n.t('Maximum size for each text chunk.')}
label={$i18n.t('settings.admin.documents.chunkSize.label')}
description={$i18n.t('settings.admin.documents.chunkSize.description')}
>
<input
class={inputClass}
@ -969,8 +969,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Chunk Overlap')}
description={$i18n.t('Overlap preserved between neighboring chunks.')}
label={$i18n.t('settings.admin.documents.chunkOverlap.label')}
description={$i18n.t('settings.admin.documents.chunkOverlap.description')}
>
<input
class={inputClass}
@ -985,10 +985,8 @@
{#if RAGConfig.ENABLE_MARKDOWN_HEADER_TEXT_SPLITTER}
<AdminSettingField
label={$i18n.t('Chunk Min Size Target')}
description={$i18n.t(
'Merge chunks smaller than this threshold when possible. Set to 0 to disable merging.'
)}
label={$i18n.t('settings.admin.documents.chunkMinSizeTarget.label')}
description={$i18n.t('settings.admin.documents.chunkMinSizeTarget.description')}
>
<input
class={inputClass}
@ -1004,10 +1002,10 @@
</AdminSettingSection>
{#if !RAGConfig.BYPASS_EMBEDDING_AND_RETRIEVAL}
<AdminSettingSection title={$i18n.t('Embedding')}>
<AdminSettingSection title={$i18n.t('settings.admin.documents.sections.embedding.title')}>
<AdminSettingRow
label={$i18n.t('Embedding Model Engine')}
description={$i18n.t('Provider used to generate document embeddings.')}
label={$i18n.t('settings.admin.documents.embeddingModelEngine.label')}
description={$i18n.t('settings.admin.documents.embeddingModelEngine.description')}
>
<SettingsSelect
bind:value={RAG_EMBEDDING_ENGINE}
@ -1036,23 +1034,23 @@
{#if RAG_EMBEDDING_ENGINE === 'openai'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('OpenAI-compatible embeddings endpoint.')}
label={$i18n.t('settings.admin.documents.openaiurl.label')}
description={$i18n.t('settings.admin.documents.openaiurl.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.documents.openaiurl.label')}
bind:value={OpenAIUrl}
required
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key for embedding requests.')}
label={$i18n.t('settings.admin.documents.openaikey.label')}
description={$i18n.t('settings.admin.documents.openaikey.description')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.documents.openaikey.label')}
bind:value={OpenAIKey}
required={false}
/>
@ -1061,23 +1059,23 @@
{:else if RAG_EMBEDDING_ENGINE === 'ollama'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('Ollama endpoint used for embeddings.')}
label={$i18n.t('settings.admin.documents.ollamaurl.label')}
description={$i18n.t('settings.admin.documents.ollamaurl.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.documents.ollamaurl.label')}
bind:value={OllamaUrl}
required
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('Optional API key for Ollama requests.')}
label={$i18n.t('settings.admin.documents.ollamakey.label')}
description={$i18n.t('settings.admin.documents.ollamakey.description')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.documents.ollamakey.label')}
bind:value={OllamaKey}
required={false}
/>
@ -1086,33 +1084,33 @@
{:else if RAG_EMBEDDING_ENGINE === 'azure_openai'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('Azure OpenAI endpoint used for embeddings.')}
label={$i18n.t('settings.admin.documents.azureopenaiurl.label')}
description={$i18n.t('settings.admin.documents.azureopenaiurl.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.documents.azureopenaiurl.label')}
bind:value={AzureOpenAIUrl}
required
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('Azure OpenAI API key.')}
label={$i18n.t('settings.admin.documents.azureopenaikey.label')}
description={$i18n.t('settings.admin.documents.azureopenaikey.description')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.documents.azureopenaikey.label')}
bind:value={AzureOpenAIKey}
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Version')}
description={$i18n.t('Azure OpenAI API version.')}
label={$i18n.t('settings.admin.documents.version.label')}
description={$i18n.t('settings.admin.documents.version.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('Version')}
placeholder={$i18n.t('settings.admin.documents.version.label')}
bind:value={AzureOpenAIVersion}
required
/>
@ -1121,10 +1119,8 @@
{/if}
<AdminSettingField
label={$i18n.t('Embedding Model')}
description={$i18n.t(
'Model used to generate embeddings. Reindex knowledge after changing this.'
)}
label={$i18n.t('settings.admin.documents.embeddingModel.label')}
description={$i18n.t('settings.admin.documents.embeddingModel.description')}
>
<div class="flex w-full gap-2">
<input
@ -1146,7 +1142,7 @@
embeddingModelUpdateHandler();
}}
disabled={updateEmbeddingModelLoading}
aria-label={$i18n.t('Update embedding model')}
aria-label={$i18n.t('settings.admin.documents.updateEmbeddingModel.label')}
>
{#if updateEmbeddingModelLoading}
<Spinner />
@ -1176,8 +1172,8 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Embedding Batch Size')}
description={$i18n.t('Number of items processed per embedding batch.')}
label={$i18n.t('settings.admin.documents.embeddingBatchSize.label')}
description={$i18n.t('settings.admin.documents.embeddingBatchSize.description')}
>
<input
bind:value={RAG_EMBEDDING_BATCH_SIZE}
@ -1191,16 +1187,16 @@
{#if RAG_EMBEDDING_ENGINE === 'ollama' || RAG_EMBEDDING_ENGINE === 'openai' || RAG_EMBEDDING_ENGINE === 'azure_openai'}
<AdminSettingRow
label={$i18n.t('Async Embedding Processing')}
description={$i18n.t('Run embedding tasks concurrently to speed up processing.')}
label={$i18n.t('settings.admin.documents.asyncEmbeddingProcessing.label')}
description={$i18n.t('settings.admin.documents.asyncEmbeddingProcessing.description')}
let:labelId
>
<Switch bind:state={ENABLE_ASYNC_EMBEDDING} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Embedding Concurrent Requests')}
label={$i18n.t('settings.admin.documents.embeddingConcurrentRequests.label')}
description={$i18n.t(
'Maximum concurrent embedding requests. Set to 0 for unlimited.'
'settings.admin.documents.embeddingConcurrentRequests.description'
)}
>
<input
@ -1215,12 +1211,12 @@
</AdminSettingSection>
{/if}
<AdminSettingSection title={$i18n.t('Retrieval')}>
<AdminSettingSection title={$i18n.t('settings.admin.documents.sections.retrieval.title')}>
{#if !RAGConfig.BYPASS_EMBEDDING_AND_RETRIEVAL}
<AdminSettingRow
label={$i18n.t('Full Context Mode')}
label={$i18n.t('settings.admin.documents.fullContextMode.label')}
description={RAGConfig.RAG_FULL_CONTEXT
? $i18n.t('Inject entire documents as context for comprehensive processing.')
? $i18n.t('settings.admin.documents.fullContextMode.description')
: $i18n.t('Use segmented retrieval for focused context.')}
let:labelId
>
@ -1229,8 +1225,8 @@
{#if !RAGConfig.RAG_FULL_CONTEXT}
<AdminSettingRow
label={$i18n.t('Hybrid Search')}
description={$i18n.t('Combine semantic and keyword retrieval.')}
label={$i18n.t('settings.admin.documents.hybridSearch.label')}
description={$i18n.t('settings.admin.documents.hybridSearch.description')}
let:labelId
>
<Switch bind:state={RAGConfig.ENABLE_RAG_HYBRID_SEARCH} ariaLabelledbyId={labelId} />
@ -1238,10 +1234,8 @@
{#if RAGConfig.ENABLE_RAG_HYBRID_SEARCH === true}
<AdminSettingRow
label={$i18n.t('Enrich Hybrid Search Text')}
description={$i18n.t(
'Add filenames, titles, sections, and snippets to improve lexical recall.'
)}
label={$i18n.t('settings.admin.documents.enrichHybridSearchText.label')}
description={$i18n.t('settings.admin.documents.enrichHybridSearchText.description')}
let:labelId
>
<Switch
@ -1251,8 +1245,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Reranking Engine')}
description={$i18n.t('Provider used to rerank hybrid search results.')}
label={$i18n.t('settings.admin.documents.rerankingEngine.label')}
description={$i18n.t('settings.admin.documents.rerankingEngine.description')}
>
<SettingsSelect
bind:value={RAGConfig.RAG_RERANKING_ENGINE}
@ -1275,23 +1269,29 @@
{#if RAGConfig.RAG_RERANKING_ENGINE === 'external'}
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('API Base URL')}
description={$i18n.t('External reranker endpoint.')}
label={$i18n.t('settings.admin.documents.ragExternalRerankerUrl.label')}
description={$i18n.t(
'settings.admin.documents.ragExternalRerankerUrl.description'
)}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.documents.ragExternalRerankerUrl.label')}
bind:value={RAGConfig.RAG_EXTERNAL_RERANKER_URL}
required
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('API key sent to the external reranker.')}
label={$i18n.t('settings.admin.documents.ragExternalRerankerApiKey.label')}
description={$i18n.t(
'settings.admin.documents.ragExternalRerankerApiKey.description'
)}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t(
'settings.admin.documents.ragExternalRerankerApiKey.label'
)}
bind:value={RAGConfig.RAG_EXTERNAL_RERANKER_API_KEY}
required={false}
/>
@ -1300,8 +1300,8 @@
{/if}
<AdminSettingField
label={$i18n.t('Reranking Model')}
description={$i18n.t('Model used to rerank retrieved results.')}
label={$i18n.t('settings.admin.documents.rerankingModel.label')}
description={$i18n.t('settings.admin.documents.rerankingModel.description')}
>
<input
class={inputClass}
@ -1314,8 +1314,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Reranking Batch Size')}
description={$i18n.t('Number of results processed per reranking batch.')}
label={$i18n.t('settings.admin.documents.rerankingBatchSize.label')}
description={$i18n.t('settings.admin.documents.rerankingBatchSize.description')}
>
<input
bind:value={RAGConfig.RAG_RERANKING_BATCH_SIZE}
@ -1328,8 +1328,8 @@
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Top K')}
description={$i18n.t('Maximum number of retrieved chunks returned to the model.')}
label={$i18n.t('settings.admin.documents.topK.label')}
description={$i18n.t('settings.admin.documents.topK.description')}
>
<input
class={inputClass}
@ -1343,8 +1343,8 @@
{#if RAGConfig.ENABLE_RAG_HYBRID_SEARCH === true}
<AdminSettingField
label={$i18n.t('Top K Reranker')}
description={$i18n.t('Maximum number of hybrid results sent to the reranker.')}
label={$i18n.t('settings.admin.documents.topKReranker.label')}
description={$i18n.t('settings.admin.documents.topKReranker.description')}
>
<input
class={inputClass}
@ -1357,10 +1357,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Relevance Threshold')}
description={$i18n.t(
'Only return documents with a score greater than or equal to this value.'
)}
label={$i18n.t('settings.admin.documents.relevanceThreshold.label')}
description={$i18n.t('settings.admin.documents.relevanceThreshold.description')}
>
<input
class={inputClass}
@ -1375,8 +1373,8 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('BM25 Weight')}
description={$i18n.t('Balance semantic and lexical weighting for hybrid search.')}
label={$i18n.t('settings.admin.documents.bm25Weight.label')}
description={$i18n.t('settings.admin.documents.bm25Weight.description')}
>
<button
class={actionButtonClass}
@ -1426,8 +1424,8 @@
{/if}
<AdminSettingField
label={$i18n.t('RAG Template')}
description={$i18n.t('Prompt template used when retrieved context is injected.')}
label={$i18n.t('settings.admin.documents.ragTemplate.label')}
description={$i18n.t('settings.admin.documents.ragTemplate.description')}
>
<Tooltip
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
@ -1453,12 +1451,10 @@
</AdminSettingField>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Files')}>
<AdminSettingSection title={$i18n.t('settings.admin.documents.sections.files.title')}>
<AdminSettingField
label={$i18n.t('Allowed File Extensions')}
description={$i18n.t(
'Comma-separated upload extensions. Leave empty for all file types.'
)}
label={$i18n.t('settings.admin.documents.allowedFileExtensions.label')}
description={$i18n.t('settings.admin.documents.allowedFileExtensions.description')}
>
<input
class={inputClass}
@ -1471,8 +1467,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Max Upload Size')}
description={$i18n.t('Maximum file size in MB. Leave empty for unlimited.')}
label={$i18n.t('settings.admin.documents.maxUploadSize.label')}
description={$i18n.t('settings.admin.documents.maxUploadSize.description')}
>
<input
class={inputClass}
@ -1484,8 +1480,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Max Upload Count')}
description={$i18n.t('Maximum number of files that can be used at once in chat.')}
label={$i18n.t('settings.admin.documents.maxUploadCount.label')}
description={$i18n.t('settings.admin.documents.maxUploadCount.description')}
>
<input
class={inputClass}
@ -1500,10 +1496,8 @@
<div class="grid grid-cols-1 gap-x-3 gap-y-2.5 sm:grid-cols-2">
<AdminSettingField
label={$i18n.t('Image Compression Width')}
description={$i18n.t(
'Width in pixels to compress images to. Leave empty for no compression.'
)}
label={$i18n.t('settings.admin.documents.imageCompressionWidth.label')}
description={$i18n.t('settings.admin.documents.imageCompressionWidth.description')}
>
<input
class={inputClass}
@ -1515,10 +1509,8 @@
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Image Compression Height')}
description={$i18n.t(
'Height in pixels to compress images to. Leave empty for no compression.'
)}
label={$i18n.t('settings.admin.documents.imageCompressionHeight.label')}
description={$i18n.t('settings.admin.documents.imageCompressionHeight.description')}
>
<input
class={inputClass}
@ -1532,10 +1524,10 @@
</div>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Integration')}>
<AdminSettingSection title={$i18n.t('settings.admin.documents.sections.integration.title')}>
<AdminSettingRow
label={$i18n.t('Google Drive')}
description={$i18n.t('Allow Google Drive as a document source.')}
label={$i18n.t('settings.admin.documents.googleDrive.label')}
description={$i18n.t('settings.admin.documents.googleDrive.description')}
let:labelId
>
<Switch
@ -1544,18 +1536,18 @@
/>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('OneDrive')}
description={$i18n.t('Allow OneDrive as a document source.')}
label={$i18n.t('settings.admin.documents.onedrive.label')}
description={$i18n.t('settings.admin.documents.onedrive.description')}
let:labelId
>
<Switch bind:state={RAGConfig.ENABLE_ONEDRIVE_INTEGRATION} ariaLabelledbyId={labelId} />
</AdminSettingRow>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Danger Zone')}>
<AdminSettingSection title={$i18n.t('settings.admin.documents.sections.dangerZone.title')}>
<AdminSettingRow
label={$i18n.t('Reset Upload Directory')}
description={$i18n.t('Delete uploaded files from the upload directory.')}
label={$i18n.t('settings.admin.documents.resetUploadDirectory.label')}
description={$i18n.t('settings.admin.documents.resetUploadDirectory.description')}
>
<button
class={actionButtonClass}
@ -1568,8 +1560,8 @@
</button>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Reset Vector Storage/Knowledge')}
description={$i18n.t('Clear vector storage and knowledge indexing data.')}
label={$i18n.t('settings.admin.documents.resetVectorStorageKnowledge.label')}
description={$i18n.t('settings.admin.documents.resetVectorStorageKnowledge.description')}
>
<button
class={actionButtonClass}
@ -1582,9 +1574,9 @@
</button>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Reindex Knowledge and Memory Vectors')}
label={$i18n.t('settings.admin.documents.reindexKnowledgeAndMemoryVectors.label')}
description={$i18n.t(
'Rebuild vectors for existing knowledge files, knowledge search, and memories.'
'settings.admin.documents.reindexKnowledgeAndMemoryVectors.description'
)}
>
<button
@ -1594,7 +1586,7 @@
showReindexConfirm = true;
}}
>
{$i18n.t('Reindex')}
{$i18n.t('settings.admin.documents.reindex.label')}
</button>
</AdminSettingRow>
</AdminSettingSection>

View file

@ -91,14 +91,16 @@
dispatch('save');
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Evaluations')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.evaluations.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if evaluationConfig !== null}
<AdminSettingSection first>
<AdminSettingRow
label={$i18n.t('Arena Models')}
description={$i18n.t('Message rating should be enabled to use this feature')}
label={$i18n.t('settings.admin.evaluations.arenaModels.label')}
description={$i18n.t('settings.admin.evaluations.arenaModels.description')}
let:labelId
>
<Tooltip content={$i18n.t(`Message rating should be enabled to use this feature`)}>
@ -111,11 +113,13 @@
</AdminSettingSection>
{#if evaluationConfig.ENABLE_EVALUATION_ARENA_MODELS}
<AdminSettingSection title={$i18n.t('Models')}>
<AdminSettingSection title={$i18n.t('settings.admin.evaluations.sections.models.title')}>
<div class="mb-2 flex items-center justify-between">
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Arena Models')}</div>
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.evaluations.arenaModels.label')}
</div>
<Tooltip content={$i18n.t('Add Arena Model')}>
<Tooltip content={$i18n.t('settings.admin.evaluations.addArenaModel.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-900 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-white"
type="button"

View file

@ -565,7 +565,7 @@
<div class="mt-3">
<div class="flex justify-between items-center">
<label for="event-webhook-all-events" class={`text-xs text-gray-500`}
>{$i18n.t('Events')}</label
>{$i18n.t('settings.admin.general.events.events.label')}</label
>
<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300">
<input
@ -690,16 +690,18 @@
/>
<div class="mt-5">
<div class="mb-2 text-xs text-gray-400 dark:text-gray-600">{$i18n.t('Events')}</div>
<div class="mb-2 text-xs text-gray-400 dark:text-gray-600">
{$i18n.t('settings.admin.general.events.events.label')}
</div>
<div class="flex flex-col w-full justify-between gap-2.5">
<div class="flex w-full items-start justify-between gap-4">
<div class="min-w-0">
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Webhooks')}</div>
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.general.events.webhooks.label')}
</div>
<div class="mt-1.5 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t(
'Send product events as JSON to external services. Chat destinations receive readable messages.'
)}
{$i18n.t('settings.admin.general.events.webhooks.description')}
</div>
</div>
<Tooltip content={$i18n.t('Add webhook')}>

View file

@ -797,11 +797,11 @@
<div class="flex w-full flex-col justify-between text-xs">
<div class="mb-2 flex items-center justify-between">
<div class="flex items-center gap-2 leading-none text-gray-600 dark:text-gray-400">
<div>{$i18n.t('External Knowledge Sources')}</div>
<div>{$i18n.t('settings.admin.integrations.externalKnowledge.title')}</div>
<ExperimentalBadge />
</div>
<Tooltip content={$i18n.t('Add Connection')}>
<Tooltip content={$i18n.t('settings.admin.integrations.externalKnowledge.addConnection.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-900 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-white"
on:click={openCreateSource}

View file

@ -124,14 +124,18 @@
updateHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('General')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.general.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if adminConfig !== null}
<AdminSettingSection first>
<div class="flex items-start justify-between gap-4">
<div class="min-w-0 text-xs">
<div class="text-gray-600 dark:text-gray-400">{$i18n.t('Version')}</div>
<div class="text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.general.version.label')}
</div>
<div class="mt-1 flex flex-wrap gap-x-1 text-gray-700 dark:text-gray-200">
<Tooltip content={WEBUI_BUILD_HASH}>v{WEBUI_VERSION}</Tooltip>
@ -163,7 +167,7 @@
showChangelog.set(true);
}}
>
{$i18n.t("See what's new")}
{$i18n.t('settings.admin.general.seeWhatSNew.label')}
</button>
</div>
@ -175,7 +179,7 @@
checkForVersionUpdates();
}}
>
{$i18n.t('Check for updates')}
{$i18n.t('settings.admin.general.checkForUpdates.label')}
</button>
{/if}
</div>
@ -183,12 +187,14 @@
<div class="text-xs">
<div class="flex items-start justify-between gap-4">
<div class="min-w-0">
<div class="text-gray-600 dark:text-gray-400">{$i18n.t('Help')}</div>
<div class="text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.general.help.label')}
</div>
<div class="mt-0.5 text-gray-400 dark:text-gray-600">
<!-- LICENSE covers this Open WebUI wordmark.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
{$i18n.t('Discover how to use Open WebUI and seek support from the community.')}
{$i18n.t('settings.admin.general.help.description')}
</div>
</div>
@ -224,7 +230,9 @@
<!-- LICENSE covers this Open WebUI license attribution.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<div class="text-gray-600 dark:text-gray-400">{$i18n.t('License')}</div>
<div class="text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.general.license.label')}
</div>
{#if $config?.license_metadata}
<a
@ -263,10 +271,10 @@
</div>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Features')}>
<AdminSettingSection title={$i18n.t('settings.admin.general.sections.features.title')}>
<AdminSettingRow
label={$i18n.t('Community Sharing')}
description={$i18n.t('Allow users to share chats with the Open WebUI community.')}
label={$i18n.t('settings.admin.general.communitySharing.label')}
description={$i18n.t('settings.admin.general.communitySharing.description')}
let:labelId
>
<!-- LICENSE covers this Open WebUI Community wordmark.
@ -275,15 +283,15 @@
<Switch bind:state={adminConfig.ENABLE_COMMUNITY_SHARING} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Message Rating')}
description={$i18n.t('Let users rate assistant responses.')}
label={$i18n.t('settings.admin.general.messageRating.label')}
description={$i18n.t('settings.admin.general.messageRating.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_MESSAGE_RATING} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Folders')}
description={$i18n.t('Allow users to organize chats into folders.')}
label={$i18n.t('settings.admin.general.folders.label')}
description={$i18n.t('settings.admin.general.folders.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_FOLDERS} ariaLabelledbyId={labelId} />
@ -291,8 +299,8 @@
{#if adminConfig.ENABLE_FOLDERS}
<AdminSettingField
label={$i18n.t('Folder Max File Count')}
description={$i18n.t('Maximum number of files allowed per folder.')}
label={$i18n.t('settings.admin.general.folderMaxFileCount.label')}
description={$i18n.t('settings.admin.general.folderMaxFileCount.description')}
>
<input
class={inputClass}
@ -305,16 +313,16 @@
{/if}
<AdminSettingRow
label={$i18n.t('Memories')}
description={$i18n.t('Allow users to save memories for more personalized responses.')}
label={$i18n.t('settings.admin.general.memories.label')}
description={$i18n.t('settings.admin.general.memories.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_MEMORIES} ariaLabelledbyId={labelId} />
</AdminSettingRow>
{#if adminConfig.ENABLE_MEMORIES}
<AdminSettingRow
label={$i18n.t('Memory System Context')}
description={$i18n.t('Include saved memories in the system context.')}
label={$i18n.t('settings.admin.general.memorySystemContext.label')}
description={$i18n.t('settings.admin.general.memorySystemContext.description')}
labelClassName="text-gray-500 dark:text-gray-500"
let:labelId
>
@ -325,25 +333,23 @@
</AdminSettingRow>
{/if}
<AdminSettingRow
label={$i18n.t('Notes')}
description={$i18n.t('Allow users to create and manage notes.')}
label={$i18n.t('settings.admin.general.notes.label')}
description={$i18n.t('settings.admin.general.notes.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_NOTES} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Channels')}
description={$i18n.t('Allow users to use channels for shared conversations.')}
label={$i18n.t('settings.admin.general.channels.label')}
description={$i18n.t('settings.admin.general.channels.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_CHANNELS} ariaLabelledbyId={labelId} />
</AdminSettingRow>
{#if adminConfig.ENABLE_CHANNELS}
<AdminSettingRow
label={$i18n.t('Model Response Mode')}
description={$i18n.t(
'Choose where model responses to root-level channel mentions are posted.'
)}
label={$i18n.t('settings.admin.general.modelResponseMode.label')}
description={$i18n.t('settings.admin.general.modelResponseMode.description')}
labelClassName="text-gray-500 dark:text-gray-500"
let:labelId
>
@ -357,37 +363,37 @@
</AdminSettingRow>
{/if}
<AdminSettingRow
label={$i18n.t('Calendar')}
description={$i18n.t('Allow users to access calendar features.')}
label={$i18n.t('settings.admin.general.calendar.label')}
description={$i18n.t('settings.admin.general.calendar.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_CALENDAR} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Automations')}
description={$i18n.t('Allow users to create and run automations.')}
label={$i18n.t('settings.admin.general.automations.label')}
description={$i18n.t('settings.admin.general.automations.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_AUTOMATIONS} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('User Webhooks')}
description={$i18n.t('Allow users to configure webhooks from their account.')}
label={$i18n.t('settings.admin.general.userWebhooks.label')}
description={$i18n.t('settings.admin.general.userWebhooks.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_USER_WEBHOOKS} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('User Status')}
description={$i18n.t('Show user status information in the app.')}
label={$i18n.t('settings.admin.general.userStatus.label')}
description={$i18n.t('settings.admin.general.userStatus.description')}
let:labelId
>
<Switch bind:state={adminConfig.ENABLE_USER_STATUS} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Response Watermark')}
description={$i18n.t('Append a watermark to assistant responses when configured.')}
label={$i18n.t('settings.admin.general.responseWatermark.label')}
description={$i18n.t('settings.admin.general.responseWatermark.description')}
>
<Textarea
className={textareaClass}
@ -397,10 +403,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('WebUI URL')}
description={$i18n.t(
'Enter the public URL of your WebUI. This URL will be used to generate links in the notifications.'
)}
label={$i18n.t('settings.admin.general.webuiUrl.label')}
description={$i18n.t('settings.admin.general.webuiUrl.description')}
>
<input
class={inputClass}
@ -413,7 +417,7 @@
<Events />
<AdminSettingSection title={$i18n.t('UI')}>
<AdminSettingSection title={$i18n.t('settings.admin.general.sections.ui.title')}>
<fieldset id="ui-i18n-settings" disabled={saving} class="min-w-0">
<I18nSettings bind:entries={uiI18nEntries} />
</fieldset>
@ -478,7 +482,9 @@
<div>
<div class="mb-1 flex min-h-7 w-full items-center justify-between gap-2">
<div class="min-w-0 text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Banners')}</div>
<div class="min-w-0 text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.general.banners.label')}
</div>
<div class="flex shrink-0 items-center gap-1">
{#if banners.length > 0}
<LanguageModeSelect bind:value={bannerLocale} className="w-fit" />
@ -486,7 +492,7 @@
<button
class="flex size-6 items-center justify-center text-gray-400 dark:text-gray-600"
type="button"
aria-label={$i18n.t('Add banner')}
aria-label={$i18n.t('settings.admin.general.addBanner.label')}
on:click={() => {
if (banners.length === 0 || banners[banners.length - 1]?.content !== '') {
banners = [

View file

@ -27,17 +27,19 @@
<div class="space-y-1.5">
<div class="flex min-h-7 flex-wrap items-center justify-between gap-x-2 gap-y-1">
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('UI Translations')}</div>
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.general.translations.uiTranslations.label')}
</div>
<div class="ms-auto flex shrink-0 items-center gap-1">
{#if entries.length}<LanguageModeSelect
bind:value={locale}
includeDefault={false}
className="w-fit"
/>{/if}
<Tooltip content={$i18n.t('Add translation')}>
<Tooltip content={$i18n.t('settings.admin.general.translations.addTranslation.label')}>
<button
type="button"
aria-label={$i18n.t('Add translation')}
aria-label={$i18n.t('settings.admin.general.translations.addTranslation.label')}
on:click={add}
class="flex size-6 items-center justify-center text-gray-400 dark:text-gray-600"
>

View file

@ -11,7 +11,7 @@
updateImageGenerationConfig,
getConfig,
updateConfig,
verifyConfigUrl
verifyConnection
} from '$lib/apis/images';
import Spinner from '$lib/components/common/Spinner.svelte';
import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
@ -299,25 +299,27 @@
saveHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Images')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.images.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if config}
<div class="flex flex-col">
<AdminSettingSection first>
<AdminSettingRow
label={$i18n.t('Image Generation')}
description={$i18n.t('Allow users to generate images from prompts.')}
label={$i18n.t('settings.admin.images.imageGeneration.label')}
description={$i18n.t('settings.admin.images.imageGeneration.description')}
let:labelId
>
<Switch bind:state={config.ENABLE_IMAGE_GENERATION} ariaLabelledbyId={labelId} />
</AdminSettingRow>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Create Image')}>
<AdminSettingSection title={$i18n.t('settings.admin.images.sections.createImage.title')}>
<AdminSettingRow
label={$i18n.t('Image Generation Engine')}
description={$i18n.t('Choose the provider used for image generation.')}
label={$i18n.t('settings.admin.images.imageGenerationEngine.label')}
description={$i18n.t('settings.admin.images.imageGenerationEngine.description')}
>
<SettingsSelect
bind:value={config.IMAGE_GENERATION_ENGINE}
@ -332,7 +334,9 @@
{#if config.ENABLE_IMAGE_GENERATION}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('Model')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imageGenerationModel.label')}
>
<input
list="model-list"
class={inputClass}
@ -348,7 +352,7 @@
</datalist>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Image Size')}>
<AdminSettingField label={$i18n.t('settings.admin.images.imageSize.label')}>
<input
class={inputClass}
placeholder={$i18n.t('Enter Image Size (e.g. 512x512)')}
@ -357,7 +361,7 @@
</AdminSettingField>
{#if ['comfyui', 'automatic1111', ''].includes(config?.IMAGE_GENERATION_ENGINE)}
<AdminSettingField label={$i18n.t('Steps')}>
<AdminSettingField label={$i18n.t('settings.admin.images.steps.label')}>
<input
class={inputClass}
placeholder={$i18n.t('Enter Number of Steps (e.g. 50)')}
@ -369,8 +373,8 @@
</div>
<AdminSettingRow
label={$i18n.t('Image Prompt Generation')}
description={$i18n.t('Generate an image prompt before sending the request.')}
label={$i18n.t('settings.admin.images.imagePromptGeneration.label')}
description={$i18n.t('settings.admin.images.imagePromptGeneration.description')}
let:labelId
>
<Switch
@ -382,37 +386,39 @@
{#if config?.IMAGE_GENERATION_ENGINE === 'openai'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('API Base URL')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesOpenaiApiBaseUrl.label')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.images.imagesOpenaiApiBaseUrl.label')}
bind:value={config.IMAGES_OPENAI_API_BASE_URL}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField label={$i18n.t('settings.admin.images.imagesOpenaiApiKey.label')}>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.images.imagesOpenaiApiKey.label')}
bind:value={config.IMAGES_OPENAI_API_KEY}
required={false}
/>
</AdminSettingField>
</div>
<AdminSettingField label={$i18n.t('API Version')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesOpenaiApiVersion.label')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Version')}
placeholder={$i18n.t('settings.admin.images.imagesOpenaiApiVersion.label')}
bind:value={config.IMAGES_OPENAI_API_VERSION}
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Additional Parameters')}
description={$i18n.t(
'Send extra JSON parameters with each image generation request.'
)}
label={$i18n.t('settings.admin.images.imagesOpenaiApiParams.label')}
description={$i18n.t('settings.admin.images.imagesOpenaiApiParams.description')}
>
<Textarea
className={textareaClass}
@ -423,10 +429,8 @@
</AdminSettingField>
{:else if (config?.IMAGE_GENERATION_ENGINE ?? 'automatic1111') === 'automatic1111'}
<AdminSettingField
label={$i18n.t('Base URL')}
description={$i18n.t(
'Connect to a stable-diffusion-webui server running with the `--api` flag.'
)}
label={$i18n.t('settings.admin.images.automatic1111BaseUrl.label')}
description={$i18n.t('settings.admin.images.automatic1111BaseUrl.description')}
>
<div class="flex w-full gap-2">
<input
@ -437,16 +441,21 @@
<button
class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white"
type="button"
aria-label={$i18n.t('verify connection')}
aria-label={$i18n.t('settings.admin.images.verifyConnection.label')}
on:click={async () => {
await updateConfigHandler();
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
const res = await verifyConnection(localStorage.token, {
engine: 'automatic1111',
url: config.AUTOMATIC1111_BASE_URL,
key: config.AUTOMATIC1111_API_AUTH
}).catch((error) => {
toast.error(`${error}`);
return null;
});
if (res) {
toast.success($i18n.t('Server connection verified'));
toast.success(
$i18n.t('settings.admin.images.serverConnectionVerified.label')
);
}
}}
>
@ -467,8 +476,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Auth String')}
description={$i18n.t('Provide the --api-auth username and password when required.')}
label={$i18n.t('settings.admin.images.apiAuthString.label')}
description={$i18n.t('settings.admin.images.apiAuthString.description')}
>
<SensitiveInput
variant="settings"
@ -479,8 +488,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Additional Parameters')}
description={$i18n.t('Send extra JSON parameters with each AUTOMATIC1111 request.')}
label={$i18n.t('settings.admin.images.automatic1111Params.label')}
description={$i18n.t('settings.admin.images.automatic1111Params.description')}
>
<Textarea
className={textareaClass}
@ -491,8 +500,8 @@
</AdminSettingField>
{:else if config?.IMAGE_GENERATION_ENGINE === 'comfyui'}
<AdminSettingField
label={$i18n.t('Base URL')}
description={$i18n.t('Connect to the ComfyUI server used for generation.')}
label={$i18n.t('settings.admin.images.comfyuiBaseUrl.label')}
description={$i18n.t('settings.admin.images.comfyuiBaseUrl.description')}
>
<div class="flex w-full gap-2">
<input
@ -503,16 +512,21 @@
<button
class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white"
type="button"
aria-label={$i18n.t('verify connection')}
aria-label={$i18n.t('settings.admin.images.verifyConnection.label')}
on:click={async () => {
await updateConfigHandler();
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
const res = await verifyConnection(localStorage.token, {
engine: 'comfyui',
url: config.COMFYUI_BASE_URL,
key: config.COMFYUI_API_KEY
}).catch((error) => {
toast.error(`${error}`);
return null;
});
if (res) {
toast.success($i18n.t('Server connection verified'));
toast.success(
$i18n.t('settings.admin.images.serverConnectionVerified.label')
);
}
}}
>
@ -533,8 +547,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('Use an API key when your ComfyUI server requires one.')}
label={$i18n.t('settings.admin.images.comfyuiApiKey.label')}
description={$i18n.t('settings.admin.images.comfyuiApiKey.description')}
>
<SensitiveInput
variant="settings"
@ -563,17 +577,15 @@
}}
/>
<AdminSettingRow
label={$i18n.t('ComfyUI Workflow')}
description={$i18n.t(
'Upload a workflow.json file exported as API format from ComfyUI.'
)}
label={$i18n.t('settings.admin.images.comfyuiComfyuiWorkflow.label')}
description={$i18n.t('settings.admin.images.comfyuiComfyuiWorkflow.description')}
>
<div class="flex items-center justify-end gap-2">
{#if config.COMFYUI_WORKFLOW}
<button
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
type="button"
aria-label={$i18n.t('Edit workflow.json content')}
aria-label={$i18n.t('settings.admin.images.editWorkflowJsonContent.label')}
on:click={() => {
// open code editor modal
showComfyUIWorkflowEditor = true;
@ -583,11 +595,17 @@
</button>
{/if}
<Tooltip content={$i18n.t('Click here to upload a workflow.json file.')}>
<Tooltip
content={$i18n.t(
'settings.admin.images.clickHereToUploadAWorkflowJsonFile.label'
)}
>
<button
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
type="button"
aria-label={$i18n.t('Click here to upload a workflow.json file.')}
aria-label={$i18n.t(
'settings.admin.images.clickHereToUploadAWorkflowJsonFile.label'
)}
on:click={() => {
document.getElementById('upload-comfyui-workflow-input')?.click();
}}
@ -623,8 +641,8 @@
{#if config.COMFYUI_WORKFLOW}
<AdminSettingField
label={$i18n.t('ComfyUI Workflow Nodes')}
description={$i18n.t('Map workflow node inputs used for image generation.')}
label={$i18n.t('settings.admin.images.generationWorkflowNodes.label')}
description={$i18n.t('settings.admin.images.generationWorkflowNodes.description')}
>
<div class="flex flex-col gap-1.5 text-xs">
{#each REQUIRED_WORKFLOW_NODES as node}
@ -673,31 +691,31 @@
{/if}
{:else if config?.IMAGE_GENERATION_ENGINE === 'gemini'}
<AdminSettingField
label={$i18n.t('Base URL')}
description={$i18n.t('Override the Gemini image generation endpoint.')}
label={$i18n.t('settings.admin.images.imagesGeminiApiBaseUrl.label')}
description={$i18n.t('settings.admin.images.imagesGeminiApiBaseUrl.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.images.imagesOpenaiApiBaseUrl.label')}
bind:value={config.IMAGES_GEMINI_API_BASE_URL}
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('Use a Gemini API key for image generation.')}
label={$i18n.t('settings.admin.images.imagesGeminiApiKey.label')}
description={$i18n.t('settings.admin.images.imagesGeminiApiKey.description')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.images.imagesGeminiApiKey.label')}
bind:value={config.IMAGES_GEMINI_API_KEY}
required={true}
/>
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Gemini Endpoint Method')}
description={$i18n.t('Select the Gemini endpoint method to call.')}
label={$i18n.t('settings.admin.images.geminiEndpointMethod.label')}
description={$i18n.t('settings.admin.images.geminiEndpointMethod.description')}
>
<SettingsSelect
bind:value={config.IMAGES_GEMINI_ENDPOINT_METHOD}
@ -710,18 +728,18 @@
{/if}
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Edit Image')}>
<AdminSettingSection title={$i18n.t('settings.admin.images.sections.editImage.title')}>
<AdminSettingRow
label={$i18n.t('Image Edit')}
description={$i18n.t('Allow users to edit existing images.')}
label={$i18n.t('settings.admin.images.imageEdit.label')}
description={$i18n.t('settings.admin.images.imageEdit.description')}
let:labelId
>
<Switch bind:state={config.ENABLE_IMAGE_EDIT} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Image Edit Engine')}
description={$i18n.t('Choose the provider used for image edits.')}
label={$i18n.t('settings.admin.images.imageEditEngine.label')}
description={$i18n.t('settings.admin.images.imageEditEngine.description')}
>
<SettingsSelect
bind:value={config.IMAGE_EDIT_ENGINE}
@ -735,7 +753,7 @@
{#if config?.ENABLE_IMAGE_GENERATION && config?.ENABLE_IMAGE_EDIT}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('Model')}>
<AdminSettingField label={$i18n.t('settings.admin.images.imageEditModel.label')}>
<input
list="model-list"
class={inputClass}
@ -750,7 +768,7 @@
</datalist>
</AdminSettingField>
<AdminSettingField label={$i18n.t('Image Size')}>
<AdminSettingField label={$i18n.t('settings.admin.images.imageEditSize.label')}>
<input
class={inputClass}
placeholder={$i18n.t('Enter Image Size (e.g. 512x512)')}
@ -762,35 +780,41 @@
{#if config?.IMAGE_EDIT_ENGINE === 'openai'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('API Base URL')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesEditOpenaiApiBaseUrl.label')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.images.imagesEditOpenaiApiBaseUrl.label')}
bind:value={config.IMAGES_EDIT_OPENAI_API_BASE_URL}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesEditOpenaiApiKey.label')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.images.imagesEditOpenaiApiKey.label')}
bind:value={config.IMAGES_EDIT_OPENAI_API_KEY}
required={false}
/>
</AdminSettingField>
</div>
<AdminSettingField label={$i18n.t('API Version')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesEditOpenaiApiVersion.label')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Version')}
placeholder={$i18n.t('settings.admin.images.imagesEditOpenaiApiVersion.label')}
bind:value={config.IMAGES_EDIT_OPENAI_API_VERSION}
/>
</AdminSettingField>
{:else if config?.IMAGE_EDIT_ENGINE === 'comfyui'}
<AdminSettingField
label={$i18n.t('Base URL')}
description={$i18n.t('Connect to the ComfyUI server used for image edits.')}
label={$i18n.t('settings.admin.images.imagesEditComfyuiBaseUrl.label')}
description={$i18n.t('settings.admin.images.imagesEditComfyuiBaseUrl.description')}
>
<div class="flex w-full gap-2">
<input
@ -801,16 +825,21 @@
<button
class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white"
type="button"
aria-label={$i18n.t('verify connection')}
aria-label={$i18n.t('settings.admin.images.verifyConnection.label')}
on:click={async () => {
await updateConfigHandler();
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
const res = await verifyConnection(localStorage.token, {
engine: 'comfyui',
url: config.IMAGES_EDIT_COMFYUI_BASE_URL,
key: config.IMAGES_EDIT_COMFYUI_API_KEY
}).catch((error) => {
toast.error(`${error}`);
return null;
});
if (res) {
toast.success($i18n.t('Server connection verified'));
toast.success(
$i18n.t('settings.admin.images.serverConnectionVerified.label')
);
}
}}
>
@ -831,8 +860,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('API Key')}
description={$i18n.t('Use an API key when your ComfyUI server requires one.')}
label={$i18n.t('settings.admin.images.imagesEditComfyuiApiKey.label')}
description={$i18n.t('settings.admin.images.imagesEditComfyuiApiKey.description')}
>
<SensitiveInput
variant="settings"
@ -861,17 +890,15 @@
}}
/>
<AdminSettingRow
label={$i18n.t('ComfyUI Workflow')}
description={$i18n.t(
'Upload a workflow.json file exported as API format from ComfyUI.'
)}
label={$i18n.t('settings.admin.images.comfyuiComfyuiWorkflow.label')}
description={$i18n.t('settings.admin.images.comfyuiComfyuiWorkflow.description')}
>
<div class="flex items-center justify-end gap-2">
{#if config.IMAGES_EDIT_COMFYUI_WORKFLOW}
<button
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
type="button"
aria-label={$i18n.t('Edit workflow.json content')}
aria-label={$i18n.t('settings.admin.images.editWorkflowJsonContent.label')}
on:click={() => {
// open code editor modal
showComfyUIEditWorkflowEditor = true;
@ -881,11 +908,17 @@
</button>
{/if}
<Tooltip content={$i18n.t('Click here to upload a workflow.json file.')}>
<Tooltip
content={$i18n.t(
'settings.admin.images.clickHereToUploadAWorkflowJsonFile.label'
)}
>
<button
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
type="button"
aria-label={$i18n.t('Click here to upload a workflow.json file.')}
aria-label={$i18n.t(
'settings.admin.images.clickHereToUploadAWorkflowJsonFile.label'
)}
on:click={() => {
document.getElementById('upload-comfyui-edit-workflow-input')?.click();
}}
@ -911,8 +944,8 @@
{#if config.IMAGES_EDIT_COMFYUI_WORKFLOW}
<AdminSettingField
label={$i18n.t('ComfyUI Workflow Nodes')}
description={$i18n.t('Map workflow node inputs used for image edits.')}
label={$i18n.t('settings.admin.images.editingWorkflowNodes.label')}
description={$i18n.t('settings.admin.images.editingWorkflowNodes.description')}
>
<div class="flex flex-col gap-1.5 text-xs">
{#each REQUIRED_EDIT_WORKFLOW_NODES as node}
@ -961,18 +994,22 @@
{/if}
{:else if config?.IMAGE_EDIT_ENGINE === 'gemini'}
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('Base URL')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesEditGeminiApiBaseUrl.label')}
>
<input
class={inputClass}
placeholder={$i18n.t('API Base URL')}
placeholder={$i18n.t('settings.admin.images.imagesOpenaiApiBaseUrl.label')}
bind:value={config.IMAGES_EDIT_GEMINI_API_BASE_URL}
/>
</AdminSettingField>
<AdminSettingField label={$i18n.t('API Key')}>
<AdminSettingField
label={$i18n.t('settings.admin.images.imagesEditGeminiApiKey.label')}
>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('API Key')}
placeholder={$i18n.t('settings.admin.images.imagesEditGeminiApiKey.label')}
bind:value={config.IMAGES_EDIT_GEMINI_API_KEY}
required={true}
/>

View file

@ -2,14 +2,14 @@
import { toast } from 'svelte-sonner';
import { createEventDispatcher, onMount, getContext, tick } from 'svelte';
import { v4 as uuidv4 } from 'uuid';
import { getModels as _getModels } from '$lib/apis';
import { getBackendConfig, getModels as _getModels } from '$lib/apis';
import type { Writable } from 'svelte/store';
import type { i18n as i18nType } from 'i18next';
const dispatch = createEventDispatcher();
const i18n = getContext<Writable<i18nType>>('i18n');
import { models, settings, user, terminalServers } from '$lib/stores';
import { config, models, settings, user, terminalServers } from '$lib/stores';
import { getTerminalServers } from '$lib/apis/terminal';
import { WEBUI_API_BASE_URL } from '$lib/constants';
@ -26,8 +26,11 @@
import AddTerminalServerModal from '$lib/components/AddTerminalServerModal.svelte';
import ExternalKnowledge from './ExternalKnowledge.svelte';
import AdminSettingSection from './AdminSettingSection.svelte';
import AdminSettingRow from './AdminSettingRow.svelte';
import {
getConnectionsConfig,
setConnectionsConfig,
getToolServerConnections,
setToolServerConnections,
getTerminalServerConnections,
@ -47,6 +50,7 @@
};
let servers: ToolServerConnection[] | null = null;
let connectionsConfig: any = null;
let showConnectionModal = false;
// Terminal server admin connections
@ -54,6 +58,17 @@
let showAddTerminalModal = false;
let editTerminalIdx: number | null = null;
const updateDirectIntegrations = async () => {
const res = await setConnectionsConfig(localStorage.token, connectionsConfig).catch((error) => {
toast.error(`${error}`);
});
if (res) {
toast.success($i18n.t('Connections settings updated'));
await config.set(await getBackendConfig());
}
};
const addConnectionHandler = async (server: ToolServerConnection) => {
servers = [...(servers ?? []), server];
await updateHandler();
@ -122,6 +137,7 @@
};
onMount(async () => {
connectionsConfig = await getConnectionsConfig(localStorage.token);
const res = await getToolServerConnections(localStorage.token);
servers = res.TOOL_SERVER_CONNECTIONS as ToolServerConnection[];
@ -164,18 +180,23 @@
updateHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Integrations')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.integrations.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if servers !== null}
<AdminSettingSection title={$i18n.t('Tools')} first>
{#if servers !== null && connectionsConfig !== null}
<AdminSettingSection
title={$i18n.t('settings.admin.integrations.sections.tools.title')}
first
>
<div>
<div class="mb-2 flex items-center justify-between">
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('External Tool Servers')}
{$i18n.t('settings.admin.integrations.externalToolServers.label')}
</div>
<Tooltip content={$i18n.t(`Add Connection`)}>
<Tooltip content={$i18n.t('settings.admin.integrations.addConnection.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-900 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-white"
on:click={() => {
@ -215,12 +236,14 @@
</div>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Terminal')}>
<AdminSettingSection title={$i18n.t('settings.admin.integrations.sections.terminal.title')}>
<div>
<div class="mb-2 flex items-center justify-between">
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Open Terminal')}</div>
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.integrations.openTerminal.label')}
</div>
<Tooltip content={$i18n.t('Add Connection')}>
<Tooltip content={$i18n.t('settings.admin.integrations.addConnection.label')}>
<button
class="flex size-6 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-900 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-white"
on:click={() => {
@ -245,7 +268,9 @@
? 'opacity-50'
: ''}"
>
<Tooltip content={$i18n.t('Terminal')}>
<Tooltip
content={$i18n.t('settings.admin.integrations.sections.terminal.title')}
>
<Cloud className="size-4" strokeWidth="1.5" />
</Tooltip>
@ -311,9 +336,25 @@
</div>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Knowledge')}>
<AdminSettingSection title={$i18n.t('settings.admin.integrations.sections.knowledge.title')}>
<ExternalKnowledge />
</AdminSettingSection>
<AdminSettingSection
title={$i18n.t('settings.admin.connections.sections.userConnections.title')}
>
<AdminSettingRow
label={$i18n.t('settings.admin.connections.directIntegrations.label')}
description={$i18n.t('settings.admin.connections.directIntegrations.description')}
let:labelId
>
<Switch
bind:state={connectionsConfig.ENABLE_DIRECT_INTEGRATIONS}
on:change={updateDirectIntegrations}
ariaLabelledbyId={labelId}
/>
</AdminSettingRow>
</AdminSettingSection>
{:else}
<div class="flex h-full justify-center">
<div class="my-auto">

View file

@ -169,23 +169,23 @@
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('Interface')}
{$i18n.t('settings.admin.interface.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<AdminSettingSection title={$i18n.t('Tasks')} first>
<AdminSettingSection title={$i18n.t('settings.admin.interface.sections.tasks.title')} first>
<div>
<div class="mb-2">
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Task Model')}</div>
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.admin.interface.taskModel.label')}
</div>
<div class="mt-1.5 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t(
'Choose fallback models for background tasks. Current Model follows the active chat model.'
)}
{$i18n.t('settings.admin.interface.taskModel.description')}
</div>
</div>
<div class="grid w-full grid-cols-1 gap-2.5 sm:grid-cols-2">
<AdminSettingField label={$i18n.t('Local Task Model')}>
<AdminSettingField label={$i18n.t('settings.admin.interface.localTaskModel.label')}>
<SettingsSelect
bind:value={taskConfig.TASK_MODEL}
className="w-full"
@ -204,7 +204,7 @@
</SettingsSelect>
</AdminSettingField>
<AdminSettingField label={$i18n.t('External Task Model')}>
<AdminSettingField label={$i18n.t('settings.admin.interface.externalTaskModel.label')}>
<SettingsSelect
bind:value={taskConfig.TASK_MODEL_EXTERNAL}
className="w-full"
@ -235,7 +235,7 @@
}}
>
<span class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Task Model Parameters')}
{$i18n.t('settings.admin.interface.taskModelParameters.label')}
</span>
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600">
{showTaskParameters ? $i18n.t('Close') : $i18n.t('Configure')}
@ -255,24 +255,22 @@
</div>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Chat')}>
<AdminSettingSection title={$i18n.t('settings.admin.interface.sections.chat.title')}>
<AdminSettingRow
label={$i18n.t('Tool Permissions')}
description={$i18n.t('Show Full access and Ask for approval in the chat input menu.')}
label={$i18n.t('settings.admin.interface.toolPermissions.label')}
description={$i18n.t('settings.admin.interface.toolPermissions.description')}
let:labelId
>
<div slot="label" class="flex items-center gap-2">
<span>{$i18n.t('Tool Permissions')}</span>
<span>{$i18n.t('settings.admin.interface.toolPermissions.label')}</span>
<ExperimentalBadge />
</div>
<Switch bind:state={chatConfig.ENABLE_TOOL_PERMISSIONS} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Context Compaction')}
description={$i18n.t(
'Summarize older chat history when the conversation context grows large.'
)}
label={$i18n.t('settings.admin.interface.contextCompaction.label')}
description={$i18n.t('settings.admin.interface.contextCompaction.description')}
let:labelId
>
<Switch bind:state={chatConfig.ENABLE_CONTEXT_COMPACTION} ariaLabelledbyId={labelId} />
@ -280,10 +278,8 @@
{#if chatConfig.ENABLE_CONTEXT_COMPACTION}
<AdminSettingField
label={$i18n.t('Context Compaction Model')}
description={$i18n.t(
'Choose a dedicated model for context compaction summaries. Current Model follows the active chat model.'
)}
label={$i18n.t('settings.admin.interface.contextCompactionModel.label')}
description={$i18n.t('settings.admin.interface.contextCompactionModel.description')}
>
<SettingsSelect
bind:value={chatConfig.CONTEXT_COMPACTION_MODEL}
@ -306,10 +302,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Token Threshold')}
description={$i18n.t(
'Older messages are summarized when estimated context exceeds this token limit.'
)}
label={$i18n.t('settings.admin.interface.tokenThreshold.label')}
description={$i18n.t('settings.admin.interface.tokenThreshold.description')}
>
<input
type="number"
@ -321,10 +315,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Token Cap')}
description={$i18n.t(
'Model-specific context compaction thresholds cannot exceed this token limit.'
)}
label={$i18n.t('settings.admin.interface.tokenCap.label')}
description={$i18n.t('settings.admin.interface.tokenCap.description')}
>
<input
type="number"
@ -336,10 +328,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Retained Messages')}
description={$i18n.t(
'Percentage of recent messages to keep after older messages are summarized.'
)}
label={$i18n.t('settings.admin.interface.retainedMessages.label')}
description={$i18n.t('settings.admin.interface.retainedMessages.description')}
>
<input
type="number"
@ -352,10 +342,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Context Compaction Prompt')}
description={$i18n.t(
'Controls how older messages are rewritten into a running summary.'
)}
label={$i18n.t('settings.admin.interface.contextCompactionPrompt.label')}
description={$i18n.t('settings.admin.interface.contextCompactionPrompt.description')}
>
<Textarea
className={textareaClass}
@ -365,7 +353,7 @@
)}
/>
<div class="mt-1 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t('Available variables')}:
{$i18n.t('settings.admin.interface.availableVariables.label')}:
<code>{'{{PREVIOUS_SUMMARY}}'}</code>,
<code>{'{{COMPACTED_MESSAGES}}'}</code>,
<code>{'{{RECENT_MESSAGES}}'}</code>,
@ -376,10 +364,10 @@
{/if}
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Generation')}>
<AdminSettingSection title={$i18n.t('settings.admin.interface.sections.generation.title')}>
<AdminSettingRow
label={$i18n.t('Title Generation')}
description={$i18n.t('Allow automatic names for new chats.')}
label={$i18n.t('settings.admin.interface.titleGeneration.label')}
description={$i18n.t('settings.admin.interface.titleGeneration.description')}
let:labelId
>
<Switch bind:state={taskConfig.ENABLE_TITLE_GENERATION} ariaLabelledbyId={labelId} />
@ -387,8 +375,8 @@
{#if taskConfig.ENABLE_TITLE_GENERATION}
<AdminSettingField
label={$i18n.t('Title Generation Prompt')}
description={$i18n.t('Shapes the short label generated for each chat.')}
label={$i18n.t('settings.admin.interface.titleGenerationPrompt.label')}
description={$i18n.t('settings.admin.interface.titleGenerationPrompt.description')}
>
<Textarea
className={textareaClass}
@ -401,8 +389,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Voice Mode Prompt')}
description={$i18n.t('Apply voice-specific instructions while voice mode is active.')}
label={$i18n.t('settings.admin.interface.voiceModePrompt.label')}
description={$i18n.t('settings.admin.interface.voiceModePrompt.description')}
let:labelId
>
<Switch bind:state={taskConfig.ENABLE_VOICE_MODE_PROMPT} ariaLabelledbyId={labelId} />
@ -410,8 +398,8 @@
{#if taskConfig.ENABLE_VOICE_MODE_PROMPT}
<AdminSettingField
label={$i18n.t('Prompt Template')}
description={$i18n.t('Defines the behavior used for spoken conversations.')}
label={$i18n.t('settings.admin.interface.promptTemplate.label')}
description={$i18n.t('settings.admin.interface.promptTemplate.description')}
>
<Textarea
className={textareaClass}
@ -424,8 +412,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Follow Up Generation')}
description={$i18n.t('Show suggested next questions after assistant responses.')}
label={$i18n.t('settings.admin.interface.followUpGeneration.label')}
description={$i18n.t('settings.admin.interface.followUpGeneration.description')}
let:labelId
>
<Switch bind:state={taskConfig.ENABLE_FOLLOW_UP_GENERATION} ariaLabelledbyId={labelId} />
@ -433,8 +421,8 @@
{#if taskConfig.ENABLE_FOLLOW_UP_GENERATION}
<AdminSettingField
label={$i18n.t('Follow Up Generation Prompt')}
description={$i18n.t('Guides the suggestions shown after an assistant response.')}
label={$i18n.t('settings.admin.interface.followUpGenerationPrompt.label')}
description={$i18n.t('settings.admin.interface.followUpGenerationPrompt.description')}
>
<Textarea
className={textareaClass}
@ -447,8 +435,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Tags Generation')}
description={$i18n.t('Create chat tags from conversation content.')}
label={$i18n.t('settings.admin.interface.tagsGeneration.label')}
description={$i18n.t('settings.admin.interface.tagsGeneration.description')}
let:labelId
>
<Switch bind:state={taskConfig.ENABLE_TAGS_GENERATION} ariaLabelledbyId={labelId} />
@ -456,8 +444,8 @@
{#if taskConfig.ENABLE_TAGS_GENERATION}
<AdminSettingField
label={$i18n.t('Tags Generation Prompt')}
description={$i18n.t('Controls how chat tags are inferred.')}
label={$i18n.t('settings.admin.interface.tagsGenerationPrompt.label')}
description={$i18n.t('settings.admin.interface.tagsGenerationPrompt.description')}
>
<Textarea
className={textareaClass}
@ -470,8 +458,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Retrieval Query Generation')}
description={$i18n.t('Rewrite user requests for knowledge retrieval.')}
label={$i18n.t('settings.admin.interface.retrievalQueryGeneration.label')}
description={$i18n.t('settings.admin.interface.retrievalQueryGeneration.description')}
let:labelId
>
<Switch
@ -481,8 +469,8 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Web Search Query Generation')}
description={$i18n.t('Rewrite user requests into web-search queries.')}
label={$i18n.t('settings.admin.interface.webSearchQueryGeneration.label')}
description={$i18n.t('settings.admin.interface.webSearchQueryGeneration.description')}
let:labelId
>
<Switch
@ -492,8 +480,8 @@
</AdminSettingRow>
<AdminSettingField
label={$i18n.t('Query Generation Prompt')}
description={$i18n.t('Shared prompt for retrieval and web-search query rewriting.')}
label={$i18n.t('settings.admin.interface.queryGenerationPrompt.label')}
description={$i18n.t('settings.admin.interface.queryGenerationPrompt.description')}
>
<Textarea
className={textareaClass}
@ -503,8 +491,8 @@
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Autocomplete Generation')}
description={$i18n.t('Suggest completions while users type chat messages.')}
label={$i18n.t('settings.admin.interface.autocompleteGeneration.label')}
description={$i18n.t('settings.admin.interface.autocompleteGeneration.description')}
let:labelId
>
<Switch
@ -515,8 +503,10 @@
{#if taskConfig.ENABLE_AUTOCOMPLETE_GENERATION}
<AdminSettingField
label={$i18n.t('Autocomplete Generation Input Max Length')}
description={$i18n.t('Limit how much draft text is sent for suggestion generation.')}
label={$i18n.t('settings.admin.interface.autocompleteGenerationInputMaxLength.label')}
description={$i18n.t(
'settings.admin.interface.autocompleteGenerationInputMaxLength.description'
)}
>
<input
type="number"
@ -529,8 +519,10 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Autocomplete Generation Prompt')}
description={$i18n.t('Guides inline completions while users type a message.')}
label={$i18n.t('settings.admin.interface.autocompleteGenerationPrompt.label')}
description={$i18n.t(
'settings.admin.interface.autocompleteGenerationPrompt.description'
)}
>
<Textarea
className={textareaClass}
@ -543,8 +535,8 @@
{/if}
<AdminSettingField
label={$i18n.t('Image Prompt Generation Prompt')}
description={$i18n.t('Rewrites user intent into an image-generation prompt.')}
label={$i18n.t('settings.admin.interface.imagePromptGenerationPrompt.label')}
description={$i18n.t('settings.admin.interface.imagePromptGenerationPrompt.description')}
>
<Textarea
className={textareaClass}
@ -554,8 +546,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Tools Function Calling Prompt')}
description={$i18n.t('Guides how the assistant formats tool and function calls.')}
label={$i18n.t('settings.admin.interface.toolsFunctionCallingPrompt.label')}
description={$i18n.t('settings.admin.interface.toolsFunctionCallingPrompt.description')}
>
<Textarea
className={textareaClass}

View file

@ -638,7 +638,7 @@
model = await getFullModel(model);
sessionStorage.model = JSON.stringify({
...model,
base_model_id: model.id,
...(isPresetModel(model) ? {} : { base_model_id: model.id }),
id: `${model.id}-clone`,
name: `${model.name} (Clone)`
});
@ -666,7 +666,7 @@
? $pinnedModels.filter((id) => id !== modelId)
: [...$pinnedModels, modelId]
});
await updateUserSettings(localStorage.token, { ui: $settings });
await updateUserSettings(localStorage.token, { ui: { pinnedModels: $settings.pinnedModels } });
};
onMount(async () => {
@ -726,7 +726,7 @@
<div class="flex h-full min-h-0 flex-col text-sm">
<div class="mb-2 flex items-center justify-between">
<h2 class="text-sm font-medium text-gray-900 dark:text-white">
{$i18n.t('Models')}
{$i18n.t('settings.admin.models.title')}
<span class="ml-2 font-normal text-gray-500 dark:text-gray-500">
{filteredModels.length}
</span>
@ -855,7 +855,9 @@
}}
>
<DocumentArrowUp className="size-3.5" />
<div class="flex items-center">{$i18n.t('Import')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.importModels.label')}
</div>
</button>
<button
@ -866,7 +868,9 @@
}}
>
<Download className="size-3.5" />
<div class="flex items-center">{$i18n.t('Export')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.exportModels.label')}
</div>
</button>
{/if}
@ -878,7 +882,9 @@
}}
>
<Wrench className="size-3.5" />
<div class="flex items-center">{$i18n.t('Manage')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.manageModels.label')}
</div>
</button>
<button
@ -889,7 +895,9 @@
}}
>
<GarbageBin className="size-3.5" />
<div class="flex items-center">{$i18n.t('Reset')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.resetModels.label')}
</div>
</button>
<hr class="mx-1 my-0.5 border-gray-100 dark:border-gray-800" />
@ -902,7 +910,9 @@
}}
>
<CheckCircle className="size-3.5" />
<div class="flex items-center">{$i18n.t('Enable All')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.enableAllModels.label')}
</div>
</button>
<button
@ -913,7 +923,9 @@
}}
>
<Minus className="size-3.5" />
<div class="flex items-center">{$i18n.t('Disable All')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.disableAllModels.label')}
</div>
</button>
<hr class="mx-1 my-0.5 border-gray-100 dark:border-gray-800" />
@ -926,7 +938,9 @@
}}
>
<Eye className="size-3.5" />
<div class="flex items-center">{$i18n.t('Show All')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.showAllModels.label')}
</div>
</button>
<button
@ -937,7 +951,9 @@
}}
>
<EyeSlash className="size-3.5" />
<div class="flex items-center">{$i18n.t('Hide All')}</div>
<div class="flex items-center">
{$i18n.t('settings.admin.models.hideAllModels.label')}
</div>
</button>
</DropdownMenu>
</div>

View file

@ -21,7 +21,6 @@
export let dirty = false;
let config = null;
let modelIds = [];
let loading = false;
let expanded = false;
let showCapabilities = false;
@ -69,8 +68,6 @@
loading = true;
config = await getModelsConfig(localStorage.token);
modelIds = config?.MODEL_ORDER_LIST || [];
const savedMeta = config?.DEFAULT_MODEL_METADATA;
if (savedMeta && Object.keys(savedMeta).length > 0) {
defaultCapabilities = savedMeta.capabilities ?? { ...DEFAULT_CAPABILITIES };
@ -102,10 +99,12 @@
...(Object.keys(builtinTools).length > 0 ? { builtinTools } : {})
};
config = await getModelsConfig(localStorage.token);
const res = await setModelsConfig(localStorage.token, {
DEFAULT_MODELS: config?.DEFAULT_MODELS ?? null,
DEFAULT_PINNED_MODELS: config?.DEFAULT_PINNED_MODELS ?? null,
MODEL_ORDER_LIST: modelIds,
MODEL_ORDER_LIST: config?.MODEL_ORDER_LIST ?? [],
DEFAULT_MODEL_METADATA: metadata,
DEFAULT_MODEL_PARAMS: Object.fromEntries(configuredParams)
}).catch((error) => {
@ -150,7 +149,7 @@
expanded = !expanded;
}}
>
{$i18n.t('Model Defaults')}
{$i18n.t('settings.admin.models.defaults.modelDefaults.label')}
</button>
<button
@ -178,7 +177,7 @@
}}
>
<span class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Model Capabilities')}
{$i18n.t('settings.admin.models.defaults.modelCapabilities.label')}
</span>
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600">
{showCapabilities ? $i18n.t('Close') : $i18n.t('Configure')}
@ -217,7 +216,7 @@
}}
>
<span class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Model Parameters')}
{$i18n.t('settings.admin.models.defaults.modelParameters.label')}
</span>
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600">
{showParameters ? $i18n.t('Close') : $i18n.t('Configure')}
@ -245,7 +244,7 @@
}}
>
<span class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Prompt Suggestions')}
{$i18n.t('settings.admin.models.defaults.promptSuggestions.label')}
</span>
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600">
{showPromptSuggestions ? $i18n.t('Close') : $i18n.t('Configure')}

View file

@ -197,7 +197,7 @@
<div class="flex items-center">{$i18n.t('Copy Link')}</div>
</button>
{#if model?.is_active ?? true}
{#if (model?.is_active ?? true) && model?.owned_by !== 'arena'}
<button
class="select-none flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-gray-50/40 dark:hover:bg-gray-800/40 rounded-xl"
on:click={() => runAndClose(cloneHandler)}

View file

@ -254,7 +254,9 @@
updateHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Pipelines')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.pipelines.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if PIPELINES_LIST !== null}
@ -267,10 +269,13 @@
hidden
/>
<AdminSettingSection title={$i18n.t('Source')} first>
<AdminSettingSection
title={$i18n.t('settings.admin.pipelines.sections.source.title')}
first
>
<AdminSettingField
label={$i18n.t('Pipeline URL')}
description={$i18n.t('Select the Pipelines server to manage.')}
label={$i18n.t('settings.admin.pipelines.pipelineUrl.label')}
description={$i18n.t('settings.admin.pipelines.pipelineUrl.description')}
>
<SettingsSelect
bind:value={selectedPipelinesUrlIdx}
@ -294,8 +299,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Upload Pipeline')}
description={$i18n.t('Upload a local Python pipeline file to the selected server.')}
label={$i18n.t('settings.admin.pipelines.uploadPipeline.label')}
description={$i18n.t('settings.admin.pipelines.uploadPipeline.description')}
>
<div class="flex gap-2">
<button
@ -308,7 +313,7 @@
{#if pipelineFiles}
{$i18n.t('{{COUNT}} pipeline(s) selected', { COUNT: pipelineFiles.length })}
{:else}
{$i18n.t('Select a .py file')}
{$i18n.t('settings.admin.pipelines.selectAPyFile.label')}
{/if}
</button>
@ -326,7 +331,7 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('GitHub URL')}
label={$i18n.t('settings.admin.pipelines.githubUrl.label')}
description={`${$i18n.t('Pipelines are a plugin system with arbitrary code execution.')} ${$i18n.t("Don't fetch random pipelines from sources you don't trust.")}`}
>
<div class="flex gap-2">
@ -343,7 +348,9 @@
disabled={downloading}
type="button"
>
{downloading ? $i18n.t('Installing') : $i18n.t('Install')}
{downloading
? $i18n.t('settings.admin.pipelines.installing.label')
: $i18n.t('settings.admin.pipelines.install.label')}
</button>
</div>
</AdminSettingField>
@ -351,10 +358,12 @@
{#if pipelines !== null}
{#if pipelines.length > 0}
<AdminSettingSection title={$i18n.t('Pipelines')}>
<AdminSettingSection
title={$i18n.t('settings.admin.pipelines.sections.pipelines.title')}
>
<AdminSettingField
label={$i18n.t('Pipeline')}
description={$i18n.t('Select an installed pipeline to configure or remove.')}
label={$i18n.t('settings.admin.pipelines.pipeline.label')}
description={$i18n.t('settings.admin.pipelines.pipeline.description')}
>
<div class="flex gap-2">
<SettingsSelect
@ -386,7 +395,7 @@
</AdminSettingField>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Valves')}>
<AdminSettingSection title={$i18n.t('settings.admin.pipelines.sections.valves.title')}>
{#if pipelines[selectedPipelineIdx ?? 0]?.valves}
{#if valves && valves_spec}
{#each Object.keys(valves_spec.properties) as property}
@ -450,7 +459,9 @@
{/if}
</AdminSettingSection>
{:else}
<AdminSettingSection title={$i18n.t('Pipelines')}>
<AdminSettingSection
title={$i18n.t('settings.admin.pipelines.sections.pipelines.title')}
>
<div class={mutedMessageClass}>{$i18n.t('Pipelines Not Detected')}</div>
</AdminSettingSection>
{/if}
@ -460,7 +471,10 @@
</div>
{/if}
{:else}
<AdminSettingSection title={$i18n.t('Source')} first>
<AdminSettingSection
title={$i18n.t('settings.admin.pipelines.sections.source.title')}
first
>
<div class={mutedMessageClass}>{$i18n.t('Pipelines Not Detected')}</div>
</AdminSettingSection>
{/if}

View file

@ -57,7 +57,9 @@
</script>
<form class="flex h-full flex-col justify-between text-sm" on:submit|preventDefault={save}>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Sub-agents')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.subagents.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if loading}
@ -66,7 +68,7 @@
<div class="flex flex-col gap-2.5">
<label class="flex cursor-pointer items-center justify-between">
<span class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Enable sub-agents')}
{$i18n.t('settings.admin.subagents.enableSubAgents.label')}
</span>
<Switch bind:state={enabled} />
</label>
@ -79,7 +81,7 @@
{#if enabled}
<div>
<label class="text-xs text-gray-600 dark:text-gray-400" for="sa-concurrent">
{$i18n.t('Max concurrent')}
{$i18n.t('settings.admin.subagents.maxConcurrent.label')}
</label>
<div class="mt-1 flex items-center gap-1.5">
<input
@ -98,21 +100,19 @@
<div>
<label class="flex cursor-pointer items-center justify-between">
<span class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Enable background sub-agents')}
{$i18n.t('settings.admin.subagents.enableBackgroundSubAgents.label')}
</span>
<Switch bind:state={backgroundEnabled} />
</label>
<p class="mt-1 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t(
'Allow delegated sub-agents to keep running while the parent chat continues.'
)}
{$i18n.t('settings.admin.subagents.enableBackgroundSubAgents.description')}
</p>
</div>
{#if backgroundEnabled}
<div>
<label class="text-xs text-gray-600 dark:text-gray-400" for="sa-async">
{$i18n.t('Max background')}
{$i18n.t('settings.admin.subagents.maxBackground.label')}
</label>
<div class="mt-1 flex items-center gap-1.5">
<input
@ -131,7 +131,7 @@
<div>
<label class="text-xs text-gray-600 dark:text-gray-400" for="sa-iterations">
{$i18n.t('Max iterations')}
{$i18n.t('settings.admin.subagents.maxIterations.label')}
</label>
<div class="mt-1 flex items-center gap-1.5">
<input
@ -150,7 +150,7 @@
<div>
<label class="text-xs text-gray-600 dark:text-gray-400" for="sa-output">
{$i18n.t('Max output')}
{$i18n.t('settings.admin.subagents.maxOutput.label')}
</label>
<div class="mt-1 flex items-center gap-1.5">
<input
@ -168,7 +168,7 @@
<div>
<label class="text-xs text-gray-600 dark:text-gray-400" for="sa-prompt">
{$i18n.t('System prompt')}
{$i18n.t('settings.admin.subagents.systemPrompt.label')}
</label>
<textarea
id="sa-prompt"
@ -178,7 +178,7 @@
class="mt-1 w-full resize-y rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 py-1.5 font-mono text-xs text-gray-700 outline-hidden transition-colors focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
></textarea>
<p class="mt-0.5 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t('Leave empty for the built-in default.')}
{$i18n.t('settings.admin.subagents.systemPrompt.description')}
</p>
</div>
{/if}

View file

@ -36,6 +36,7 @@
'serpapi',
'duckduckgo',
'tavily',
'staan',
'jina',
'bing',
'exa',
@ -163,22 +164,24 @@
saveHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Web Search')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.admin.web.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
{#if webConfig}
<AdminSettingSection first title={$i18n.t('Search')}>
<AdminSettingSection first title={$i18n.t('settings.admin.web.sections.search.title')}>
<AdminSettingRow
label={$i18n.t('Web Search')}
description={$i18n.t('Allow users to search the web from chats.')}
label={$i18n.t('settings.admin.web.webSearch.label')}
description={$i18n.t('settings.admin.web.webSearch.description')}
let:labelId
>
<Switch bind:state={webConfig.ENABLE_WEB_SEARCH} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Web Search Confirmation')}
description={$i18n.t('Require users to confirm before using Web Search.')}
label={$i18n.t('settings.admin.web.webSearchConfirmation.label')}
description={$i18n.t('settings.admin.web.webSearchConfirmation.description')}
let:labelId
>
<Switch
@ -189,8 +192,8 @@
{#if webConfig.ENABLE_WEB_SEARCH_CONFIRMATION}
<AdminSettingField
label={$i18n.t('Web Search Confirmation Content')}
description={$i18n.t('Message shown before web search runs.')}
label={$i18n.t('settings.admin.web.webSearchConfirmationContent.label')}
description={$i18n.t('settings.admin.web.webSearchConfirmationContent.description')}
>
<Textarea
className={textareaClass}
@ -203,8 +206,8 @@
{/if}
<AdminSettingRow
label={$i18n.t('Web Search Engine')}
description={$i18n.t('Choose the provider used for web search queries.')}
label={$i18n.t('settings.admin.web.webSearchEngine.label')}
description={$i18n.t('settings.admin.web.webSearchEngine.description')}
>
<SettingsSelect
bind:value={webConfig.WEB_SEARCH_ENGINE}
@ -229,7 +232,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Ollama Cloud API Key')}
{$i18n.t('settings.admin.web.ollamaCloudApiKey.label')}
</div>
<div class="flex w-full">
@ -247,7 +250,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Perplexity Search API URL')}
{$i18n.t('settings.admin.web.perplexitySearchApiUrl.label')}
</div>
<div class="flex w-full">
@ -267,7 +270,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Perplexity API Key')}
{$i18n.t('settings.admin.web.perplexityApiKey.label')}
</div>
<div class="flex w-full">
@ -285,7 +288,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-left text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Searxng Query URL')}
{$i18n.t('settings.admin.web.searxngQueryUrl.label')}
</div>
<div class="flex w-full">
@ -303,7 +306,7 @@
</div>
<div class="mb-2.5 flex w-full flex-col">
<div class=" self-left text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Searxng search language (all, en, es, de, fr, etc.)')}
{$i18n.t('settings.admin.web.searxngSearchLanguageAllEnEsDeFrEtc.label')}
</div>
<div class="flex w-full">
@ -324,7 +327,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Yacy Instance URL')}
{$i18n.t('settings.admin.web.yacyInstanceUrl.label')}
</div>
<div class="flex w-full">
@ -344,7 +347,7 @@
<div class="flex gap-2">
<div class="w-full">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Yacy Username')}
{$i18n.t('settings.admin.web.yacyUsername.label')}
</div>
<input
@ -357,7 +360,7 @@
<div class="w-full">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Yacy Password')}
{$i18n.t('settings.admin.web.yacyPassword.label')}
</div>
<SensitiveInput
@ -372,7 +375,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Google PSE API Key')}
{$i18n.t('settings.admin.web.googlePseApiKey.label')}
</div>
<SensitiveInput
@ -383,7 +386,7 @@
</div>
<div class="mt-1.5">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Google PSE Engine Id')}
{$i18n.t('settings.admin.web.googlePseEngineId.label')}
</div>
<div class="flex w-full">
@ -403,7 +406,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Brave Search API Key')}
{$i18n.t('settings.admin.web.braveSearchApiKey.label')}
</div>
<SensitiveInput
@ -417,7 +420,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Brave Search API Key')}
{$i18n.t('settings.admin.web.braveSearchApiKey.label')}
</div>
<SensitiveInput
@ -428,7 +431,7 @@
</div>
<div class="mt-1.5">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Context Tokens')}
{$i18n.t('settings.admin.web.contextTokens.label')}
</div>
<div class="flex w-full">
@ -451,7 +454,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Kagi Search API Key')}
{$i18n.t('settings.admin.web.kagiSearchApiKey.label')}
</div>
<SensitiveInput
@ -465,7 +468,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Mojeek Search API Key')}
{$i18n.t('settings.admin.web.mojeekSearchApiKey.label')}
</div>
<SensitiveInput
@ -479,7 +482,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Bocha Search API Key')}
{$i18n.t('settings.admin.web.bochaSearchApiKey.label')}
</div>
<SensitiveInput
@ -493,7 +496,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Serpstack API Key')}
{$i18n.t('settings.admin.web.serpstackApiKey.label')}
</div>
<SensitiveInput
@ -507,7 +510,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Serper API Key')}
{$i18n.t('settings.admin.web.serperApiKey.label')}
</div>
<SensitiveInput
@ -521,7 +524,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('SERPHouse API Key')}
{$i18n.t('settings.admin.web.serphouseApiKey.label')}
</div>
<SensitiveInput
@ -532,7 +535,7 @@
</div>
<div class="mt-1.5">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('SERPHouse Domain')}
{$i18n.t('settings.admin.web.serphouseDomain.label')}
</div>
<div class="flex w-full">
@ -552,7 +555,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Serply API Key')}
{$i18n.t('settings.admin.web.serplyApiKey.label')}
</div>
<SensitiveInput
@ -566,7 +569,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Tavily API Key')}
{$i18n.t('settings.admin.web.tavilyApiKey.label')}
</div>
<SensitiveInput
@ -576,11 +579,55 @@
/>
</div>
</div>
{:else if webConfig.WEB_SEARCH_ENGINE === 'staan'}
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Staan API Key')}
</div>
<SensitiveInput
variant="settings"
placeholder={$i18n.t('Enter Staan API Key')}
bind:value={webConfig.STAAN_API_KEY}
/>
</div>
<AdminSettingField
className="mt-1.5"
label={$i18n.t('Market')}
forId="staan-market"
description={$i18n.t('Region and language of the search results, e.g. en-us.')}
>
<input
id="staan-market"
class={inputClass}
placeholder="en-us"
bind:value={webConfig.STAAN_MARKET}
/>
</AdminSettingField>
<AdminSettingField
className="mt-1.5"
label={$i18n.t('Max Snippets')}
forId="staan-max-snippets"
description={$i18n.t(
'Maximum extra snippets returned per result. Set to 0 to disable them.'
)}
>
<input
id="staan-max-snippets"
class={inputClass}
type="number"
min="0"
step="1"
bind:value={webConfig.STAAN_MAX_SNIPPETS}
/>
</AdminSettingField>
</div>
{:else if webConfig.WEB_SEARCH_ENGINE === 'searchapi'}
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('SearchApi API Key')}
{$i18n.t('settings.admin.web.searchapiApiKey.label')}
</div>
<SensitiveInput
@ -591,7 +638,7 @@
</div>
<div class="mt-1.5">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('SearchApi Engine')}
{$i18n.t('settings.admin.web.searchapiEngine.label')}
</div>
<div class="flex w-full">
@ -611,7 +658,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('SerpApi API Key')}
{$i18n.t('settings.admin.web.serpapiApiKey.label')}
</div>
<SensitiveInput
@ -622,7 +669,7 @@
</div>
<div class="mt-1.5">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('SerpApi Engine')}
{$i18n.t('settings.admin.web.serpapiEngine.label')}
</div>
<div class="flex w-full">
@ -642,7 +689,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Jina API Base URL')}
{$i18n.t('settings.admin.web.jinaApiBaseUrl.label')}
</div>
<div class="flex w-full">
@ -660,7 +707,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Jina API Key')}
{$i18n.t('settings.admin.web.jinaApiKey.label')}
</div>
<SensitiveInput
@ -674,7 +721,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Bing Search V7 Endpoint')}
{$i18n.t('settings.admin.web.bingSearchV7Endpoint.label')}
</div>
<div class="flex w-full">
@ -692,7 +739,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Bing Search V7 Subscription Key')}
{$i18n.t('settings.admin.web.bingSearchV7SubscriptionKey.label')}
</div>
<SensitiveInput
@ -706,7 +753,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Exa API Key')}
{$i18n.t('settings.admin.web.exaApiKey.label')}
</div>
<SensitiveInput
@ -717,11 +764,9 @@
</div>
<AdminSettingField
className="mt-1.5"
label={$i18n.t('Max Content Length')}
label={$i18n.t('settings.admin.web.maxContentLength.label')}
forId="exa-max-content-length"
description={$i18n.t(
'Maximum characters per Exa search result. Leave empty for no limit.'
)}
description={$i18n.t('settings.admin.web.maxContentLength.description')}
>
<input
id="exa-max-content-length"
@ -738,7 +783,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Perplexity API Key')}
{$i18n.t('settings.admin.web.perplexityApiKey.label')}
</div>
<SensitiveInput
@ -752,7 +797,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class="self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Perplexity Model')}
{$i18n.t('settings.admin.web.perplexityModel.label')}
</div>
<input
list="perplexity-model-list"
@ -773,7 +818,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Perplexity Search Context Usage')}
{$i18n.t('settings.admin.web.perplexitySearchContextUsage.label')}
</div>
<SettingsSelect
bind:value={webConfig.PERPLEXITY_SEARCH_CONTEXT_USAGE}
@ -789,7 +834,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Microsoft Web IQ API Base URL')}
{$i18n.t('settings.admin.web.microsoftWebIqApiBaseUrl.label')}
</div>
<div class="flex w-full">
@ -807,7 +852,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Microsoft Web IQ API Key')}
{$i18n.t('settings.admin.web.microsoftWebIqApiKey.label')}
</div>
<SensitiveInput
@ -819,7 +864,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Language')}
{$i18n.t('settings.admin.web.language.label')}
</div>
<input
@ -835,7 +880,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Sougou Search API sID')}
{$i18n.t('settings.admin.web.sougouSearchApiSid.label')}
</div>
<SensitiveInput
@ -848,7 +893,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Sougou Search API SK')}
{$i18n.t('settings.admin.web.sougouSearchApiSk.label')}
</div>
<SensitiveInput
@ -862,7 +907,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Firecrawl API Base URL')}
{$i18n.t('settings.admin.web.firecrawlApiBaseUrl.label')}
</div>
<div class="flex w-full">
@ -880,7 +925,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Firecrawl API Key')}
{$i18n.t('settings.admin.web.firecrawlApiKey.label')}
</div>
<SensitiveInput
@ -892,7 +937,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Firecrawl Timeout (s)')}
{$i18n.t('settings.admin.web.firecrawlTimeoutS.label')}
</div>
<div class="flex w-full">
@ -912,7 +957,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('External Web Search URL')}
{$i18n.t('settings.admin.web.externalWebSearchUrl.label')}
</div>
<div class="flex w-full">
@ -930,7 +975,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('External Web Search API Key')}
{$i18n.t('settings.admin.web.externalWebSearchApiKey.label')}
</div>
<SensitiveInput
@ -944,7 +989,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Yandex Web Search URL')}
{$i18n.t('settings.admin.web.yandexWebSearchUrl.label')}
</div>
<div class="flex w-full">
@ -962,7 +1007,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Yandex Web Search API Key')}
{$i18n.t('settings.admin.web.yandexWebSearchApiKey.label')}
</div>
<SensitiveInput
@ -974,7 +1019,7 @@
<div class="mb-2.5">
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Yandex Web Search config')}
{$i18n.t('settings.admin.web.yandexWebSearchConfig.label')}
</div>
<Tooltip
@ -997,7 +1042,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('You.com API Key')}
{$i18n.t('settings.admin.web.youComApiKey.label')}
</div>
<SensitiveInput
@ -1011,7 +1056,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Linkup API Key')}
{$i18n.t('settings.admin.web.linkupApiKey.label')}
</div>
<SensitiveInput
@ -1023,7 +1068,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Parameters')}
{$i18n.t('settings.admin.web.parameters.label')}
</div>
<Textarea
@ -1037,7 +1082,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('OpenSERP URL')}
{$i18n.t('settings.admin.web.openserpUrl.label')}
</div>
<div class="flex-1">
@ -1058,7 +1103,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('DDGS Backend')}
{$i18n.t('settings.admin.web.ddgsBackend.label')}
</div>
<div class="flex w-full">
@ -1084,18 +1129,18 @@
{#if webConfig.ENABLE_WEB_SEARCH}
<AdminSettingField
label={$i18n.t('Search Limits')}
description={$i18n.t('Control result volume and parallel search requests.')}
label={$i18n.t('settings.admin.web.searchLimits.label')}
description={$i18n.t('settings.admin.web.searchLimits.description')}
>
<div class="flex gap-2">
<div class="w-full">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Search Result Count')}
{$i18n.t('settings.admin.web.searchResultCount.label')}
</div>
<input
class="w-full rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 py-1.5 text-xs text-gray-700 outline-hidden transition-colors focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
placeholder={$i18n.t('Search Result Count')}
placeholder={$i18n.t('settings.admin.web.searchResultCount.label')}
bind:value={webConfig.WEB_SEARCH_RESULT_COUNT}
required
/>
@ -1104,18 +1149,16 @@
<div class="w-full">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
<Tooltip
content={$i18n.t(
'Limit concurrent search queries. 0 = unlimited (default). Set to 1 for sequential execution (recommended for APIs with strict rate limits like Brave free tier).'
)}
content={$i18n.t('settings.admin.web.searchResultCount.description')}
placement="top-start"
>
{$i18n.t('Concurrent Requests')}
{$i18n.t('settings.admin.web.concurrentRequests.label')}
</Tooltip>
</div>
<input
class="w-full rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 py-1.5 text-xs text-gray-700 outline-hidden transition-colors focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
placeholder={$i18n.t('Concurrent Requests')}
placeholder={$i18n.t('settings.admin.web.concurrentRequests.label')}
bind:value={webConfig.WEB_SEARCH_CONCURRENT_REQUESTS}
type="number"
min="0"
@ -1125,10 +1168,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Fetch URL Content Length Limit')}
description={$i18n.t(
'Maximum characters to return from fetched URLs. Leave empty for no limit.'
)}
label={$i18n.t('settings.admin.web.fetchUrlContentLengthLimit.label')}
description={$i18n.t('settings.admin.web.fetchUrlContentLengthLimit.description')}
>
<input
class={inputClass}
@ -1140,8 +1181,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Domain Filter List')}
description={$i18n.t('Restrict or exclude domains using a comma-separated list.')}
label={$i18n.t('settings.admin.web.domainFilterList.label')}
description={$i18n.t('settings.admin.web.domainFilterList.description')}
>
<input
class={inputClass}
@ -1154,9 +1195,9 @@
{/if}
<AdminSettingRow
label={$i18n.t('Bypass Embedding and Retrieval')}
label={$i18n.t('settings.admin.web.bypassEmbeddingAndRetrieval.label')}
description={webConfig.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL
? $i18n.t('Inject the entire content as context for comprehensive processing.')
? $i18n.t('settings.admin.web.bypassEmbeddingAndRetrieval.description')
: $i18n.t('Use segmented retrieval for focused and relevant content extraction.')}
let:labelId
>
@ -1167,17 +1208,17 @@
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Bypass Web Loader')}
description={$i18n.t('Use search results without fetching page contents.')}
label={$i18n.t('settings.admin.web.bypassWebLoader.label')}
description={$i18n.t('settings.admin.web.bypassWebLoader.description')}
let:labelId
>
<Switch bind:state={webConfig.BYPASS_WEB_SEARCH_WEB_LOADER} ariaLabelledbyId={labelId} />
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Trust Proxy Environment')}
label={$i18n.t('settings.admin.web.trustProxyEnvironment.label')}
description={webConfig.WEB_SEARCH_TRUST_ENV
? $i18n.t('Use proxy environment variables to fetch page contents.')
? $i18n.t('settings.admin.web.trustProxyEnvironment.description')
: $i18n.t('Fetch page contents without proxy environment variables.')}
let:labelId
>
@ -1185,10 +1226,10 @@
</AdminSettingRow>
</AdminSettingSection>
<AdminSettingSection title={$i18n.t('Loader')}>
<AdminSettingSection title={$i18n.t('settings.admin.web.sections.loader.title')}>
<AdminSettingRow
label={$i18n.t('Web Loader Engine')}
description={$i18n.t('Choose how web result pages are fetched and read.')}
label={$i18n.t('settings.admin.web.webLoaderEngine.label')}
description={$i18n.t('settings.admin.web.webLoaderEngine.description')}
>
<SettingsSelect
bind:value={webConfig.WEB_LOADER_ENGINE}
@ -1205,19 +1246,19 @@
{#if webConfig.WEB_LOADER_ENGINE === '' || webConfig.WEB_LOADER_ENGINE === 'safe_web'}
<AdminSettingField
label={$i18n.t('Timeout')}
description={$i18n.t('Maximum time to wait while loading web content.')}
label={$i18n.t('settings.admin.web.timeout.label')}
description={$i18n.t('settings.admin.web.timeout.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('Timeout')}
placeholder={$i18n.t('settings.admin.web.timeout.label')}
bind:value={webConfig.WEB_LOADER_TIMEOUT}
/>
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('Verify SSL Certificate')}
description={$i18n.t('Validate SSL certificates when fetching web content.')}
label={$i18n.t('settings.admin.web.verifySslCertificate.label')}
description={$i18n.t('settings.admin.web.verifySslCertificate.description')}
let:labelId
>
<Switch
@ -1229,7 +1270,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Playwright WebSocket URL')}
{$i18n.t('settings.admin.web.playwrightWebsocketUrl.label')}
</div>
<div class="flex w-full">
@ -1247,7 +1288,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Playwright Timeout (ms)')}
{$i18n.t('settings.admin.web.playwrightTimeoutMs.label')}
</div>
<div class="flex w-full">
@ -1266,7 +1307,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Firecrawl API Base URL')}
{$i18n.t('settings.admin.web.firecrawlApiBaseUrl.label')}
</div>
<div class="flex w-full">
@ -1284,7 +1325,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Firecrawl API Key')}
{$i18n.t('settings.admin.web.firecrawlApiKey.label')}
</div>
<SensitiveInput
@ -1298,7 +1339,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Tavily Extract Depth')}
{$i18n.t('settings.admin.web.tavilyExtractDepth.label')}
</div>
<div class="flex w-full">
@ -1317,7 +1358,7 @@
{#if webConfig.WEB_SEARCH_ENGINE !== 'tavily'}
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Tavily API Key')}
{$i18n.t('settings.admin.web.tavilyApiKey.label')}
</div>
<SensitiveInput
@ -1333,7 +1374,7 @@
{#if webConfig.WEB_SEARCH_ENGINE !== 'microsoft_web_iq'}
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Microsoft Web IQ API Base URL')}
{$i18n.t('settings.admin.web.microsoftWebIqApiBaseUrl.label')}
</div>
<div class="flex w-full">
@ -1351,7 +1392,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Microsoft Web IQ API Key')}
{$i18n.t('settings.admin.web.microsoftWebIqApiKey.label')}
</div>
<SensitiveInput
@ -1363,7 +1404,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('Language')}
{$i18n.t('settings.admin.web.language.label')}
</div>
<input
@ -1380,7 +1421,7 @@
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('External Web Loader URL')}
{$i18n.t('settings.admin.web.externalWebLoaderUrl.label')}
</div>
<div class="flex w-full">
@ -1398,7 +1439,7 @@
<div class="mt-2">
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
{$i18n.t('External Web Loader API Key')}
{$i18n.t('settings.admin.web.externalWebLoaderApiKey.label')}
</div>
<SensitiveInput
@ -1411,20 +1452,20 @@
{/if}
<AdminSettingField
label={$i18n.t('Concurrent Requests')}
description={$i18n.t('Limit parallel web loader requests.')}
label={$i18n.t('settings.admin.web.concurrentRequests.label')}
description={$i18n.t('settings.admin.web.concurrentRequests.description')}
>
<input
class={inputClass}
placeholder={$i18n.t('Concurrent Requests')}
placeholder={$i18n.t('settings.admin.web.concurrentRequests.label')}
bind:value={webConfig.WEB_LOADER_CONCURRENT_REQUESTS}
required
/>
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Youtube Language')}
description={$i18n.t('Preferred transcript language codes, separated by commas.')}
label={$i18n.t('settings.admin.web.youtubeLanguage.label')}
description={$i18n.t('settings.admin.web.youtubeLanguage.description')}
>
<input
class={inputClass}
@ -1436,8 +1477,8 @@
</AdminSettingField>
<AdminSettingField
label={$i18n.t('Youtube Proxy URL')}
description={$i18n.t('Proxy URL used for Youtube loader requests.')}
label={$i18n.t('settings.admin.web.youtubeProxyUrl.label')}
description={$i18n.t('settings.admin.web.youtubeProxyUrl.description')}
>
<input
class={inputClass}

View file

@ -110,13 +110,15 @@
</script>
{#if loaded}
<EditGroupModal
bind:show={showAddGroupModal}
edit={false}
tabs={['general', 'permissions']}
permissions={defaultPermissions}
onSubmit={addGroupHandler}
/>
{#if showAddGroupModal}
<EditGroupModal
bind:show={showAddGroupModal}
edit={false}
tabs={['general', 'permissions']}
permissions={defaultPermissions}
onSubmit={addGroupHandler}
/>
{/if}
<div>
<div class="sticky top-0 z-10 bg-white dark:bg-gray-900">

View file

@ -28,8 +28,7 @@
const init = () => {
if (selectedUser) {
_user = selectedUser;
_user.password = '';
_user = { ...selectedUser, password: '' };
loadUserGroups();
}
};

View file

@ -140,12 +140,12 @@
const result = await updateCalendarEvent(localStorage.token, event.id, {
calendar_id: calendarId,
title: title.trim(),
description: description.trim() || undefined,
description: description.trim() || null,
start_at: startNs,
end_at: endNs,
all_day: allDay,
rrule: getRepeatRrule(),
location: location.trim() || undefined,
rrule: getRepeatRrule() ?? null,
location: location.trim() || null,
meta: { alert_minutes: alertMinutes }
});
if (result) {

View file

@ -630,7 +630,10 @@
command: ({ editor, range, props }) => {
// Convert the Unicode hex codepoint (e.g. "1F44B") to the actual emoji character (👋)
const codepoint = props.id;
const emoji = String.fromCodePoint(parseInt(codepoint, 16));
const emoji = codepoint
.split('-')
.map((cp) => String.fromCodePoint(parseInt(cp, 16)))
.join('');
editor.chain().focus().deleteRange(range).insertContent(emoji).run();
},
render: getSuggestionRenderer(CommandSuggestionList, {

View file

@ -595,6 +595,7 @@
})}
>
<button
{disabled}
class="flex items-center gap-1.5 transition rounded-xl px-2 py-1 cursor-pointer {reaction.users
.map((u) => u.id)
.includes($user?.id)
@ -617,7 +618,7 @@
</Tooltip>
{/each}
{#if onReaction}
{#if onReaction && !disabled}
<EmojiPicker
onSubmit={(name) => {
onReaction(name);

View file

@ -22,6 +22,11 @@
let name = webhook.name;
let image = webhook.profile_image_url || '';
// The server decides whether an external avatar host is fetched.
$: imageSrc = image.toLowerCase().startsWith('http')
? `${WEBUI_API_BASE_URL}/channels/webhooks/${webhook.id}/profile/image`
: image;
// Notify parent when changes occur
$: if (name !== webhook.name || image !== (webhook.profile_image_url || '')) {
onUpdate({ name: name.trim() || webhook.name, profile_image_url: image });
@ -93,7 +98,7 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<img
src={image || `${WEBUI_BASE_URL}/static/favicon.png`}
src={imageSrc || `${WEBUI_BASE_URL}/static/favicon.png`}
class="rounded-full size-8 object-cover flex-shrink-0"
alt=""
/>
@ -130,7 +135,7 @@
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<img
src={image || `${WEBUI_BASE_URL}/static/favicon.png`}
src={imageSrc || `${WEBUI_BASE_URL}/static/favicon.png`}
class="size-8 object-cover"
alt=""
/>

View file

@ -64,7 +64,8 @@
removeAllDetails,
getCodeBlockContents,
displayFileHandler,
getUsageTokenCount
getUsageTokenCount,
isRasterImageContentType
} from '$lib/utils';
import { AudioQueue } from '$lib/utils/audio';
import { createTemporaryChatId, isTemporaryChatId } from '$lib/utils/chatId';
@ -447,9 +448,11 @@
tool_approval_mode
}
});
await updateUserSettings(localStorage.token, { ui: $settings }).catch((err) => {
console.error('[tool permissions settings]', err);
});
await updateUserSettings(localStorage.token, { ui: { params: $settings.params } }).catch(
(err) => {
console.error('[tool permissions settings]', err);
}
);
if ($chatId && !$temporaryChatEnabled && !isTemporaryChatId($chatId)) {
const res = await updateChatById(localStorage.token, $chatId, { params }).catch((err) => {
@ -1280,6 +1283,13 @@
}, 100);
} else if (type === 'chat:message:error') {
message.error = data.error;
if (data.done === true && !message.done) {
message.done = true;
dismissContextCompactionToast();
if (event.message_id === history.currentId) {
await processNextInQueue(event.chat_id);
}
}
} else if (type === 'chat:message:follow_ups') {
message.followUps = data.follow_ups;
@ -2025,6 +2035,10 @@
}
}
if ($page.url.searchParams.get('temporary-chat') === 'true') {
await temporaryChatEnabled.set(true);
}
if ($user?.role !== 'admin' && !$user?.permissions?.chat?.temporary) {
await temporaryChatEnabled.set(false);
}
@ -2125,7 +2139,7 @@
await showArtifacts.set(false);
if (!embedded && $page.url.pathname.includes('/c/')) {
window.history.replaceState(history.state, '', `/`);
window.history.replaceState(window.history.state, '', `/`);
}
autoScroll = true;
@ -2299,6 +2313,13 @@
? chatContent.models
: [chatContent.models ?? ''];
// An empty model list is not evidence that the chat's models are gone.
if ($models.length > 0) {
selectedModels = selectedModels.filter((modelId) =>
$models.map((m) => m.id).includes(modelId)
);
}
if (!($user?.role === 'admin' || ($user?.permissions?.chat?.multiple_models ?? true))) {
selectedModels = selectedModels.length > 0 ? [selectedModels[0]] : [''];
}
@ -2886,7 +2907,7 @@
..._files.filter(
(item) =>
['doc', 'text', 'note', 'chat', 'folder', 'collection'].includes(item.type) ||
(item.type === 'file' && !(item?.content_type ?? '').startsWith('image/'))
(item.type === 'file' && !isRasterImageContentType(item?.content_type))
)
);
chatFiles = chatFiles.filter(
@ -3027,11 +3048,11 @@
return;
}
const currentMessage = history.messages?.[history.currentId];
const forkedMessage = history.messages?.[messageId ?? history.currentId];
if (
generating ||
taskIds?.length ||
(currentMessage?.role === 'assistant' && !currentMessage.done)
(forkedMessage?.role === 'assistant' && !forkedMessage.done)
) {
toast.warning($i18n.t('Wait for the current response to finish before forking.'));
return;
@ -3187,16 +3208,6 @@
}
}
if (history?.currentId) {
const currentMessage = history.messages[history.currentId];
if (currentMessage.error && !currentMessage.content) {
// Error in response
toast.error($i18n.t(`Oops! There was an error in the previous response.`));
return;
}
}
// Clear input and submit
messageInput?.setText('');
prompt = '';
@ -3323,7 +3334,7 @@
if (model) {
const hasImages = createMessagesList(_history, parentId).some((message) =>
message.files?.some(
(file) => file.type === 'image' || (file?.content_type ?? '').startsWith('image/')
(file) => file.type === 'image' || isRasterImageContentType(file?.content_type)
)
);
@ -3445,7 +3456,7 @@
...(userMessage?.files ?? []).filter(
(item) =>
['doc', 'text', 'note', 'chat', 'collection', 'folder'].includes(item.type) ||
(item.type === 'file' && !(item?.content_type ?? '').startsWith('image/'))
(item.type === 'file' && !isRasterImageContentType(item?.content_type))
)
);
// Remove duplicates
@ -3496,7 +3507,7 @@
messages = messages
.map((message) => {
const imageFiles = (message?.files ?? []).filter(
(file) => file.type === 'image' || (file?.content_type ?? '').startsWith('image/')
(file) => file.type === 'image' || isRasterImageContentType(file?.content_type)
);
if (message.output && message.role === 'assistant') {
@ -3581,7 +3592,11 @@
(server, idx) => toolServerIds.includes(idx) || toolServerIds.includes(server?.id)
),
// Direct terminal servers — always included when enabled (not routed through selectedToolIds)
...($terminalServers ?? []).filter((t) => !t.id)
...(terminalEnabled
? ($terminalServers ?? [])
.filter((server) => !server.id)
.map((server) => ({ ...server, is_terminal: true }))
: [])
],
features: getFeatures(),
variables: {
@ -3670,7 +3685,7 @@
});
await chatId.set(res.chat_id);
if (!$temporaryChatEnabled && !embedded) {
window.history.replaceState(history.state, '', `/c/${res.chat_id}`);
window.history.replaceState(window.history.state, '', `/c/${res.chat_id}`);
await refreshChatList(localStorage.token);
// Persist chat-level params (system prompt, advanced
@ -3956,7 +3971,7 @@
await chatId.set(_chatId);
if (!embedded) {
window.history.replaceState(history.state, '', `/c/${_chatId}`);
window.history.replaceState(window.history.state, '', `/c/${_chatId}`);
}
await tick();
@ -4011,7 +4026,8 @@
const MAX_DRAFT_LENGTH = 5000;
let saveDraftTimeout: ReturnType<typeof setTimeout> | null = null;
const getDraftChatId = () => chatIdProp || null;
// chatIdProp is empty for chats started from the home page (URL set via replaceState)
const getDraftChatId = () => chatIdProp || $chatId || null;
const getChatInputDraft = () => ({
prompt,
@ -4614,7 +4630,7 @@
}
}}
on:submit={async (e) => {
clearDraft();
clearDraft(getDraftChatId());
if (e.detail || files.length > 0) {
await tick();
submitHandler(withSelectedText(e.detail));

View file

@ -58,7 +58,8 @@
getUsageTokenCount,
getUserPosition,
getUserTimezone,
getWeekday
getWeekday,
isRasterImageContentType
} from '$lib/utils';
import { uploadFile } from '$lib/apis/files';
import { getCwd, uploadNewFileToTerminal } from '$lib/apis/terminal';
@ -578,9 +579,9 @@
}
if ($temporaryChatEnabled) {
window.history.replaceState(null, '', '?temporary-chat=true');
window.history.replaceState(window.history.state, '', '?temporary-chat=true');
} else {
window.history.replaceState(null, '', location.pathname);
window.history.replaceState(window.history.state, '', location.pathname);
}
};
@ -1122,7 +1123,7 @@
return;
}
if (file['type'].startsWith('image/')) {
if (isRasterImageContentType(file['type'])) {
if (visionCapableModels.length === 0) {
toast.error($i18n.t('Selected model(s) do not support image inputs'));
return;
@ -1567,7 +1568,10 @@
command: ({ editor, range, props }) => {
// Convert the Unicode hex codepoint (e.g. "1F44B") to the actual emoji character (👋)
const codepoint = props.id;
const emoji = String.fromCodePoint(parseInt(codepoint, 16));
const emoji = codepoint
.split('-')
.map((cp) => String.fromCodePoint(parseInt(cp, 16)))
.join('');
editor.chain().focus().deleteRange(range).insertContent(emoji).run();
},
render: getSuggestionRenderer(CommandSuggestionList, {
@ -1761,6 +1765,7 @@
>
<button
id="generate-message-pair-button"
type="button"
aria-label={$i18n.t('Generate message pair')}
class="hidden"
on:click={() => createMessagePair(prompt)}
@ -1929,7 +1934,7 @@
dir={$settings?.chatDirection ?? 'auto'}
>
{#each files as file, fileIdx}
{#if file.type === 'image' || (file?.content_type ?? '').startsWith('image/')}
{#if file.type === 'image' || isRasterImageContentType(file?.content_type)}
{@const fileUrl =
file.url.startsWith('data') || file.url.startsWith('http')
? file.url

View file

@ -1,6 +1,8 @@
<script lang="ts">
import { onDestroy, onMount, tick, getContext } from 'svelte';
import { isRasterImageContentType } from '$lib/utils';
import { searchFiles } from '$lib/apis/files';
import Tooltip from '$lib/components/common/Tooltip.svelte';
@ -71,7 +73,7 @@
...items,
...(res ?? []).map((file) => ({
...file,
type: file?.meta?.content_type?.startsWith('image/') ? 'image' : 'file',
type: isRasterImageContentType(file?.meta?.content_type) ? 'image' : 'file',
name: file.filename,
url: file.id,
content_type: file?.meta?.content_type,

View file

@ -125,6 +125,7 @@
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden border border-gray-100/30 dark:border-gray-850/30"
bind:value={variableValues[variable]}
id="input-variable-{idx}"
required={variables[variable]?.required ?? false}
>
<option value="" disabled>
{variables[variable]?.placeholder ?? $i18n.t('Select an option')}

View file

@ -7,6 +7,7 @@
import EditPencil from '$lib/components/icons/EditPencil.svelte';
import ArrowForward from '$lib/components/icons/ArrowForward.svelte';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import { isRasterImageContentType } from '$lib/utils';
const i18n = getContext('i18n');
@ -29,7 +30,7 @@
{#if files.length > 0}
<div class="flex items-center gap-1 shrink-0">
{#each files as file}
{#if file.type === 'image' || (file?.content_type ?? '').startsWith('image/')}
{#if file.type === 'image' || isRasterImageContentType(file?.content_type)}
{@const fileUrl =
file.url?.startsWith('data') || file.url?.startsWith('http')
? file.url

View file

@ -233,7 +233,9 @@
/\bimport\s+seaborn\b|\bfrom\s+seaborn\b/.test(code) ? 'seaborn' : null,
/\bimport\s+sympy\b|\bfrom\s+sympy\b/.test(code) ? 'sympy' : null,
/\bimport\s+tiktoken\b|\bfrom\s+tiktoken\b/.test(code) ? 'tiktoken' : null,
/\bimport\s+pytz\b|\bfrom\s+pytz\b/.test(code) ? 'pytz' : null
/\bimport\s+pytz\b|\bfrom\s+pytz\b/.test(code) ? 'pytz' : null,
/\bimport\s+openpyxl\b|\bfrom\s+openpyxl\b/.test(code) ? 'openpyxl' : null,
/\.(read|to)_excel\(|\.Excel(Writer|File)\(/.test(code) ? 'openpyxl' : null
].filter(Boolean);
console.log(packages);
@ -557,7 +559,7 @@
<DiffBlock code={_code} />
{:else if edit}
<CodeEditor
value={isDiff ? _code : code}
value={_code}
{id}
{lang}
onSave={() => {
@ -619,7 +621,7 @@
? `max-h-96`
: ''} overflow-y-auto"
>
{stdout || stderr}
{`${stdout ?? ''}${stderr ?? ''}`}
</div>
</div>
{/if}

View file

@ -86,7 +86,7 @@
title={token.title}
on:click={(e) => handleLinkClick(e, token.href)}
>
<svelte:self id={`${id}-a`} tokens={token.tokens} {onSourceClick} {done} />
<svelte:self id={`${id}-a`} tokens={token.tokens} {sourceIds} {onSourceClick} {done} />
</a>
{:else}
<a
@ -100,17 +100,19 @@
{:else if token.type === 'image'}
<Image src={token.href} alt={token.text} allowExternal={true} />
{:else if token.type === 'strong'}
<strong><svelte:self id={`${id}-strong`} tokens={token.tokens} {onSourceClick} /></strong>
<strong
><svelte:self id={`${id}-strong`} tokens={token.tokens} {sourceIds} {onSourceClick} /></strong
>
{:else if token.type === 'em'}
<em><svelte:self id={`${id}-em`} tokens={token.tokens} {onSourceClick} /></em>
<em><svelte:self id={`${id}-em`} tokens={token.tokens} {sourceIds} {onSourceClick} /></em>
{:else if token.type === 'codespan'}
<CodespanToken {token} {done} />
{:else if token.type === 'br'}
<br />
{:else if token.type === 'del'}
<del><svelte:self id={`${id}-del`} tokens={token.tokens} {onSourceClick} /></del>
<del><svelte:self id={`${id}-del`} tokens={token.tokens} {sourceIds} {onSourceClick} /></del>
{:else if token.type === 'underline'}
<u><svelte:self id={`${id}-underline`} tokens={token.tokens} {onSourceClick} /></u>
<u><svelte:self id={`${id}-underline`} tokens={token.tokens} {sourceIds} {onSourceClick} /></u>
{:else if token.type === 'inlineKatex'}
{#if token.text}
<KatexRenderer content={token.text} displayMode={token?.displayMode ?? false} />

View file

@ -87,7 +87,6 @@
{compactPreview}
{editCodeBlock}
{topPadding}
{onInsertToNote}
/>
{:else if (history.messages[history.messages[messageId].parentId]?.models?.length ?? 1) === 1}
<ResponseMessage
@ -118,6 +117,7 @@
{compactPreview}
{editCodeBlock}
{topPadding}
{onInsertToNote}
/>
{:else}
{#key messageId}

View file

@ -49,6 +49,7 @@
import RateComment from './RateComment.svelte';
import WebSearchResults from './ResponseMessage/WebSearchResults.svelte';
import Sparkles from '$lib/components/icons/Sparkles.svelte';
import ArrowUpLeft from '$lib/components/icons/ArrowUpLeft.svelte';
import DeleteConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
@ -464,6 +465,9 @@
annotation: {
...(message?.annotation ?? {}),
...(rating !== null ? { rating: rating } : {}),
...(rating !== null && rating !== message?.annotation?.rating
? { reason: null, details: null }
: {}),
...(details ? details : {})
}
};
@ -524,9 +528,12 @@
message.feedbackId,
feedbackItem
).catch((error) => {
toast.error(`${error}`);
console.error(error);
return null;
});
} else {
}
if (!feedback) {
feedback = await createNewFeedback(localStorage.token, feedbackItem).catch((error) => {
toast.error(`${error}`);
});
@ -937,6 +944,22 @@
class="flex items-center justify-start overflow-x-auto whitespace-nowrap buttons text-gray-600 dark:text-gray-500 mt-0.5 [&>*]:shrink-0"
>
{#if message.done || siblings.length > 1}
{#if message.done && onInsertToNote && visibleResponseContent}
<Tooltip content={$i18n.t('Insert into note')} placement="bottom">
<button
aria-label={$i18n.t('Insert into note')}
class="{isLastMessage || ($settings?.highContrastMode ?? false)
? 'visible'
: 'hover-reveal'} p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg dark:hover:text-white hover:text-black transition"
on:click={() => {
onInsertToNote?.(visibleResponseContent);
}}
>
<ArrowUpLeft className="size-3.5" strokeWidth="2" />
</button>
</Tooltip>
{/if}
{#if siblings.length > 1}
<div class="flex self-center min-w-fit" dir="ltr">
<button
@ -1095,22 +1118,6 @@
</button>
</Tooltip>
{#if onInsertToNote && visibleResponseContent}
<Tooltip content={$i18n.t('Insert into note')} placement="bottom">
<button
aria-label={$i18n.t('Insert into note')}
class="{isLastMessage || ($settings?.highContrastMode ?? false)
? 'visible'
: 'hover-reveal'} rounded-lg px-2 py-1.5 text-xs text-gray-500 transition hover:bg-black/5 hover:text-black dark:hover:bg-white/5 dark:hover:text-white"
on:click={() => {
onInsertToNote?.(visibleResponseContent);
}}
>
{$i18n.t('Insert')}
</button>
</Tooltip>
{/if}
{#if !readOnly && ($user?.role === 'admin' || ($user?.permissions?.chat?.tts ?? true))}
<Tooltip content={$i18n.t('Read Aloud')} placement="bottom">
<button
@ -1610,15 +1617,17 @@
</div>
{#if message.done && showRateComment}
<RateComment
bind:message
bind:show={showRateComment}
on:save={async (e) => {
await feedbackHandler(null, {
...e.detail
});
}}
/>
{#key message?.annotation?.rating}
<RateComment
bind:message
bind:show={showRateComment}
on:save={async (e) => {
await feedbackHandler(null, {
...e.detail
});
}}
/>
{/key}
{/if}
{#if (isLastMessage || ($settings?.keepFollowUpPrompts ?? false)) && message.done && !readOnly && (message?.followUps ?? []).length > 0}

View file

@ -34,6 +34,7 @@
</div>
<button
type="button"
class="p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"
on:click={() => (collapsed = !collapsed)}
aria-label={collapsed ? 'Expand' : 'Collapse'}

View file

@ -7,7 +7,8 @@
import {
copyToClipboard as _copyToClipboard,
formatMessageTimestamp,
formatMessageTimestampFull
formatMessageTimestampFull,
isRasterImageContentType
} from '$lib/utils';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import equal from 'fast-deep-equal';
@ -77,7 +78,7 @@
const editMessageHandler = async () => {
edit = true;
editedContent = message?.content ?? '';
editedFiles = message.files;
editedFiles = [...(message.files ?? [])];
await tick();
@ -183,7 +184,7 @@
? file.url
: `${WEBUI_API_BASE_URL}/files/${file.url}${file?.content_type ? '/content' : ''}`}
<div class={($settings?.chatBubble ?? true) ? 'self-end' : ''}>
{#if file.type === 'image' || (file?.content_type ?? '').startsWith('image/')}
{#if file.type === 'image' || isRasterImageContentType(file?.content_type)}
<Image src={fileUrl} imageClassName=" max-h-96 rounded-lg" />
{:else}
<FileItem
@ -211,7 +212,7 @@
{#if (editedFiles ?? []).length > 0}
<div class="flex items-center flex-wrap gap-2 -mx-2 mb-1">
{#each editedFiles as file, fileIdx}
{#if file.type === 'image' || (file?.content_type ?? '').startsWith('image/')}
{#if file.type === 'image' || isRasterImageContentType(file?.content_type)}
{@const fileUrl =
file.url?.startsWith('data') || file.url?.startsWith('http')
? file.url

View file

@ -30,7 +30,7 @@
return;
}
settings.set({ ...$settings, models: selectedModels });
await updateUserSettings(localStorage.token, { ui: $settings });
await updateUserSettings(localStorage.token, { ui: { models: selectedModels } });
toast.success($i18n.t('Default model updated'));
};
@ -42,7 +42,7 @@
? $pinnedModels.filter((id) => id !== modelId)
: [...$pinnedModels, modelId]
});
await updateUserSettings(localStorage.token, { ui: $settings });
await updateUserSettings(localStorage.token, { ui: { pinnedModels: $settings.pinnedModels } });
};
$: if (selectedModels.length > 0 && $models.length > 0) {

View file

@ -184,9 +184,9 @@
// add 'temporary-chat=true' to the URL
if ($temporaryChatEnabled) {
window.history.replaceState(null, '', '?temporary-chat=true');
window.history.replaceState(window.history.state, '', '?temporary-chat=true');
} else {
window.history.replaceState(null, '', location.pathname);
window.history.replaceState(window.history.state, '', location.pathname);
}
}}
aria-label={$i18n.t(`Temporary Chat`)}

View file

@ -49,16 +49,19 @@
</script>
<div id="tab-about" class="flex flex-col h-full justify-between text-sm">
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('About')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.personal.about.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<!-- LICENSE covers this Open WebUI About identifier.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<UserSettingSection title={`${$WEBUI_NAME} ${$i18n.t('Version')}`} first>
<UserSettingRow
description={$i18n.t('View the installed version and check release updates.')}
>
<UserSettingSection
title={`${$WEBUI_NAME} ${$i18n.t('settings.personal.about.sections.version.title')}`}
first
>
<UserSettingRow description={$i18n.t('settings.personal.about.seeWhatSNew.description')}>
<div slot="label" class="flex flex-col text-xs text-gray-600 dark:text-gray-400">
<div class="flex gap-1">
<Tooltip content={WEBUI_BUILD_HASH}>
@ -89,7 +92,7 @@
showChangelog.set(true);
}}
>
<div>{$i18n.t("See what's new")}</div>
<div>{$i18n.t('settings.personal.about.seeWhatSNew.label')}</div>
</button>
</div>
@ -100,21 +103,21 @@
checkForVersionUpdates();
}}
>
{$i18n.t('Check for updates')}
{$i18n.t('settings.personal.about.checkForUpdates.label')}
</button>
{/if}
</UserSettingRow>
</UserSettingSection>
{#if ollamaVersion}
<UserSettingSection title={$i18n.t('Ollama Version')}>
<UserSettingSection title={$i18n.t('settings.personal.about.sections.ollamaVersion.title')}>
<div class="text-xs text-gray-600 dark:text-gray-400">
{ollamaVersion ?? 'N/A'}
</div>
</UserSettingSection>
{/if}
<UserSettingSection title={$i18n.t('Community')}>
<UserSettingSection title={$i18n.t('settings.personal.about.sections.community.title')}>
{#if $config?.license_metadata}
<!-- LICENSE covers this Open WebUI license attribution.
Do not alter, remove, obscure, or replace it except as LICENSE permits:

View file

@ -1,4 +1,5 @@
<script lang="ts">
import { canUseApiKeys } from '$lib/utils/settings-access';
import { toast } from 'svelte-sonner';
import { onMount, getContext } from 'svelte';
@ -209,8 +210,8 @@
profileImageUrl = user?.profile_image_url ?? '';
bio = user?.bio ?? '';
_gender = user?.gender ?? '';
gender = _gender;
gender = user?.gender ?? '';
_gender = ['', 'male', 'female'].includes(gender) ? gender : 'custom';
dateOfBirth = user?.date_of_birth ?? '';
}
@ -235,11 +236,23 @@
});
</script>
<div id="tab-account" class="flex h-full flex-col text-sm">
<div class="flex-1 min-h-0 w-full overflow-y-auto scrollbar-hover pr-1.5">
<h2 class="mb-4 text-sm font-medium text-gray-900 dark:text-white">{$i18n.t('Account')}</h2>
<form
id="tab-account"
class="flex h-full flex-col text-sm"
on:submit|preventDefault={async () => {
const res = await submitHandler();
<UserSettingSection title={$i18n.t('Profile')} first>
if (res) {
saveHandler();
}
}}
>
<div class="flex-1 min-h-0 w-full overflow-y-auto scrollbar-hover pr-1.5">
<h2 class="mb-4 text-sm font-medium text-gray-900 dark:text-white">
{$i18n.t('settings.personal.account.title')}
</h2>
<UserSettingSection title={$i18n.t('settings.personal.account.sections.profile.title')} first>
<UserProfileImage
bind:profileImageUrl
user={$user}
@ -248,40 +261,40 @@
/>
<UserSettingField
label={$i18n.t('Name')}
description={$i18n.t('Set the display name shown across your account.')}
label={$i18n.t('settings.personal.account.name.label')}
description={$i18n.t('settings.personal.account.name.description')}
>
<input
class={inputClass}
type="text"
bind:value={name}
aria-label={$i18n.t('Name')}
aria-label={$i18n.t('settings.personal.account.name.label')}
required
placeholder={$i18n.t('Enter your name')}
/>
</UserSettingField>
<UserSettingField
label={$i18n.t('Bio')}
description={$i18n.t('Add optional profile context visible where profiles are shown.')}
label={$i18n.t('settings.personal.account.bio.label')}
description={$i18n.t('settings.personal.account.bio.description')}
>
<Textarea
className={textareaClass}
minSize={60}
bind:value={bio}
ariaLabel={$i18n.t('Bio')}
ariaLabel={$i18n.t('settings.personal.account.bio.label')}
placeholder={$i18n.t('Share your background and interests')}
/>
</UserSettingField>
<UserSettingField
label={$i18n.t('Gender')}
description={$i18n.t('Choose the gender value stored on your profile.')}
label={$i18n.t('settings.personal.account.gender.label')}
description={$i18n.t('settings.personal.account.gender.description')}
>
<SettingsSelect
bind:value={_gender}
className="w-full"
ariaLabel={$i18n.t('Gender')}
ariaLabel={$i18n.t('settings.personal.account.gender.label')}
on:change={() => {
console.log(_gender);
@ -312,15 +325,14 @@
</UserSettingField>
<UserSettingField
label={$i18n.t('Birth Date')}
description={$i18n.t('Set the birth date saved with your profile.')}
label={$i18n.t('settings.personal.account.birthDate.label')}
description={$i18n.t('settings.personal.account.birthDate.description')}
>
<input
class="{inputClass} dark:scheme-dark"
type="date"
aria-label={$i18n.t('Birth Date')}
aria-label={$i18n.t('settings.personal.account.birthDate.label')}
bind:value={dateOfBirth}
required
/>
</UserSettingField>
</UserSettingSection>
@ -367,15 +379,15 @@
</section>
{#if $config?.features.enable_login_form && $config?.features.enable_password_change_form}
<UserSettingSection title={$i18n.t('Password')}>
<UserSettingSection title={$i18n.t('settings.personal.account.sections.password.title')}>
<UpdatePassword />
</UserSettingSection>
{/if}
{#if ($config?.features?.enable_api_keys ?? true) && ($user?.role === 'admin' || ($user?.permissions?.features?.api_keys ?? false))}
<UserSettingSection title={$i18n.t('API keys')}>
<UserSettingRow description={$i18n.t('Show or hide sensitive account secrets.')}>
<span slot="label">{$i18n.t('Secrets')}</span>
{#if canUseApiKeys({ user: $user, config: $config })}
<UserSettingSection title={$i18n.t('settings.personal.account.sections.apiKeys.title')}>
<UserSettingRow description={$i18n.t('settings.personal.account.secrets.description')}>
<span slot="label">{$i18n.t('settings.personal.account.secrets.label')}</span>
<button
class={actionButtonClass}
type="button"
@ -389,8 +401,8 @@
<div class="flex flex-col gap-2.5">
{#if $user?.role === 'admin'}
<UserSettingField
label={$i18n.t('JWT Token')}
description={$i18n.t('Copy the current session token for authenticated requests.')}
label={$i18n.t('settings.personal.account.jwtToken.label')}
description={$i18n.t('settings.personal.account.jwtToken.description')}
>
<div class="flex">
<SensitiveInput variant="settings" value={localStorage.token} readOnly={true} />
@ -443,10 +455,10 @@
</UserSettingField>
{/if}
{#if ($config?.features?.enable_api_keys ?? true) && ($user?.role === 'admin' || ($user?.permissions?.features?.api_keys ?? false))}
{#if canUseApiKeys({ user: $user, config: $config })}
<UserSettingField
label={$i18n.t('API Key')}
description={$i18n.t('Create, copy, or rotate your API key.')}
label={$i18n.t('settings.personal.account.apiKey.label')}
description={$i18n.t('settings.personal.account.apiKey.description')}
>
<div class="flex">
{#if APIKey}
@ -546,7 +558,7 @@
>
<Plus strokeWidth="2" className="size-3.5" />
{$i18n.t('Create new secret key')}</button
{$i18n.t('settings.personal.account.createNewSecretKey.label')}</button
>
{/if}
</div>
@ -561,18 +573,12 @@
<div class="shrink-0 flex w-full justify-end pt-3 text-sm font-normal">
<button
class="px-3.5 py-1.5 text-sm font-normal bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full"
on:click={async () => {
const res = await submitHandler();
if (res) {
saveHandler();
}
}}
type="submit"
>
{$i18n.t('Save')}
</button>
</div>
</div>
</form>
<ConfirmDialog
bind:show={showDeleteAPIKeyConfirm}

View file

@ -55,7 +55,9 @@
}}
>
<div class="flex items-center justify-between gap-2.5">
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Change Password')}</div>
<div class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('settings.personal.account.changePassword.label')}
</div>
<button
class={actionButtonClass}
type="button"
@ -65,14 +67,14 @@
>
</div>
<p class="mt-0.5 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t('Update the password used for email and password sign-in.')}
{$i18n.t('settings.personal.account.changePassword.description')}
</p>
{#if show}
<div class="py-2.5 space-y-2.5">
<div class="flex flex-col w-full">
<div class="mb-1 text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Current Password')}
{$i18n.t('settings.personal.account.currentPassword.label')}
</div>
<div class="flex-1">
@ -89,7 +91,7 @@
<div class="flex flex-col w-full">
<div class="mb-1 text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('New Password')}
{$i18n.t('settings.personal.account.newPassword.label')}
</div>
<div class="flex-1">
@ -106,7 +108,7 @@
<div class="flex flex-col w-full">
<div class="mb-1 text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Confirm Password')}
{$i18n.t('settings.personal.account.confirmPassword.label')}
</div>
<div class="flex-1">
@ -124,7 +126,7 @@
<div class="flex justify-end">
<button class={actionButtonClass}>
{$i18n.t('Update password')}
{$i18n.t('settings.personal.account.updatePassword.label')}
</button>
</div>
{/if}

View file

@ -113,15 +113,13 @@
>
<div>
<Tooltip
content={$i18n.t(
'When enabled, the model will respond to each chat message in real-time, generating a response as soon as the user sends a message. This mode is useful for live chat applications, but may impact performance on slower hardware.'
)}
content={$i18n.t('settings.personal.general.parameters.streamChatResponse.description')}
placement="top-start"
className="inline-tooltip"
>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Stream Chat Response')}
{$i18n.t('settings.personal.general.parameters.streamChatResponse.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition"
@ -150,15 +148,13 @@
{#if admin}
<div>
<Tooltip
content={$i18n.t(
'The stream delta chunk size for the model. Increasing the chunk size will make the model respond with larger pieces of text at once.'
)}
content={$i18n.t('settings.personal.general.parameters.streamDeltaChunkSize.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Stream Delta Chunk Size')}
{$i18n.t('settings.personal.general.parameters.streamDeltaChunkSize.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -180,7 +176,7 @@
{#if (params?.stream_delta_chunk_size ?? null) !== null}
{@render rangeParam(
'stream_delta_chunk_size',
$i18n.t('Stream Delta Chunk Size'),
$i18n.t('settings.personal.general.parameters.streamDeltaChunkSize.label'),
1,
128,
1,
@ -192,15 +188,13 @@
<div>
<Tooltip
content={$i18n.t(
'Set a model-specific context compaction token threshold. When set, this overrides the global threshold up to the global cap.'
)}
content={$i18n.t('settings.personal.general.parameters.contextCompactionThreshold.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Context Compaction Threshold')}
{$i18n.t('settings.personal.general.parameters.contextCompactionThreshold.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -225,7 +219,7 @@
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="number"
aria-label={$i18n.t('Context Compaction Threshold')}
aria-label={$i18n.t('settings.personal.general.parameters.contextCompactionThreshold.label')}
placeholder={$i18n.t('Enter token threshold')}
bind:value={params.compact_token_threshold}
autocomplete="off"
@ -240,15 +234,13 @@
<div>
<Tooltip
content={$i18n.t(
"Native mode (default) leverages the model's built-in tool-calling capabilities. Legacy mode works with a wider range of models by calling tools once before execution via prompt injection."
)}
content={$i18n.t('settings.personal.general.parameters.functionCalling.description')}
placement="top-start"
className="inline-tooltip"
>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Function Calling')}
{$i18n.t('settings.personal.general.parameters.functionCalling.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition"
@ -277,15 +269,13 @@
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(
'Enable, disable, or customize the reasoning tags used by the model. "Enabled" uses default tags, "Disabled" turns off reasoning tags, and "Custom" lets you specify your own start and end tags.'
)}
content={$i18n.t('settings.personal.general.parameters.reasoningTags.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Reasoning Tags')}
{$i18n.t('settings.personal.general.parameters.reasoningTags.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -344,15 +334,13 @@
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(
'Sets the random number seed to use for generation. Setting this to a specific number will make the model generate the same text for the same prompt.'
)}
content={$i18n.t('settings.personal.general.parameters.seed.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Seed')}
{$i18n.t('settings.personal.general.parameters.seed.label')}
</div>
<button
@ -377,7 +365,7 @@
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="number"
aria-label={$i18n.t('Seed')}
aria-label={$i18n.t('settings.personal.general.parameters.seed.label')}
placeholder={$i18n.t('Enter Seed')}
bind:value={params.seed}
autocomplete="off"
@ -390,15 +378,13 @@
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(
'Sets the stop sequences to use. When this pattern is encountered, the LLM will stop generating text and return. Multiple stop patterns may be set by specifying multiple separate stop parameters in a modelfile.'
)}
content={$i18n.t('settings.personal.general.parameters.stopSequence.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Stop Sequence')}
{$i18n.t('settings.personal.general.parameters.stopSequence.label')}
</div>
<button
@ -423,7 +409,7 @@
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="text"
aria-label={$i18n.t('Stop Sequence')}
aria-label={$i18n.t('settings.personal.general.parameters.stopSequence.label')}
placeholder={$i18n.t('Enter stop sequence')}
bind:value={params.stop}
autocomplete="off"
@ -435,15 +421,13 @@
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(
'The temperature of the model. Increasing the temperature will make the model answer more creatively.'
)}
content={$i18n.t('settings.personal.general.parameters.temperature.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Temperature')}
{$i18n.t('settings.personal.general.parameters.temperature.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -462,21 +446,25 @@
</Tooltip>
{#if (params?.temperature ?? null) !== null}
{@render rangeParam('temperature', $i18n.t('Temperature'), 0, 2, 0.05)}
{@render rangeParam(
'temperature',
$i18n.t('settings.personal.general.parameters.temperature.label'),
0,
2,
0.05
)}
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(
'Constrains effort on reasoning for reasoning models. Only applicable to reasoning models from specific providers that support reasoning effort.'
)}
content={$i18n.t('settings.personal.general.parameters.reasoningEffort.description')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{$i18n.t('Reasoning Effort')}
{$i18n.t('settings.personal.general.parameters.reasoningEffort.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -500,7 +488,7 @@
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="text"
aria-label={$i18n.t('Reasoning Effort')}
aria-label={$i18n.t('settings.personal.general.parameters.reasoningEffort.label')}
placeholder={$i18n.t('Enter reasoning effort')}
bind:value={params.reasoning_effort}
autocomplete="off"
@ -520,7 +508,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'logit_bias'}
{$i18n.t('settings.personal.general.parameters.logitBias.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -544,7 +532,7 @@
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="text"
aria-label="logit_bias"
aria-label={$i18n.t('settings.personal.general.parameters.logitBias.label')}
placeholder={$i18n.t(
'Enter comma-separated "token:bias_value" pairs (example: 5432:100, 413:-100)'
)}
@ -566,7 +554,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'max_tokens'}
{$i18n.t('settings.personal.general.parameters.maxTokens.label')}
</div>
<button
@ -586,7 +574,15 @@
</Tooltip>
{#if (params?.max_tokens ?? null) !== null}
{@render rangeParam('max_tokens', 'max_tokens', -2, 131072, 1, 1, undefined)}
{@render rangeParam(
'max_tokens',
$i18n.t('settings.personal.general.parameters.maxTokens.label'),
-2,
131072,
1,
1,
undefined
)}
{/if}
</div>
@ -600,7 +596,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'top_k'}
{$i18n.t('settings.personal.general.parameters.topK.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -623,7 +619,7 @@
<div class=" flex-1">
<input
type="range"
aria-label="top_k"
aria-label={$i18n.t('settings.personal.general.parameters.topK.label')}
min="0"
max="1000"
step="1"
@ -636,7 +632,7 @@
<input
value={params.top_k}
type="number"
aria-label="top_k"
aria-label={$i18n.t('settings.personal.general.parameters.topK.label')}
class=" bg-transparent text-center w-14"
min="0"
max="1000"
@ -658,7 +654,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'top_p'}
{$i18n.t('settings.personal.general.parameters.topP.label')}
</div>
<button
@ -678,7 +674,7 @@
</Tooltip>
{#if (params?.top_p ?? null) !== null}
{@render rangeParam('top_p', 'top_p', 0, 1, 0.05)}
{@render rangeParam('top_p', $i18n.t('settings.personal.general.parameters.topP.label'), 0, 1, 0.05)}
{/if}
</div>
@ -692,7 +688,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'min_p'}
{$i18n.t('settings.personal.general.parameters.minP.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -711,7 +707,7 @@
</Tooltip>
{#if (params?.min_p ?? null) !== null}
{@render rangeParam('min_p', 'min_p', 0, 1, 0.05)}
{@render rangeParam('min_p', $i18n.t('settings.personal.general.parameters.minP.label'), 0, 1, 0.05)}
{/if}
</div>
@ -725,7 +721,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'frequency_penalty'}
{$i18n.t('settings.personal.general.parameters.frequencyPenalty.label')}
</div>
<button
@ -745,7 +741,13 @@
</Tooltip>
{#if (params?.frequency_penalty ?? null) !== null}
{@render rangeParam('frequency_penalty', 'frequency_penalty', -2, 2, 0.05)}
{@render rangeParam(
'frequency_penalty',
$i18n.t('settings.personal.general.parameters.frequencyPenalty.label'),
-2,
2,
0.05
)}
{/if}
</div>
@ -759,7 +761,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'presence_penalty'}
{$i18n.t('settings.personal.general.parameters.presencePenalty.label')}
</div>
<button
@ -779,7 +781,13 @@
</Tooltip>
{#if (params?.presence_penalty ?? null) !== null}
{@render rangeParam('presence_penalty', 'presence_penalty', -2, 2, 0.05)}
{@render rangeParam(
'presence_penalty',
$i18n.t('settings.personal.general.parameters.presencePenalty.label'),
-2,
2,
0.05
)}
{/if}
</div>
@ -791,7 +799,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'mirostat'}
{$i18n.t('settings.personal.general.parameters.mirostat.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -810,7 +818,14 @@
</Tooltip>
{#if (params?.mirostat ?? null) !== null}
{@render rangeParam('mirostat', 'mirostat', 0, 2, 1, 1)}
{@render rangeParam(
'mirostat',
$i18n.t('settings.personal.general.parameters.mirostat.label'),
0,
2,
1,
1
)}
{/if}
</div>
@ -824,7 +839,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'mirostat_eta'}
{$i18n.t('settings.personal.general.parameters.mirostatEta.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -843,7 +858,13 @@
</Tooltip>
{#if (params?.mirostat_eta ?? null) !== null}
{@render rangeParam('mirostat_eta', 'mirostat_eta', 0, 1, 0.05)}
{@render rangeParam(
'mirostat_eta',
$i18n.t('settings.personal.general.parameters.mirostatEta.label'),
0,
1,
0.05
)}
{/if}
</div>
@ -857,7 +878,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'mirostat_tau'}
{$i18n.t('settings.personal.general.parameters.mirostatTau.label')}
</div>
<button
@ -877,7 +898,13 @@
</Tooltip>
{#if (params?.mirostat_tau ?? null) !== null}
{@render rangeParam('mirostat_tau', 'mirostat_tau', 0, 10, 0.5)}
{@render rangeParam(
'mirostat_tau',
$i18n.t('settings.personal.general.parameters.mirostatTau.label'),
0,
10,
0.5
)}
{/if}
</div>
@ -889,7 +916,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'repeat_last_n'}
{$i18n.t('settings.personal.general.parameters.repeatLastN.label')}
</div>
<button
@ -909,7 +936,14 @@
</Tooltip>
{#if (params?.repeat_last_n ?? null) !== null}
{@render rangeParam('repeat_last_n', 'repeat_last_n', -1, 128, 1, 1)}
{@render rangeParam(
'repeat_last_n',
$i18n.t('settings.personal.general.parameters.repeatLastN.label'),
-1,
128,
1,
1
)}
{/if}
</div>
@ -923,7 +957,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'tfs_z'}
{$i18n.t('settings.personal.general.parameters.tfsZ.label')}
</div>
<button
@ -943,7 +977,7 @@
</Tooltip>
{#if (params?.tfs_z ?? null) !== null}
{@render rangeParam('tfs_z', 'tfs_z', 0, 2, 0.05)}
{@render rangeParam('tfs_z', $i18n.t('settings.personal.general.parameters.tfsZ.label'), 0, 2, 0.05)}
{/if}
</div>
@ -957,7 +991,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'repeat_penalty'}
{$i18n.t('settings.personal.general.parameters.repeatPenalty.label')}
</div>
<button
@ -977,7 +1011,13 @@
</Tooltip>
{#if (params?.repeat_penalty ?? null) !== null}
{@render rangeParam('repeat_penalty', 'repeat_penalty', -2, 2, 0.05)}
{@render rangeParam(
'repeat_penalty',
$i18n.t('settings.personal.general.parameters.repeatPenalty.label'),
-2,
2,
0.05
)}
{/if}
</div>
@ -992,7 +1032,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'use_mmap'}
{$i18n.t('settings.personal.general.parameters.useMmap.label')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
@ -1016,7 +1056,10 @@
{params.use_mmap ? $i18n.t('Enabled') : $i18n.t('Disabled')}
</div>
<div class=" pr-2">
<Switch bind:state={params.use_mmap} ariaLabel="use_mmap" />
<Switch
bind:state={params.use_mmap}
ariaLabel={$i18n.t('settings.personal.general.parameters.useMmap.label')}
/>
</div>
</div>
{/if}
@ -1032,7 +1075,7 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'use_mlock'}
{$i18n.t('settings.personal.general.parameters.useMlock.label')}
</div>
<button
@ -1058,7 +1101,10 @@
</div>
<div class=" pr-2">
<Switch bind:state={params.use_mlock} ariaLabel="use_mlock" />
<Switch
bind:state={params.use_mlock}
ariaLabel={$i18n.t('settings.personal.general.parameters.useMlock.label')}
/>
</div>
</div>
{/if}
@ -1067,15 +1113,15 @@
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(
'This option enables or disables the use of the reasoning feature in Ollama, which allows the model to think before generating a response. When enabled, the model can take a moment to process the conversation context and generate a more thoughtful response.'
)}
content={$i18n.t('settings.personal.general.parameters.ollama.description')}
placement="top-start"
className="inline-tooltip"
>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">
{'think'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.think.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition"
@ -1111,7 +1157,7 @@
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="text"
aria-label={`think (${$i18n.t('Ollama')})`}
aria-label={`${$i18n.t('settings.personal.general.parameters.think.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`}
placeholder={$i18n.t("e.g. 'low', 'medium', 'high'")}
bind:value={params.think}
autocomplete="off"
@ -1129,7 +1175,9 @@
>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">
{'format'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.format.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition"
@ -1151,7 +1199,7 @@
<div class="flex mt-0.5 space-x-2">
<Textarea
className="w-full text-sm bg-transparent outline-hidden"
ariaLabel={`format (${$i18n.t('Ollama')})`}
ariaLabel={`${$i18n.t('settings.personal.general.parameters.format.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`}
placeholder={$i18n.t('e.g. "json" or a JSON schema')}
bind:value={params.format}
/>
@ -1169,7 +1217,9 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'num_keep'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.numKeep.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
@ -1191,7 +1241,7 @@
{#if (params?.num_keep ?? null) !== null}
{@render rangeParam(
'num_keep',
`num_keep (${$i18n.t('Ollama')})`,
`${$i18n.t('settings.personal.general.parameters.numKeep.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`,
-1,
10240000,
1,
@ -1209,7 +1259,9 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'num_ctx'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.numCtx.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
@ -1231,7 +1283,7 @@
{#if (params?.num_ctx ?? null) !== null}
{@render rangeParam(
'num_ctx',
`num_ctx (${$i18n.t('Ollama')})`,
`${$i18n.t('settings.personal.general.parameters.numCtx.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`,
-1,
10240000,
1,
@ -1251,7 +1303,9 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'num_batch'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.numBatch.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
@ -1273,7 +1327,7 @@
{#if (params?.num_batch ?? null) !== null}
{@render rangeParam(
'num_batch',
`num_batch (${$i18n.t('Ollama')})`,
`${$i18n.t('settings.personal.general.parameters.numBatch.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`,
256,
8192,
256,
@ -1294,7 +1348,9 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'num_thread'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.numThread.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
@ -1314,7 +1370,14 @@
</Tooltip>
{#if (params?.num_thread ?? null) !== null}
{@render rangeParam('num_thread', `num_thread (${$i18n.t('Ollama')})`, 1, 256, 1, 1)}
{@render rangeParam(
'num_thread',
`${$i18n.t('settings.personal.general.parameters.numThread.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`,
1,
256,
1,
1
)}
{/if}
</div>
@ -1328,7 +1391,9 @@
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs">
{'num_gpu'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.numGpu.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
@ -1348,7 +1413,14 @@
</Tooltip>
{#if (params?.num_gpu ?? null) !== null}
{@render rangeParam('num_gpu', `num_gpu (${$i18n.t('Ollama')})`, 0, 256, 1, 1)}
{@render rangeParam(
'num_gpu',
`${$i18n.t('settings.personal.general.parameters.numGpu.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`,
0,
256,
1,
1
)}
{/if}
</div>
@ -1362,7 +1434,9 @@
>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">
{'keep_alive'} ({$i18n.t('Ollama')})
{$i18n.t('settings.personal.general.parameters.keepAlive.label')} ({$i18n.t(
'settings.personal.general.parameters.ollama.label'
)})
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition"
@ -1385,7 +1459,7 @@
<input
class="w-full text-sm bg-transparent outline-hidden"
type="text"
aria-label={`keep_alive (${$i18n.t('Ollama')})`}
aria-label={`${$i18n.t('settings.personal.general.parameters.keepAlive.label')} (${$i18n.t('settings.personal.general.parameters.ollama.label')})`}
placeholder={$i18n.t("e.g. '30s','10m'. Valid time units are 's', 'm', 'h'.")}
bind:value={params.keep_alive}
/>

View file

@ -20,7 +20,7 @@
unarchiveAllChats
} from '$lib/apis/chats';
import { chatId, showSettings, user } from '$lib/stores';
import { refreshChatList } from '$lib/stores/chatList';
import { refreshChatList, refreshSidebar } from '$lib/stores/chatList';
import { formatNumber } from '$lib/utils';
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import Dropdown from '$lib/components/common/Dropdown.svelte';
@ -124,7 +124,7 @@
chatList = chatList?.filter((chat) => chat.id !== id) ?? null;
if (chatCount !== null) chatCount -= 1;
await refreshChatList(localStorage.token);
await refreshChatList(localStorage.token, { refreshPinned: true });
};
const deleteHandler = async () => {
@ -150,10 +150,11 @@
const unarchiveAllHandler = async () => {
loading = true;
try {
await unarchiveAllChats(localStorage.token);
const success = await unarchiveAllChats(localStorage.token);
if (!success) return;
toast.success($i18n.t('All chats have been unarchived.'));
await loadChats();
await refreshChatList(localStorage.token);
await refreshSidebar(localStorage.token);
} catch (error) {
toast.error(`${error}`);
} finally {
@ -174,7 +175,7 @@
<ConfirmDialog
bind:show={showUnarchiveAllConfirmDialog}
message={$i18n.t('Are you sure you want to unarchive all archived chats?')}
confirmLabel={$i18n.t('Unarchive All')}
confirmLabel={$i18n.t('settings.personal.archivedChats.unarchiveAll.label')}
on:confirm={() => {
unarchiveAllHandler();
}}
@ -183,7 +184,7 @@
<div id="tab-archived-chats" class="flex flex-col h-full text-sm">
<div class="mb-3 flex items-center justify-between">
<h2 class="text-sm font-medium text-gray-900 dark:text-white">
{$i18n.t('Archived Chats')}
{$i18n.t('settings.personal.archivedChats.title')}
{#if chatCount !== null}
<span class="ml-2 font-normal text-gray-500 dark:text-gray-500">
{formatNumber(chatCount)}
@ -246,7 +247,9 @@
{:else}
<UndoAction className="size-3.5 shrink-0" strokeWidth="1.5" />
{/if}
<div class="min-w-0 flex-1 truncate text-left">{$i18n.t('Unarchive All')}</div>
<div class="min-w-0 flex-1 truncate text-left">
{$i18n.t('settings.personal.archivedChats.unarchiveAll.label')}
</div>
</button>
<button
@ -256,7 +259,9 @@
on:click={exportChatsHandler}
>
<Download className="size-3.5 shrink-0" strokeWidth="1.5" />
<div class="min-w-0 flex-1 truncate text-left">{$i18n.t('Export')}</div>
<div class="min-w-0 flex-1 truncate text-left">
{$i18n.t('settings.personal.archivedChats.exportArchivedChats.label')}
</div>
</button>
</DropdownMenu>
</div>

View file

@ -181,18 +181,20 @@
dispatch('save');
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Audio')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.personal.audio.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<UserSettingSection title={$i18n.t('STT Settings')} first>
<UserSettingSection title={$i18n.t('settings.personal.audio.sections.sttSettings.title')} first>
{#if $config.audio.stt.engine !== 'web'}
<UserSettingRow
label={$i18n.t('Speech-to-Text Engine')}
description={$i18n.t('Choose the engine used to transcribe voice input.')}
label={$i18n.t('settings.personal.audio.speechToTextEngine.label')}
description={$i18n.t('settings.personal.audio.speechToTextEngine.description')}
>
<SettingsSelect
bind:value={STTEngine}
ariaLabel={$i18n.t('Speech-to-Text Engine')}
ariaLabel={$i18n.t('settings.personal.audio.speechToTextEngine.label')}
placeholder={$i18n.t('Select an engine')}
>
<option value="">{$i18n.t('Default')}</option>
@ -201,10 +203,8 @@
</UserSettingRow>
<UserSettingRow
label={$i18n.t('Language')}
description={$i18n.t(
'Set a speech recognition language or leave it blank to detect automatically.'
)}
label={$i18n.t('settings.personal.audio.language.label')}
description={$i18n.t('settings.personal.audio.language.description')}
>
<Tooltip
content={$i18n.t(
@ -224,14 +224,16 @@
{/if}
<UserSettingRow
label={$i18n.t('Instant Auto-Send After Voice Transcription')}
label={$i18n.t('settings.personal.audio.instantAutoSendAfterVoiceTranscription.label')}
description={$i18n.t(
'Send transcribed voice input immediately after speech recognition finishes.'
'settings.personal.audio.instantAutoSendAfterVoiceTranscription.description'
)}
>
<Switch
state={speechAutoSend}
ariaLabel={$i18n.t('Instant Auto-Send After Voice Transcription')}
ariaLabel={$i18n.t(
'settings.personal.audio.instantAutoSendAfterVoiceTranscription.label'
)}
on:change={(event) => {
setSpeechAutoSend(event.detail);
}}
@ -239,14 +241,14 @@
</UserSettingRow>
</UserSettingSection>
<UserSettingSection title={$i18n.t('TTS Settings')}>
<UserSettingSection title={$i18n.t('settings.personal.audio.sections.ttsSettings.title')}>
<UserSettingRow
label={$i18n.t('Text-to-Speech Engine')}
description={$i18n.t('Choose the engine used to read assistant responses aloud.')}
label={$i18n.t('settings.personal.audio.textToSpeechEngine.label')}
description={$i18n.t('settings.personal.audio.textToSpeechEngine.description')}
>
<SettingsSelect
bind:value={TTSEngine}
ariaLabel={$i18n.t('Text-to-Speech Engine')}
ariaLabel={$i18n.t('settings.personal.audio.textToSpeechEngine.label')}
placeholder={$i18n.t('Select an engine')}
>
<option value="">{$i18n.t('Default')}</option>
@ -256,12 +258,12 @@
{#if TTSEngine === 'browser-kokoro'}
<UserSettingRow
label={$i18n.t('Kokoro.js Dtype')}
description={$i18n.t('Select the local model precision used by Kokoro.js.')}
label={$i18n.t('settings.personal.audio.kokoroJsDtype.label')}
description={$i18n.t('settings.personal.audio.kokoroJsDtype.description')}
>
<SettingsSelect
bind:value={TTSEngineConfig.dtype}
ariaLabel={$i18n.t('Kokoro.js Dtype')}
ariaLabel={$i18n.t('settings.personal.audio.kokoroJsDtype.label')}
placeholder={$i18n.t('Select dtype')}
>
<option value="" disabled selected>{$i18n.t('Select dtype')}</option>
@ -274,12 +276,12 @@
{/if}
<UserSettingRow
label={$i18n.t('Auto-Playback Response')}
description={$i18n.t('Play assistant responses aloud automatically.')}
label={$i18n.t('settings.personal.audio.autoPlaybackResponse.label')}
description={$i18n.t('settings.personal.audio.autoPlaybackResponse.description')}
>
<Switch
state={responseAutoPlayback}
ariaLabel={$i18n.t('Auto-Playback Response')}
ariaLabel={$i18n.t('settings.personal.audio.autoPlaybackResponse.label')}
on:change={(event) => {
setResponseAutoPlayback(event.detail);
}}
@ -287,8 +289,8 @@
</UserSettingRow>
<UserSettingRow
label={$i18n.t('Speech Playback Speed')}
description={$i18n.t('Adjust how quickly spoken responses are played.')}
label={$i18n.t('settings.personal.audio.speechPlaybackSpeed.label')}
description={$i18n.t('settings.personal.audio.speechPlaybackSpeed.description')}
>
<div class="relative flex items-center gap-1.5 text-xs text-gray-400 dark:text-gray-600">
<input
@ -296,7 +298,7 @@
min="0"
step="0.01"
bind:value={playbackRate}
aria-label={$i18n.t('Speech Playback Speed')}
aria-label={$i18n.t('settings.personal.audio.speechPlaybackSpeed.label')}
class="h-7 w-16 rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 text-right text-xs text-gray-700 outline-hidden transition-colors focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
/>
x
@ -306,16 +308,16 @@
{#if TTSEngine === 'browser-kokoro'}
{#if TTSModel}
<UserSettingSection title={$i18n.t('Voice')}>
<UserSettingSection title={$i18n.t('settings.personal.audio.sections.voice.title')}>
<UserSettingField
label={$i18n.t('Set Voice')}
description={$i18n.t('Choose the Kokoro.js voice used for speech output.')}
label={$i18n.t('settings.personal.audio.kokoroVoice.label')}
description={$i18n.t('settings.personal.audio.kokoroVoice.description')}
>
<input
list="voice-list"
class={inputClass}
bind:value={voice}
aria-label={$i18n.t('Voice')}
aria-label={$i18n.t('settings.personal.audio.sections.voice.title')}
placeholder={$i18n.t('Select a voice')}
/>
@ -327,7 +329,7 @@
</UserSettingField>
</UserSettingSection>
{:else}
<UserSettingSection title={$i18n.t('Voice')}>
<UserSettingSection title={$i18n.t('settings.personal.audio.sections.voice.title')}>
<div class="flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400">
<Spinner className="size-4" />
@ -345,12 +347,16 @@
</UserSettingSection>
{/if}
{:else if $config.audio.tts.engine === ''}
<UserSettingSection title={$i18n.t('Voice')}>
<UserSettingSection title={$i18n.t('settings.personal.audio.sections.voice.title')}>
<UserSettingField
label={$i18n.t('Set Voice')}
description={$i18n.t('Choose the browser voice used for speech output.')}
label={$i18n.t('settings.personal.audio.browserVoice.label')}
description={$i18n.t('settings.personal.audio.browserVoice.description')}
>
<SettingsSelect bind:value={voice} className="w-full" ariaLabel={$i18n.t('Voice')}>
<SettingsSelect
bind:value={voice}
className="w-full"
ariaLabel={$i18n.t('settings.personal.audio.sections.voice.title')}
>
<option value="" selected={voice !== ''}>{$i18n.t('Default')}</option>
{#each voices.filter((v) => nonLocalVoices || v.localService === true) as _voice}
<option
@ -362,23 +368,23 @@
</SettingsSelect>
</UserSettingField>
<UserSettingRow
label={$i18n.t('Allow non-local voices')}
description={$i18n.t('Include voices that are not provided by a local speech service.')}
label={$i18n.t('settings.personal.audio.allowNonLocalVoices.label')}
description={$i18n.t('settings.personal.audio.allowNonLocalVoices.description')}
>
<Switch bind:state={nonLocalVoices} />
</UserSettingRow>
</UserSettingSection>
{:else if $config.audio.tts.engine !== ''}
<UserSettingSection title={$i18n.t('Voice')}>
<UserSettingSection title={$i18n.t('settings.personal.audio.sections.voice.title')}>
<UserSettingField
label={$i18n.t('Set Voice')}
description={$i18n.t('Choose the configured text-to-speech service voice.')}
label={$i18n.t('settings.personal.audio.serviceVoice.label')}
description={$i18n.t('settings.personal.audio.serviceVoice.description')}
>
<input
list="voice-list"
class={inputClass}
bind:value={voice}
aria-label={$i18n.t('Voice')}
aria-label={$i18n.t('settings.personal.audio.sections.voice.title')}
placeholder={$i18n.t('Select a voice')}
/>

View file

@ -72,7 +72,9 @@
updateHandler();
}}
>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Connections')}</h2>
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('settings.personal.connections.title')}
</h2>
<div class="flex flex-1 min-h-0 flex-col overflow-y-auto scrollbar-hover pr-1.5">
{#if config !== null}
@ -80,17 +82,17 @@
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<h3 id="direct-connections-heading" class="text-xs text-gray-600 dark:text-gray-400">
{$i18n.t('Direct Connections')}
{$i18n.t('settings.personal.connections.sections.directConnections.title')}
</h3>
<p class="mt-1 text-[0.6875rem] leading-relaxed text-gray-400 dark:text-gray-600">
{$i18n.t('Connect to your own OpenAI compatible API endpoints.')}
{$i18n.t('settings.personal.connections.addConnection.description')}
</p>
</div>
<Tooltip content={$i18n.t(`Add Connection`)}>
<Tooltip content={$i18n.t('settings.personal.connections.addConnection.label')}>
<button
class="flex size-7 shrink-0 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-900 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-white"
aria-label={$i18n.t('Add Connection')}
aria-label={$i18n.t('settings.personal.connections.addConnection.label')}
on:click={() => {
showConnectionModal = true;
}}

View file

@ -1,9 +1,10 @@
<script lang="ts">
import { canManageChats } from '$lib/utils/settings-access';
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { user } from '$lib/stores';
import { refreshChatList } from '$lib/stores/chatList';
import { refreshSidebar } from '$lib/stores/chatList';
import { archiveAllChats, deleteAllChats, getAllChats, importChats } from '$lib/apis/chats';
import { getImportOrigin, convertOpenAIChats } from '$lib/utils';
@ -62,7 +63,9 @@
return {
chat: chat.chat,
meta: chat.meta ?? {},
pinned: false,
variables: chat?.variables ?? {},
pinned: chat?.pinned ?? false,
archived: chat?.archived ?? false,
folder_id: chat?.folder_id ?? null,
created_at: chat?.created_at ?? null,
updated_at: chat?.updated_at ?? null
@ -84,7 +87,7 @@
toast.success(`Successfully imported ${res.length} chats.`);
}
await refreshChatList(localStorage.token, { refreshPinned: true });
await refreshSidebar(localStorage.token);
};
const exportChats = async () => {
@ -96,20 +99,22 @@
const archiveAllChatsHandler = async () => {
await goto('/');
await archiveAllChats(localStorage.token).catch((error) => {
const success = await archiveAllChats(localStorage.token).catch((error) => {
toast.error(`${error}`);
});
if (!success) return;
await refreshChatList(localStorage.token, { clearPinned: true });
await refreshSidebar(localStorage.token);
};
const deleteAllChatsHandler = async () => {
await goto('/');
await deleteAllChats(localStorage.token).catch((error) => {
const success = await deleteAllChats(localStorage.token).catch((error) => {
toast.error(`${error}`);
});
if (!success) return;
await refreshChatList(localStorage.token);
await refreshSidebar(localStorage.token);
};
</script>
@ -117,7 +122,7 @@
<FilesModal bind:show={showFilesModal} />
<ConfirmDialog
title={$i18n.t('Archive All Chats')}
title={$i18n.t('settings.personal.dataControls.archiveAllChats.label')}
message={$i18n.t('Are you sure you want to archive all chats? This action cannot be undone.')}
bind:show={showArchiveConfirmDialog}
on:confirm={archiveAllChatsHandler}
@ -127,7 +132,7 @@
/>
<ConfirmDialog
title={$i18n.t('Delete All Chats')}
title={$i18n.t('settings.personal.dataControls.deleteAllChats.label')}
message={$i18n.t('Are you sure you want to delete all chats? This action cannot be undone.')}
bind:show={showDeleteConfirmDialog}
on:confirm={deleteAllChatsHandler}
@ -138,7 +143,7 @@
<div id="tab-chats" class="flex flex-col h-full text-sm">
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">
{$i18n.t('Data Controls')}
{$i18n.t('settings.personal.dataControls.title')}
</h2>
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
@ -151,11 +156,14 @@
hidden
/>
<UserSettingSection title={$i18n.t('Chats')} first>
{#if $user?.role === 'admin' || ($user.permissions?.chat?.import ?? true)}
<UserSettingSection
title={$i18n.t('settings.personal.dataControls.sections.chats.title')}
first
>
{#if canManageChats({ user: $user, config: null }, 'import')}
<UserSettingRow
label={$i18n.t('Import Chats')}
description={$i18n.t('Import chat history from a JSON export file.')}
label={$i18n.t('settings.personal.dataControls.importChats.label')}
description={$i18n.t('settings.personal.dataControls.importChats.description')}
>
<button
class={actionButtonClass}
@ -169,10 +177,10 @@
</UserSettingRow>
{/if}
{#if $user?.role === 'admin' || ($user.permissions?.chat?.export ?? true)}
{#if canManageChats({ user: $user, config: null }, 'export')}
<UserSettingRow
label={$i18n.t('Export Chats')}
description={$i18n.t('Download your chat history as a JSON export.')}
label={$i18n.t('settings.personal.dataControls.exportChats.label')}
description={$i18n.t('settings.personal.dataControls.exportChats.description')}
>
<button
class={actionButtonClass}
@ -187,8 +195,8 @@
{/if}
<UserSettingRow
label={$i18n.t('Shared Chats')}
description={$i18n.t('Review and manage chats you have shared.')}
label={$i18n.t('settings.personal.dataControls.sharedChats.label')}
description={$i18n.t('settings.personal.dataControls.sharedChats.description')}
>
<button
class={actionButtonClass}
@ -202,8 +210,8 @@
</UserSettingRow>
<UserSettingRow
label={$i18n.t('Archive All Chats')}
description={$i18n.t('Move every chat into the archive after confirmation.')}
label={$i18n.t('settings.personal.dataControls.archiveAllChats.label')}
description={$i18n.t('settings.personal.dataControls.archiveAllChats.description')}
>
<button
class={actionButtonClass}
@ -212,14 +220,14 @@
}}
type="button"
>
{$i18n.t('Archive All')}
{$i18n.t('settings.personal.dataControls.archiveAll.label')}
</button>
</UserSettingRow>
{#if $user?.role === 'admin' || ($user?.permissions?.chat?.delete ?? true)}
{#if canManageChats({ user: $user, config: null }, 'delete')}
<UserSettingRow
label={$i18n.t('Delete All Chats')}
description={$i18n.t('Permanently delete every chat after confirmation.')}
label={$i18n.t('settings.personal.dataControls.deleteAllChats.label')}
description={$i18n.t('settings.personal.dataControls.deleteAllChats.description')}
>
<button
class={actionButtonClass}
@ -234,10 +242,10 @@
{/if}
</UserSettingSection>
<UserSettingSection title={$i18n.t('Files')}>
<UserSettingSection title={$i18n.t('settings.personal.dataControls.sections.files.title')}>
<UserSettingRow
label={$i18n.t('Manage Files')}
description={$i18n.t('Open the file manager for uploaded files.')}
label={$i18n.t('settings.personal.dataControls.manageFiles.label')}
description={$i18n.t('settings.personal.dataControls.manageFiles.description')}
>
<button
class={actionButtonClass}

Some files were not shown because too many files have changed in this diff Show more