862e6b7b25
Co-authored-by: Cursor <cursoragent@cursor.com>
139 lines
2.9 KiB
Python
139 lines
2.9 KiB
Python
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
from pydantic.alias_generators import to_camel
|
|
|
|
|
|
class CamelModel(BaseModel):
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel,
|
|
populate_by_name=True,
|
|
serialize_by_alias=True,
|
|
)
|
|
|
|
|
|
class Source(CamelModel):
|
|
title: str
|
|
url: Optional[str] = None
|
|
|
|
|
|
class ColleagueCase(CamelModel):
|
|
summary: str
|
|
outcome: str
|
|
|
|
|
|
class TicketDraft(CamelModel):
|
|
title: str
|
|
description: str
|
|
system: str
|
|
priority: str
|
|
|
|
|
|
class ResponsePackage(CamelModel):
|
|
recommendation: str = ""
|
|
steps: list[str] = Field(default_factory=list)
|
|
sources: list[Source] = Field(default_factory=list)
|
|
colleague_cases: Optional[list[ColleagueCase]] = None
|
|
warning: Optional[str] = None
|
|
why_suggested: Optional[str] = None
|
|
ticket_draft: Optional[TicketDraft] = None
|
|
confidence: float = 0
|
|
system: Optional[str] = None
|
|
|
|
|
|
class AssistantResult(CamelModel):
|
|
text: str
|
|
package: Optional[ResponsePackage] = None
|
|
is_simple: bool = False
|
|
needs_clarification: bool = False
|
|
create_ticket: bool = False
|
|
|
|
|
|
class ConversationTurn(CamelModel):
|
|
role: Literal["user", "assistant"]
|
|
text: str
|
|
|
|
|
|
class ChatRequest(CamelModel):
|
|
message: str
|
|
is_first_message: bool = False
|
|
conversation: list[ConversationTurn] = Field(default_factory=list)
|
|
|
|
|
|
class FeedbackRequest(CamelModel):
|
|
message_id: str
|
|
helped: bool
|
|
query: str = ""
|
|
system: Optional[str] = None
|
|
confidence: float = 0
|
|
|
|
|
|
class AnalyticsSummary(CamelModel):
|
|
total_feedback: int
|
|
helped_count: int
|
|
not_helped_count: int
|
|
deflection_rate: float
|
|
|
|
|
|
class NotificationItem(CamelModel):
|
|
id: str
|
|
title: str
|
|
text: str
|
|
created_at: str
|
|
read: bool = False
|
|
link_tab: Optional[Literal["vitrina", "appeals", "catalog"]] = None
|
|
|
|
|
|
class UserProfile(CamelModel):
|
|
first_name: str
|
|
patronymic: str
|
|
last_name: str
|
|
position: str
|
|
department: str
|
|
|
|
|
|
class AppealComment(CamelModel):
|
|
id: str
|
|
author: str
|
|
text: str
|
|
date: str
|
|
is_support: bool
|
|
|
|
|
|
AppealStatus = Literal["new", "in_progress", "waiting", "resolved", "closed"]
|
|
AppealPriority = Literal["critical", "high", "medium", "low"]
|
|
|
|
|
|
class Appeal(CamelModel):
|
|
id: str
|
|
number: str
|
|
title: str
|
|
system: str
|
|
status: AppealStatus
|
|
status_label: str
|
|
next_step: str
|
|
priority: AppealPriority
|
|
priority_label: str
|
|
created_at: str
|
|
updated_at: str
|
|
assignee: Optional[str] = None
|
|
description: str
|
|
resolution: Optional[str] = None
|
|
comments: list[AppealComment] = Field(default_factory=list)
|
|
|
|
|
|
class CreateAppealRequest(CamelModel):
|
|
title: str
|
|
description: str
|
|
system: str
|
|
priority: str = "Средний"
|
|
|
|
|
|
class ServiceItem(CamelModel):
|
|
id: str
|
|
title: str
|
|
category: str
|
|
system: str
|
|
description: str
|
|
sla: str
|