refactor: remove dead assistant_chat system, consolidate image helpers
The old /assistant/chats/* CRUD endpoints and assistant_chat_service
chat functions were unused — the frontend exclusively uses
/ai-sessions/{id}/chat (unified_chat_service) for all chat operations.
Removed:
- Chat CRUD endpoints (create, list, get, send, delete, conclude)
- assistant_chat_service: create_chat, send_message,
generate_conclusion_summary, CONCLUSION_SYSTEM_PROMPT
- Frontend: assistantChatApi chat methods, dead types
(AssistantChat, AssistantChatMessage, ConcludeChatRequest, etc.)
Kept:
- /assistant/retention endpoints (used by ChatRetentionSettingsPage)
- Shared AI infrastructure (_call_ai, _call_anthropic_cached,
ASSISTANT_SYSTEM_PROMPT, _auto_title) — imported by unified_chat_service
Moved:
- fetch_upload_images + resize_image_for_vision → storage_service.py
(shared location, not tied to dead endpoint)
Also added "Image Analysis" section to system prompt so Claude knows
to describe attached screenshots.
-650 lines of dead code removed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,54 +1,11 @@
|
||||
"""Pydantic schemas for standalone AI assistant chat."""
|
||||
from typing import Optional, Any, Literal
|
||||
from uuid import UUID
|
||||
from datetime import datetime
|
||||
"""Pydantic schemas for chat retention settings.
|
||||
|
||||
Chat CRUD schemas were removed — the active chat system uses
|
||||
schemas from ai_session.py via the /ai-sessions endpoints.
|
||||
"""
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from app.schemas.copilot import SuggestedFlow
|
||||
|
||||
|
||||
class ChatCreateRequest(BaseModel):
|
||||
"""Empty body — creates a new blank conversation."""
|
||||
pass
|
||||
|
||||
|
||||
class ChatMessageRequest(BaseModel):
|
||||
message: str = Field(..., min_length=1, max_length=8000)
|
||||
upload_ids: list[UUID] = Field(default_factory=list, max_length=10)
|
||||
|
||||
|
||||
class ChatMessageResponse(BaseModel):
|
||||
content: str
|
||||
suggested_flows: list[SuggestedFlow] = []
|
||||
|
||||
|
||||
class ChatListResponse(BaseModel):
|
||||
id: UUID
|
||||
title: str
|
||||
message_count: int
|
||||
pinned: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ChatDetailResponse(BaseModel):
|
||||
id: UUID
|
||||
title: str
|
||||
messages: list[dict[str, Any]]
|
||||
message_count: int
|
||||
pinned: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ChatUpdateRequest(BaseModel):
|
||||
title: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
pinned: Optional[bool] = None
|
||||
|
||||
|
||||
class RetentionSettingsResponse(BaseModel):
|
||||
chat_retention_days: Optional[int]
|
||||
@@ -58,14 +15,3 @@ class RetentionSettingsResponse(BaseModel):
|
||||
class RetentionSettingsUpdate(BaseModel):
|
||||
chat_retention_days: Optional[int] = Field(None, ge=1, le=365)
|
||||
chat_retention_max_count: Optional[int] = Field(None, ge=10, le=10000)
|
||||
|
||||
|
||||
class ConcludeChatRequest(BaseModel):
|
||||
outcome: Literal["resolved", "escalated", "paused"]
|
||||
notes: Optional[str] = Field(None, max_length=2000)
|
||||
|
||||
|
||||
class ConcludeChatResponse(BaseModel):
|
||||
summary: str
|
||||
outcome: str
|
||||
concluded_at: datetime
|
||||
|
||||
Reference in New Issue
Block a user