[add] README.md [add] backend/libraries/punk/library.json [add] backend/libraries/punk/stage/19f1e5d2ceaab5fd1f1dc58ff07422388f156610d16dfdea2bdb35a5b9e70813--GeorgeJordac-TheVoiceOfHumanJustice.pdf [add] backend/libraries/punk/stage/85fce554ff7685f7bccb136aff5768e54b9ba8361672fe45dbce599598c4be4b--4_Strings_-_Take_Me_Away_Into_The_Night_Vocal_Radio_Mix_.mp3 [add] backend/libraries/punk/stage/e816ca61aebd84159747d248fedd6d5ff318c471c36bcc31b1ac6bf9aebcd3c1--The_Evolution_of_Cooperation_Robert_Axelrod_liber3.pdf [add] backend/local_rag.py [add] backend/rag/__init__.py [add] backend/rag/corpus_builder.py [add] backend/rag/corpus_enricher.py [add] backend/rag/index_builder.py [add] backend/rag/unified_rag.py [add] dist/assets/index-Cc0DLWqA.css [add] dist/assets/index-DKAz6gtp.js [add] dist/index.html [add] src/LibraryManager.jsx [add] wheelcheck2117/pydantic-2.11.7-py3-none-any.whl [add] wheelcheck274/pydantic-2.7.4-py3-none-any.whl [change] backend/main.py [change] backend/requirements.txt [change] backend/schemas.py [change] electron/main.cjs [change] electron/preload.cjs [change] package.json [change] run.sh [change] src/App.jsx [change] src/InterfaceSettings.jsx [change] src/colorSchemes.js [change] src/main.jsx [change] src/styles.css
70 lines
1.6 KiB
Python
70 lines
1.6 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
from typing import List, Optional
|
|
from datetime import datetime
|
|
|
|
class Message(BaseModel):
|
|
role: str
|
|
content: str
|
|
sources: Optional[List[str]] = None
|
|
|
|
class ChatRequest(BaseModel):
|
|
session_id: str
|
|
model: str
|
|
message: str
|
|
enriched_message: Optional[str] = None
|
|
stream: Optional[bool] = False
|
|
sources: Optional[List[str]] = None
|
|
|
|
class ChatResponse(BaseModel):
|
|
reply: str
|
|
|
|
class HistoryResponse(BaseModel):
|
|
messages: List[Message]
|
|
|
|
class GenerateTitleRequest(BaseModel):
|
|
session_id: str
|
|
message: str
|
|
model: str
|
|
|
|
class GenerateTitleResponse(BaseModel):
|
|
title: str
|
|
|
|
class CreateSessionRequest(BaseModel):
|
|
session_id: str
|
|
|
|
class ChatSession(BaseModel):
|
|
id: int
|
|
session_id: str
|
|
name: str
|
|
created_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
class SessionsResponse(BaseModel):
|
|
sessions: List[ChatSession]
|
|
|
|
class EditMessageRequest(BaseModel):
|
|
message: str
|
|
|
|
class RegenerateRequest(BaseModel):
|
|
index: int
|
|
model: Optional[str] = None
|
|
enriched_message: Optional[str] = None
|
|
stream: bool = True
|
|
sources: Optional[List[str]] = None
|
|
|
|
# Request payload for the web search enrichment endpoint.
|
|
class WebSearchRequest(BaseModel):
|
|
prompt: str
|
|
model: str
|
|
messages: Optional[List[Message]] = None
|
|
history_limit: Optional[int] = 8
|
|
searx_url: Optional[str] = None
|
|
engines: Optional[List[str]] = None
|
|
|
|
# Response payload for the web search enrichment endpoint.
|
|
class WebSearchResponse(BaseModel):
|
|
enriched_prompt: str
|
|
sources: List[str] = []
|
|
context_block: str = ""
|