llmage/wwwroot/llmusage_ioinfo_display.dspy
yumoqing 6890af7638 fix: 清理所有 dspy 文件的 import 语句
删除已在 ahserver/ServerEnv 预加载的模块:
  json, datetime, getID, debug, curDateString, timestampstr,
  get_sor_context, time, DictObject, partial, FileStorage, os

删除模块内部 import:
  from llmage.utils import get_llmusage_by_id, read_ioinfo_content

同步将 get_llmusage_by_id, read_ioinfo_content 加入 load_llmage() 导出,
dspy 中通过 ServerEnv 全局调用。
2026-06-30 17:38:37 +08:00

48 lines
1.4 KiB
Plaintext

usage_id = params_kw.get('id')
if not usage_id:
return {"widgettype": "Message", "options": {"message": "缺少 id 参数", "type": "error"}}
record = await get_llmusage_by_id(usage_id)
if not record:
return {"widgettype": "Message", "options": {"message": "未找到记录", "type": "error"}}
llmid = record.get('llmid', '')
ioinfo_webpath = record.get('ioinfo', '')
ioinfo_content = await read_ioinfo_content(ioinfo_webpath) if ioinfo_webpath else None
ioinfo_text = json.dumps(ioinfo_content, ensure_ascii=False, indent=2) if ioinfo_content else "无交互内容"
return {
"widgettype": "VScrollPanel",
"options": {
"width": "100%",
"height": "100%"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"width": "100%",
"padding": "16px",
"spacing": 12
},
"subwidgets": [
{
"widgettype": "Title4",
"options": {
"text": f"Model: {llmid}"
}
},
{
"widgettype": "Text",
"options": {
"text": ioinfo_text,
"css": "padding: 0 5px; white-space: pre-wrap; word-break: break-all;"
}
}
]
}
]
}