MCPcopy Index your code
hub / github.com/dataease/SQLBot / info

Function info

backend/apps/system/api/assistant.py:32–48  ·  view source on GitHub ↗
(request: Request, response: Response, session: SessionDep, trans: Trans, id: int)

Source from the content-addressed store, hash-verified

30
31@router.get("/info/{id}", include_in_schema=False)
32async def info(request: Request, response: Response, session: SessionDep, trans: Trans, id: int) -> AssistantModel:
33 if not id:
34 raise Exception('miss assistant id')
35 db_model = await get_assistant_info(session=session, assistant_id=id)
36 if not db_model:
37 raise RuntimeError(f"assistant application not exist")
38 db_model = AssistantModel.model_validate(db_model)
39
40 origin = request.headers.get("origin") or get_origin_from_referer(request)
41 if not origin:
42 raise RuntimeError(trans('i18n_embedded.invalid_origin', origin=origin or ''))
43 origin = origin.rstrip('/')
44 if not origin_match_domain(origin, db_model.domain):
45 raise RuntimeError(trans('i18n_embedded.invalid_origin', origin=origin or ''))
46
47 response.headers["Access-Control-Allow-Origin"] = origin
48 return db_model
49
50
51@router.get("/app/{appId}", include_in_schema=False)

Callers

nothing calls this directly

Calls 4

get_assistant_infoFunction · 0.90
get_origin_from_refererFunction · 0.90
origin_match_domainFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected