mirror of
https://github.com/ParisNeo/lollms_hub.git
synced 2026-05-04 03:01:01 -04:00
This commit updates several components related to server management, data store handling, and bot manager permissions. Specifically, it includes: - Updates to routing definitions in `datastores.py` and `proxy.py`. - Adjustments to permission handling in `bot_manager.py`. - Modifications to server CRUD operations in `server_crud.py`. - Schema updates in `server.py`. - Updates to admin template views (`manage_datastore.html`, `servers.html`).
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
from pydantic import BaseModel, AnyHttpUrl, Field, ConfigDict
|
|
import datetime
|
|
from typing import Literal, Optional, List
|
|
|
|
class ServerBase(BaseModel):
|
|
name: str
|
|
url: Optional[AnyHttpUrl] = None
|
|
server_type: Literal["ollama", "vllm", "cloud", "novita", "openllm", "open_webui", "openrouter"] = "ollama"
|
|
max_parallel_queries: int = Field(default=1, ge=1)
|
|
|
|
class ServerCreate(ServerBase):
|
|
url: Optional[AnyHttpUrl] = None # Explicitly optional for local Ollama
|
|
api_key: Optional[str] = Field(None, description="Optional API key for connecting to the server.")
|
|
|
|
class ServerUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
url: Optional[AnyHttpUrl] = None
|
|
server_type: Optional[Literal["ollama", "vllm", "cloud", "novita", "openllm", "open_webui"]] = None
|
|
api_key: Optional[str] = Field(None, description="Provide a new key to update, or an empty string to remove.")
|
|
allowed_models: Optional[List[str]] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class Server(ServerBase):
|
|
id: int
|
|
is_active: bool
|
|
has_api_key: bool = False
|
|
created_at: datetime.datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True, protected_namespaces=())
|