30 Commits

Author SHA1 Message Date
a1c3eb4b25 feat: apiname/query_apiname改为从uapi动态选择
- 新增 get_search_apiname.dspy: 根据llmid查upappid, 从uapi获取API列表
- apiname: code类型下拉选择(必选)
- query_apiname: code类型下拉选择(可选, 含'不指定'选项)
- 更新 json/llm_api_map.json CRUD定义 alters
- 更新 llm_api_map_manage.ui 表单字段
- 重新生成 wwwroot/llm_api_map/index.ui
- 注册 load_path.py RBAC权限
2026-06-05 18:22:14 +08:00
d4e455ba9a perf: optimize get_inference_history query and add indexes
Query optimization (dspy):
- Replace UNION ALL + sort with two parallel queries (asyncio.gather)
  that each use (userid, use_time) composite index
- Python-side merge-sort of two pre-sorted sequences O(n)
- Concurrent FileStorage reads for ioinfo (asyncio.gather)

Indexes (models/*.json + /tmp/llmage_history_indexes.sql):
- llmusage: add idx_llmusage_userid_usetime (userid, use_time)
- llmusage_history: add idx_lh_userid_usetime (userid, use_time)
  (was missing userid index entirely - main bottleneck)
2026-06-05 17:42:15 +08:00
2ebe811c34 fix: use llm_api_map for llmcatelogid filter (llm table has no catelog column) 2026-06-05 17:38:18 +08:00
6f8c14c329 feat: add llmcatelogid filter and pagerows param to get_inference_history
- Add llmcatelogid parameter to filter by model catalog (joins llm table)
- Change default pagerows from 50 to 10
- Add pagerows parameter for custom page size
2026-06-05 17:34:26 +08:00
1d12d42e80 feat: add get_inference_history API - cross-table paginated query with ioinfo content
- UNION ALL query from llmusage + llmusage_history tables
- Filter by current user's userid, sorted by use_time desc
- 50 records per page with pagination support
- Reads ioinfo webpath via FileStorage to return actual input/output content
- Registered in load_path.py for RBAC (logined role)
2026-06-05 17:15:05 +08:00
186f64d544 fix: prepend 全部 option to get_search results 2026-06-04 18:52:10 +08:00
134bd1ca68 fix: replace 'from datetime import date' with pre-loaded curDateString() 2026-06-04 18:39:50 +08:00
9212cf8afb fix: remove import statements from dspy file (violates dspy spec) 2026-06-04 18:35:53 +08:00
faba862336 feat: add check_charging action to test pricing calculation with usage data
- llm_launch_check_api.dspy: add check_charging action
  * Takes usages JSON from inference result
  * Calls env.buffered_charging(ppid, usages) to verify pricing works
  * Returns pricing breakdown with amounts and costs
- llm_launch_check.ui: add '检查计费' button
  * Appears after successful inference
  * Passes usage data to check_charging API
  * Displays pricing calculation results
- llm_launch_check_api.dspy: simplify inference action
  * Direct uapi.call() instead of full inference pipeline
  * Extracts usage from response without writing to database
2026-06-04 18:29:37 +08:00
3a0a8d4c86 feat: 添加模型上线检查功能
- 新增 llm_launch_check_api.dspy:执行完整的上线前检查
  * 检查模型记录、日期、状态
  * 检查上位系统(upapp)关联
  * 检查API映射(uapi)
  * 检查IO定义(uapiio)
  * 检查能力映射(llm_api_map)
  * 检查定价项目(pricing_program)
  * 检查定价数据(pricingdata)
  * 支持体验测试(action=inference)
- 新增 llm_launch_check.ui:检查结果展示界面
- 修改 llm.json:将'体验'按钮改为'上线检查'
- 更新 load_path.py:注册新路径
2026-06-04 18:11:12 +08:00
308e91c61c fix: align get_search_providerid.dspy with {value, text} format using SQL aliases 2026-06-04 17:58:00 +08:00
9377cfabb8 fix: align get_search_upappid.dspy with {value, text} format 2026-06-04 17:56:34 +08:00
bb4900f997 feat: add get_search_{fieldname}.dspy for codes fields with 全部 option
- get_search_providerid.dspy: organization list with 全部 as first entry
- get_search_upappid.dspy: upapp list with 全部 as first entry
- json/llm.json: update alters dataurl to use search scripts
- load_path.py: register new RBAC paths
2026-06-04 17:22:50 +08:00
cfa355a7a5 refactor: 删除自定义llm_list.dspy,改用CRUD自动生成的get_llm.dspy 2026-05-31 20:01:41 +08:00
a228095220 fix: get_organizations/get_upapps返回providerid_text/upappid_text格式匹配alters字段名 2026-05-31 19:56:35 +08:00
93e3f17a67 fix: 恢复providerid/upappid的alters配置,llm_list.dspy返回_text字段用于列表展示 2026-05-31 19:53:19 +08:00
d4406a60fd Revert "fix: llm_list.dspy用JOIN查询返回upappid_text和providerid_text供前端code列显示"
This reverts commit 5c021b81cba6da9c08954d2c5e075cd1e83f45cf.
2026-05-31 19:26:32 +08:00
5c021b81cb fix: llm_list.dspy用JOIN查询返回upappid_text和providerid_text供前端code列显示 2026-05-31 15:59:21 +08:00
37c6814b2d fix: 移除get_organizations的过滤条件,返回所有组织;添加错误日志 2026-05-31 15:41:21 +08:00
314da7ae44 fix: get_upapps和get_organizations用属性访问替代字典访问(sqlExe返回对象) 2026-05-31 15:36:13 +08:00
d84cc1d859 fix: API返回纯数组格式,添加模型上下架功能
- get_organizations/get_upapps/uapi_options: 返回纯数组[{value,text}]
- 新增 get_catelogs/get_apis/get_ppids: 独立下拉数据API
- llm_api_map_manage.ui: 使用独立API替代data_field嵌套格式
- json/llm.json: 移除data_field,添加上架/下架toolbar
- llm_status_update.dspy: 模型上下架状态更新API
- 重新生成 llm/index.ui CRUD界面
2026-05-30 01:43:09 +08:00
d6e4221a7b feat: add model publish/unpublish (上架/下架) functionality
- llm table: add status field (published/unpublished, default unpublished)
- User-facing queries: filter by status='published' in 11 query points:
  - utils.py: get_llms_by_catelog_to_customer, get_llms_by_catelog,
    get_llm, get_llmproviders, get_llms_sort_by_provider
  - v1 endpoints: chat/completions, image/generations, video/generations
  - user pages: t2t, get_type_llms, list_catelog_models,
    list_paging_catelog_llms, llmcheck
- CRUD: status column visible/editable with select dropdown
- Admin CRUD list shows ALL models regardless of status
- Migration SQL: sql/add_status_field.sql (existing models set to published)
2026-05-28 23:42:29 +08:00
9aa917bce5 feat: add data_filter and CRUD endpoints for llm table
- Add data_filter with 4 searchable fields (name LIKE, model LIKE, providerid, upappid)
- Add filter_labels for search form display
- Create llm_list.dspy with DBFilter support and LIKE wildcard handling
- Create llm_create.dspy, llm_update.dspy, llm_delete.dspy
- Create get_organizations.dspy and get_upapps.dspy for dropdown options
- Add browserfields alters for providerid and upappid dropdowns
- Add editable URLs for DataViewer CRUD operations
2026-05-26 14:26:38 +08:00
7911750127 feat(llmage): 备份改用INSERT SELECT+DELETE单SQL语句 + 新增失败记录重试功能 2026-05-24 21:57:56 +08:00
1e335d35cb fix(llmage): 规范检查修复
- accounting.py: 删除重复datetime导入, 清理未使用env变量
- failed_accounting.ui: Button text→label(规范), DatePicker→TextInput(不确定的widget)
- index.ui: backgroundColor→bgcolor(规范), 3处修复
- llmusage_accounting_failed_update.dspy: 删除ServerEnv()违规(.dspy禁用), 用datetime替代
- 新增llmusage_history只读DSPY(create/update/delete返回只读提示)
2026-05-24 14:11:33 +08:00
07b4893252 feat(llmage): 添加llmusage历史记录备份和记账失败检索功能
- 新增 llmusage_history 表:定时备份已记账(use_date<today)的历史记录
- 新增 llmusage_accounting_failed 表:记录记账失败详情,支持检索
- 新增 backup_accounted_llmusage() 函数:备份+清理历史数据
- 新增 get_failed_accounting_records() 函数:按条件检索失败记录
- 更新 llm_accoung_failed():同时写入失败表记录
- 新增 failed_accounting.ui 页面和 failed_accounting_list.dspy API
- 新增 llmusage CRUD API (create/update/delete)
- 新增表索引优化查询性能
- 更新 setup_llmage_perms.sh 添加新端点权限
- 生成生产迁移SQL: scripts/migrate_llmusage_history.sql
2026-05-24 13:55:48 +08:00
5b3c7d4d02 refactor: 废弃llm_catalog_rel表, 分类关系改用llm_api_map
- 删除 llm_catalog_rel 表定义(models/json/xlsx)、CRUD文件、管理页面、迁移脚本
- utils.py: get_llms_by_catelog/get_llms_by_catelog_to_customer 的SQL从 llm_catalog_rel 改为 llm_api_map (加distinct去重)
- init.py: 缓存清除事件从 llm_catalog_rel 改为 llm_api_map
- menu.ui/index.ui: 移除类型关联菜单项
- dspy文件: v1/chat/completions, t2t, get_type_llms, list_catelog_models, list_paging_catelog_llms, llmcatelog_delete 全部改为 join llm_api_map
- 迁移脚本: 添加try/except兼容旧表不存在的情况
2026-05-21 16:22:59 +08:00
1060cac2de feat: llm_api_map CRUD management and ownerid-based data isolation
- Update json/llm.json subtable from llm_catelog_rel to llm_api_map
- Rewrite json/llm_api_map.json as standard CRUD format (tblname+params)
- Add models/llm_api_map.json table definition (summary/fields/indexes/codes)
- Add independent management UI (llm_api_map_manage.ui)
- Add CRUD DSPY APIs (list/create/delete/options) with ownerid filtering
- All operations verify l.ownerid for data isolation
- Add uapi_options.dspy for API selection dropdown
2026-05-20 17:29:27 +08:00
1b74b5bf10 feat: add llm catalog (type) management module
- Add CRUD API for llmcatelog (list/create/update/delete)
- Add llmcatelog.ui as main entry for catalog management
- Add llmcatelog_list.ui as DataViewer interface
- Add index.ui as module navigation page
- Update json/llmcatelog.json with editable section
2026-05-17 00:46:31 +08:00
6cc3986a2d feat: support multi-catalog for LLMs
- Create llm_catalog_rel model for one-to-many relationship
- Remove llmcatelogid from llm model
- Update SQL queries in utils.py and dspy files to use join
- Add maintenance UI (llm_catalog_rel_manage.ui) and API endpoints
- Filter options by user's orgid
2026-05-16 21:31:19 +08:00