修复插件注册中由于引用导致的重复
This commit is contained in:
@@ -1,95 +1,14 @@
|
||||
"""数据模型定义"""
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Dict, Any, List
|
||||
from typing import *
|
||||
|
||||
|
||||
class CallbackRequest(BaseModel):
|
||||
"""WPS Callback请求模型"""
|
||||
chatid: int = Field(..., description="会话ID")
|
||||
creator: int = Field(..., description="发送者ID")
|
||||
content: str = Field(..., description="消息内容")
|
||||
reply: Optional[Dict[str, Any]] = Field(None, description="回复内容")
|
||||
robot_key: str = Field(..., description="机器人key")
|
||||
url: str = Field(..., description="callback地址")
|
||||
ctime: int = Field(..., description="发送时间")
|
||||
|
||||
|
||||
class TextMessage(BaseModel):
|
||||
"""文本消息"""
|
||||
msgtype: str = "text"
|
||||
text: Dict[str, str]
|
||||
|
||||
@classmethod
|
||||
def create(cls, content: str):
|
||||
"""创建文本消息"""
|
||||
return cls(text={"content": content})
|
||||
|
||||
|
||||
class MarkdownMessage(BaseModel):
|
||||
"""Markdown消息"""
|
||||
msgtype: str = "markdown"
|
||||
markdown: Dict[str, str]
|
||||
|
||||
@classmethod
|
||||
def create(cls, text: str):
|
||||
"""创建Markdown消息"""
|
||||
return cls(markdown={"text": text})
|
||||
|
||||
|
||||
class LinkMessage(BaseModel):
|
||||
"""链接消息"""
|
||||
msgtype: str = "link"
|
||||
link: Dict[str, str]
|
||||
|
||||
@classmethod
|
||||
def create(cls, title: str, text: str, message_url: str = "", btn_title: str = "查看详情"):
|
||||
"""创建链接消息"""
|
||||
return cls(link={
|
||||
"title": title,
|
||||
"text": text,
|
||||
"messageUrl": message_url,
|
||||
"btnTitle": btn_title
|
||||
})
|
||||
|
||||
|
||||
class GameState(BaseModel):
|
||||
"""游戏状态基类"""
|
||||
game_type: str
|
||||
created_at: int
|
||||
updated_at: int
|
||||
|
||||
|
||||
class GuessGameState(GameState):
|
||||
"""猜数字游戏状态"""
|
||||
game_type: str = "guess"
|
||||
target: int = Field(..., description="目标数字")
|
||||
attempts: int = Field(0, description="尝试次数")
|
||||
guesses: list[int] = Field(default_factory=list, description="历史猜测")
|
||||
max_attempts: int = Field(10, description="最大尝试次数")
|
||||
|
||||
|
||||
class QuizGameState(GameState):
|
||||
"""问答游戏状态"""
|
||||
game_type: str = "quiz"
|
||||
question_id: int = Field(..., description="问题ID")
|
||||
question: str = Field(..., description="问题内容")
|
||||
attempts: int = Field(0, description="尝试次数")
|
||||
max_attempts: int = Field(3, description="最大尝试次数")
|
||||
|
||||
|
||||
class PrivateMessageRequest(BaseModel):
|
||||
"""私聊消息请求模型"""
|
||||
user_id: int = Field(..., description="目标用户ID")
|
||||
content: str = Field(..., description="消息内容")
|
||||
msg_type: str = Field(default="text", description="消息类型: text 或 markdown")
|
||||
|
||||
|
||||
class CheckBatchRequest(BaseModel):
|
||||
"""批量检查请求模型"""
|
||||
user_ids: List[int] = Field(..., description="用户ID列表")
|
||||
|
||||
|
||||
class CheckBatchResponse(BaseModel):
|
||||
"""批量检查响应模型"""
|
||||
results: Dict[int, bool] = Field(..., description="用户ID到是否有URL的映射")
|
||||
|
||||
"""Callback请求模型"""
|
||||
chatid: int = Field(default=0, description="会话ID")
|
||||
creator: int = Field(default=0, description="发送者ID")
|
||||
content: str = Field(default="", description="消息内容")
|
||||
reply: Dict[str, Any] = Field(default={}, description="回复内容")
|
||||
robot_key: str = Field(default="", description="机器人key")
|
||||
url: str = Field(default="", description="callback地址")
|
||||
ctime: int = Field(default=0, description="发送时间")
|
||||
|
||||
Reference in New Issue
Block a user