验证agent 接口参数
This commit is contained in:
@@ -69,6 +69,7 @@ async def ai_edit_customize_resume(param: AiEditParam):
|
|||||||
async for session in get_db():
|
async for session in get_db():
|
||||||
service = SkillGapService(session)
|
service = SkillGapService(session)
|
||||||
result = await service.ai_edit_customize_resume(
|
result = await service.ai_edit_customize_resume(
|
||||||
user_id, param.job_id, param.instruction, param.chat_history,
|
user_id, param.job_id, param.instruction,
|
||||||
|
[msg.model_dump() for msg in param.chat_history],
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -25,10 +25,18 @@ class CustomizeResumeParam(BaseModel):
|
|||||||
add_skills: list[str] = Field(default_factory=list, alias="addSkills")
|
add_skills: list[str] = Field(default_factory=list, alias="addSkills")
|
||||||
|
|
||||||
|
|
||||||
|
ChatRole = Literal["user", "assistant"]
|
||||||
|
|
||||||
|
|
||||||
|
class ChatMessage(BaseModel):
|
||||||
|
role: ChatRole
|
||||||
|
content: str
|
||||||
|
|
||||||
|
|
||||||
class AiEditParam(BaseModel):
|
class AiEditParam(BaseModel):
|
||||||
job_id: int = Field(..., alias="jobId")
|
job_id: int = Field(..., alias="jobId")
|
||||||
instruction: str = Field(...)
|
instruction: str = Field(...)
|
||||||
chat_history: list[dict] = Field(default_factory=list, alias="chatHistory")
|
chat_history: list[ChatMessage] = Field(default_factory=list, alias="chatHistory")
|
||||||
|
|
||||||
|
|
||||||
# ===== Redis 缓存子模型 =====
|
# ===== Redis 缓存子模型 =====
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ class SkillGapService:
|
|||||||
# ===== AI 对话编辑 =====
|
# ===== AI 对话编辑 =====
|
||||||
|
|
||||||
async def ai_edit_customize_resume(self, user_id: int, job_id: int,
|
async def ai_edit_customize_resume(self, user_id: int, job_id: int,
|
||||||
instruction: str, chat_history: list[dict]) -> dict:
|
instruction: str, chat_history: list) -> dict:
|
||||||
"""AI 对话式编辑定制简历"""
|
"""AI 对话式编辑定制简历"""
|
||||||
# 1. 取当前定制简历
|
# 1. 取当前定制简历
|
||||||
key = f"{CUSTOMIZE_RESUME_KEY_PREFIX}{user_id}"
|
key = f"{CUSTOMIZE_RESUME_KEY_PREFIX}{user_id}"
|
||||||
|
|||||||
Reference in New Issue
Block a user