"""浏览器插件接口""" from fastapi import APIRouter from app.core.context import RequestContext from app.core.database import get_db from app.schemas.browser_plug import FormFillAnswerParam, FormFillAnswerDto from app.services.browser_plug_service import BrowserPlugService router = APIRouter(prefix="/browser-plug", tags=["浏览器插件"]) @router.post("/form-fill-answer", summary="表单填写AI生成答案", response_model=FormFillAnswerDto) async def form_fill_answer(param: FormFillAnswerParam): """插件端规则匹配不上的表单字段,调AI根据用户简历和岗位信息生成填写内容""" user_id = RequestContext.user_id.get() async for session in get_db(): service = BrowserPlugService(session) value = await service.form_fill_answer( user_id, param.job_id, param.label, param.reference, param.type) return FormFillAnswerDto(value=value)