2025-07-11 13:50:08 +08:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
提示词API模型定义
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from typing import List, Dict, Any, Optional
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StyleRequest(BaseModel):
|
|
|
|
|
|
"""风格请求模型"""
|
|
|
|
|
|
name: str = Field(..., description="风格名称")
|
|
|
|
|
|
description: Optional[str] = Field(None, description="风格描述,如果为空则表示获取")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"name": "攻略风",
|
|
|
|
|
|
"description": "详细的旅行攻略信息,包含行程安排、交通指南、住宿推荐等实用信息,语言平实靠谱"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StyleResponse(BaseModel):
|
|
|
|
|
|
"""风格响应模型"""
|
|
|
|
|
|
name: str = Field(..., description="风格名称")
|
|
|
|
|
|
description: str = Field(..., description="风格描述")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"name": "攻略风",
|
|
|
|
|
|
"description": "详细的旅行攻略信息,包含行程安排、交通指南、住宿推荐等实用信息,语言平实靠谱"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AudienceRequest(BaseModel):
|
|
|
|
|
|
"""受众请求模型"""
|
|
|
|
|
|
name: str = Field(..., description="受众名称")
|
|
|
|
|
|
description: Optional[str] = Field(None, description="受众描述,如果为空则表示获取")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"name": "亲子向",
|
|
|
|
|
|
"description": "25-45岁家长群体,孩子年龄3-12岁,注重安全和教育意义,偏好收藏实用攻略"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AudienceResponse(BaseModel):
|
|
|
|
|
|
"""受众响应模型"""
|
|
|
|
|
|
name: str = Field(..., description="受众名称")
|
|
|
|
|
|
description: str = Field(..., description="受众描述")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"name": "亲子向",
|
|
|
|
|
|
"description": "25-45岁家长群体,孩子年龄3-12岁,注重安全和教育意义,偏好收藏实用攻略"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScenicSpotRequest(BaseModel):
|
|
|
|
|
|
"""景区请求模型"""
|
|
|
|
|
|
name: str = Field(..., description="景区名称")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"name": "天津冒险湾"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScenicSpotResponse(BaseModel):
|
|
|
|
|
|
"""景区响应模型"""
|
|
|
|
|
|
name: str = Field(..., description="景区名称")
|
|
|
|
|
|
description: str = Field(..., description="景区描述")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"name": "天津冒险湾",
|
|
|
|
|
|
"description": "天津冒险湾位于天津市滨海新区,是华北地区最大的水上乐园..."
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StyleListResponse(BaseModel):
|
|
|
|
|
|
"""风格列表响应模型"""
|
|
|
|
|
|
styles: List[StyleResponse] = Field(..., description="风格列表")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"styles": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "攻略风",
|
|
|
|
|
|
"description": "详细的旅行攻略信息,包含行程安排、交通指南、住宿推荐等实用信息,语言平实靠谱"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "清新文艺风",
|
|
|
|
|
|
"description": "文艺范十足,清新脱俗的表达风格,注重意境和美感描述"
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AudienceListResponse(BaseModel):
|
|
|
|
|
|
"""受众列表响应模型"""
|
|
|
|
|
|
audiences: List[AudienceResponse] = Field(..., description="受众列表")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"audiences": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "亲子向",
|
|
|
|
|
|
"description": "25-45岁家长群体,孩子年龄3-12岁,注重安全和教育意义,偏好收藏实用攻略"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "周边游",
|
|
|
|
|
|
"description": "全龄覆盖,主要围绕三天内的短期假期出游需求和周末出游需求"
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScenicSpotListResponse(BaseModel):
|
|
|
|
|
|
"""景区列表响应模型"""
|
|
|
|
|
|
spots: List[ScenicSpotResponse] = Field(..., description="景区列表")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"spots": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "天津冒险湾",
|
|
|
|
|
|
"description": "天津冒险湾位于天津市滨海新区,是华北地区最大的水上乐园..."
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PromptBuilderRequest(BaseModel):
|
|
|
|
|
|
"""提示词构建请求模型"""
|
|
|
|
|
|
topic: Dict[str, Any] = Field(..., description="选题信息")
|
|
|
|
|
|
step: Optional[str] = Field(None, description="当前步骤,用于过滤参考内容")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"topic": {
|
|
|
|
|
|
"index": "1",
|
|
|
|
|
|
"date": "2025-07-15",
|
|
|
|
|
|
"object": "天津冒险湾",
|
|
|
|
|
|
"product": "冒险湾-2大2小套票",
|
|
|
|
|
|
"style": "攻略风",
|
2025-07-15 15:47:47 +08:00
|
|
|
|
"targetAudience": "亲子向",
|
2025-07-11 13:50:08 +08:00
|
|
|
|
"logic": "暑期亲子游热门景点推荐"
|
|
|
|
|
|
},
|
|
|
|
|
|
"step": "content"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PromptBuilderResponse(BaseModel):
|
|
|
|
|
|
"""提示词构建响应模型"""
|
|
|
|
|
|
system_prompt: str = Field(..., description="系统提示词")
|
|
|
|
|
|
user_prompt: str = Field(..., description="用户提示词")
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
schema_extra = {
|
|
|
|
|
|
"example": {
|
|
|
|
|
|
"system_prompt": "你是一位专业的旅游内容创作者...",
|
|
|
|
|
|
"user_prompt": "请根据以下信息创作一篇旅游文章..."
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|