Add AI functionality; fuck up UI royally, still a piece of shit.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@@ -41,3 +43,43 @@ class CrawlRequest(BaseModel):
|
||||
max_depth: int = Field(default=2, ge=0, le=5)
|
||||
max_pages_per_domain: int = Field(default=50, ge=1, le=500)
|
||||
same_domain_only: bool = True
|
||||
|
||||
|
||||
class AIMessage(BaseModel):
|
||||
role: Literal["system", "user", "assistant", "tool"]
|
||||
content: str = ""
|
||||
thinking: str | None = None
|
||||
tool_name: str | None = None
|
||||
tool_calls: list[dict[str, Any]] | None = None
|
||||
|
||||
|
||||
class AIChatRequest(BaseModel):
|
||||
model: str | None = None
|
||||
messages: list[AIMessage] = Field(min_length=1)
|
||||
think: bool | str | None = None
|
||||
use_web_search: bool = False
|
||||
web_result_limit: int = Field(default=5, ge=1, le=10)
|
||||
|
||||
|
||||
class AISearchRequest(BaseModel):
|
||||
query: str = Field(min_length=1)
|
||||
model: str | None = None
|
||||
include_web: bool = True
|
||||
local_result_limit: int = Field(default=5, ge=1, le=10)
|
||||
web_result_limit: int = Field(default=5, ge=1, le=10)
|
||||
think: bool | str | None = None
|
||||
|
||||
|
||||
class AISource(BaseModel):
|
||||
title: str
|
||||
url: str
|
||||
source_type: Literal["local", "web"]
|
||||
content: str = ""
|
||||
|
||||
|
||||
class AIAnswerResponse(BaseModel):
|
||||
model: str
|
||||
content: str
|
||||
thinking: str | None = None
|
||||
sources: list[AISource] = Field(default_factory=list)
|
||||
configured: bool = True
|
||||
|
||||
Reference in New Issue
Block a user