mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-26 13:34:38 +02:00
chore: update dependencies and mana-llm improvements
- Update pnpm-lock.yaml with matrix bot dependencies - Add environment variables to generate-env.mjs - Improve mana-llm config and ollama provider Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
df47dafeb5
commit
3edbd0cb26
7 changed files with 203 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ class Settings(BaseSettings):
|
|||
cache_ttl: int = 3600
|
||||
|
||||
# CORS
|
||||
cors_origins: str = "http://localhost:5173,https://mana.how"
|
||||
cors_origins: str = "http://localhost:5173,http://localhost:5190,https://mana.how"
|
||||
|
||||
@property
|
||||
def cors_origins_list(self) -> list[str]:
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ async def get_model(model_id: str) -> ModelInfo:
|
|||
|
||||
|
||||
# Chat completions endpoint
|
||||
@app.post("/v1/chat/completions")
|
||||
@app.post("/v1/chat/completions", response_model=None)
|
||||
async def chat_completions(
|
||||
request: ChatCompletionRequest,
|
||||
http_request: Request,
|
||||
|
|
|
|||
|
|
@ -4,9 +4,14 @@ from .requests import ChatCompletionRequest, EmbeddingRequest
|
|||
from .responses import (
|
||||
ChatCompletionResponse,
|
||||
ChatCompletionStreamResponse,
|
||||
Choice,
|
||||
DeltaContent,
|
||||
EmbeddingData,
|
||||
EmbeddingResponse,
|
||||
MessageResponse,
|
||||
ModelInfo,
|
||||
ModelsResponse,
|
||||
StreamChoice,
|
||||
Usage,
|
||||
)
|
||||
|
||||
|
|
@ -14,9 +19,14 @@ __all__ = [
|
|||
"ChatCompletionRequest",
|
||||
"ChatCompletionResponse",
|
||||
"ChatCompletionStreamResponse",
|
||||
"Choice",
|
||||
"DeltaContent",
|
||||
"EmbeddingData",
|
||||
"EmbeddingRequest",
|
||||
"EmbeddingResponse",
|
||||
"MessageResponse",
|
||||
"ModelInfo",
|
||||
"ModelsResponse",
|
||||
"StreamChoice",
|
||||
"Usage",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -220,11 +220,21 @@ class OllamaProvider(LLMProvider):
|
|||
models = []
|
||||
for model_data in data.get("models", []):
|
||||
name = model_data.get("name", "")
|
||||
# Parse modified_at datetime string to Unix timestamp
|
||||
created = None
|
||||
if modified_at := model_data.get("modified_at"):
|
||||
try:
|
||||
from datetime import datetime
|
||||
# Handle ISO format with timezone
|
||||
dt = datetime.fromisoformat(modified_at.replace("Z", "+00:00"))
|
||||
created = int(dt.timestamp())
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
models.append(
|
||||
ModelInfo(
|
||||
id=f"ollama/{name}",
|
||||
owned_by="ollama",
|
||||
created=int(model_data.get("modified_at", 0)) or None,
|
||||
created=created,
|
||||
)
|
||||
)
|
||||
return models
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue