pipeline_core/wwwroot/api/llm_tokens.dspy

17 lines
654 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# llm_tokens.dspy — 列出已签发 token元信息 + 用量,不返回 token 明文,供审计)
user_id = await get_user()
if not user_id:
return json.dumps({"success": False, "error": "未登录"}, ensure_ascii=False)
p = params_kw or {}
project_id = (p.get('project_id', '') or '').strip()
status = (p.get('status', '') or '').strip()
# 机构隔离:只看本机构签发的 token
org_id = (await get_userorgid()) or '0'
rows = await list_llm_tokens(org_id=org_id, project_id=project_id or None,
status=status or None)
return json.dumps({"success": True, "tokens": rows}, ensure_ascii=False, default=str)