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 全局调用。
This commit is contained in:
parent
59587a8c31
commit
6890af7638
@ -21,6 +21,8 @@ from .utils import (
|
|||||||
get_llmage_llm,
|
get_llmage_llm,
|
||||||
get_llm_catelogs,
|
get_llm_catelogs,
|
||||||
invalidate_uapi_cache,
|
invalidate_uapi_cache,
|
||||||
|
get_llmusage_by_id,
|
||||||
|
read_ioinfo_content,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .llmclient import (
|
from .llmclient import (
|
||||||
@ -153,6 +155,8 @@ def load_llmage():
|
|||||||
env.llm_query_price = llm_query_price
|
env.llm_query_price = llm_query_price
|
||||||
env.get_llms_by_catelog_to_customer = get_llms_by_catelog_to_customer
|
env.get_llms_by_catelog_to_customer = get_llms_by_catelog_to_customer
|
||||||
env.backup_accounted_llmusage = backup_accounted_llmusage
|
env.backup_accounted_llmusage = backup_accounted_llmusage
|
||||||
|
env.read_ioinfo_content = read_ioinfo_content
|
||||||
|
env.get_llmusage_by_id = get_llmusage_by_id
|
||||||
env.get_failed_accounting_records = get_failed_accounting_records
|
env.get_failed_accounting_records = get_failed_accounting_records
|
||||||
env.get_llmage_stats = get_llmage_stats
|
env.get_llmage_stats = get_llmage_stats
|
||||||
# Product module standard interface
|
# Product module standard interface
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'rows': [], 'total': 0}
|
result = {'success': False, 'rows': [], 'total': 0}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'data': {'llms': [], 'catelogs': [], 'apis': [], 'ppids': []}}
|
result = {'success': False, 'data': {'llms': [], 'catelogs': [], 'apis': [], 'ppids': []}}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'data': {'llms': [], 'catelogs': []}}
|
result = {'success': False, 'data': {'llms': [], 'catelogs': []}}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'rows': [], 'total': 0}
|
result = {'success': False, 'rows': [], 'total': 0}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
result = {'success': False, 'message': '历史数据为只读,不可新增'}
|
result = {'success': False, 'message': '历史数据为只读,不可新增'}
|
||||||
return json.dumps(result, ensure_ascii=False, default=str)
|
return json.dumps(result, ensure_ascii=False, default=str)
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
result = {'success': False, 'message': '历史数据为只读,不可删除'}
|
result = {'success': False, 'message': '历史数据为只读,不可删除'}
|
||||||
return json.dumps(result, ensure_ascii=False, default=str)
|
return json.dumps(result, ensure_ascii=False, default=str)
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
result = {'success': False, 'message': '历史数据为只读,不可修改'}
|
result = {'success': False, 'message': '历史数据为只读,不可修改'}
|
||||||
return json.dumps(result, ensure_ascii=False, default=str)
|
return json.dumps(result, ensure_ascii=False, default=str)
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = {'success': False, 'message': ''}
|
result = {'success': False, 'message': ''}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,6 @@ ns = params_kw.copy()
|
|||||||
limit = int(ns.get('limit') or 200)
|
limit = int(ns.get('limit') or 200)
|
||||||
single_id = ns.get('id') or None
|
single_id = ns.get('id') or None
|
||||||
|
|
||||||
from ahserver.filestorage import FileStorage
|
|
||||||
import os
|
|
||||||
|
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
dbname = get_module_dbname('llmage')
|
dbname = get_module_dbname('llmage')
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import json
|
|
||||||
from llmage.utils import get_llmusage_by_id, read_ioinfo_content
|
|
||||||
|
|
||||||
usage_id = params_kw.get('id')
|
usage_id = params_kw.get('id')
|
||||||
if not usage_id:
|
if not usage_id:
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import json
|
|
||||||
from llmage.utils import get_llmusage_by_id
|
|
||||||
|
|
||||||
usage_id = params_kw.get('id')
|
usage_id = params_kw.get('id')
|
||||||
if not usage_id:
|
if not usage_id:
|
||||||
|
|||||||
@ -14,14 +14,6 @@
|
|||||||
#
|
#
|
||||||
# Response format depends on the upstream model (sync returns image data, async returns task info)
|
# Response format depends on the upstream model (sync returns image data, async returns task info)
|
||||||
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
from functools import partial
|
|
||||||
from appPublic.log import debug
|
|
||||||
from appPublic.dictObject import DictObject
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
from appPublic.timeUtils import curDateString, timestampstr
|
|
||||||
from sqlor.dbpools import get_sor_context
|
|
||||||
|
|
||||||
debug_params('params_kw', params_kw)
|
debug_params('params_kw', params_kw)
|
||||||
|
|
||||||
|
|||||||
@ -22,14 +22,6 @@
|
|||||||
# "created": 1234567890
|
# "created": 1234567890
|
||||||
# }
|
# }
|
||||||
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
from functools import partial
|
|
||||||
from appPublic.log import debug
|
|
||||||
from appPublic.dictObject import DictObject
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
from appPublic.timeUtils import curDateString, timestampstr
|
|
||||||
from sqlor.dbpools import get_sor_context
|
|
||||||
|
|
||||||
debug_params('params_kw', params_kw)
|
debug_params('params_kw', params_kw)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user