fix: 移除所有dspy文件中多余的import语句, 框架已预加载

This commit is contained in:
yumoqing 2026-05-30 00:32:16 +08:00
parent 38cea985f1
commit 967d1c728c
19 changed files with 7 additions and 44 deletions

View File

@ -1,5 +1,3 @@
import json
from appPublic.log import debug
rows = [
{"value": "Image", "text": "图片"},

View File

@ -1,5 +1,3 @@
import json
from appPublic.log import debug
org_id = (await get_userorgid()) or '0'

View File

@ -1,5 +1,3 @@
import json
from appPublic.log import debug
rows = [
{"value": "active", "text": "启用"},

View File

@ -1,6 +1,3 @@
import json
from sqlor.dbpools import DBPools
from appPublic.log import debug
ns = params_kw.copy()
dbname = get_module_dbname('uapi')

View File

@ -1,6 +1,3 @@
import json
from sqlor.dbpools import DBPools
from appPublic.log import debug
ns = params_kw.copy()
dbname = get_module_dbname('reallife_asset')

View File

@ -16,7 +16,6 @@ result = await rl_create_asset(
user_id=user_id
)
import json
return json.dumps({
"widgettype": "Message",
"options": {

View File

@ -6,7 +6,6 @@ if not rid:
result = await rl_delete_asset(rid)
import json
return json.dumps({
"widgettype": "Message",
"options": {

View File

@ -14,7 +14,6 @@ result = await rl_create_validate_session(
user_id=user_id
)
import json
return json.dumps({
"widgettype": "Message",
"options": {

View File

@ -6,7 +6,6 @@ if not rid:
result = await rl_delete_group(rid)
import json
return json.dumps({
"widgettype": "Message",
"options": {

View File

@ -1,7 +1,3 @@
import json
import traceback
from appPublic.log import debug, error
# Vendor callback: GET or POST
# Volcengine example (GET):
# ?bytedToken=xxx&resultCode=10000&algorithmBaseRespCode=0
@ -9,7 +5,6 @@ from appPublic.log import debug, error
# Return format depends on vendor requirements.
debug("[rl_callback] ===== START =====")
debug(f"[rl_callback] params_kw keys: {list(params_kw.keys())}")
debug(f"[rl_callback] params_kw: {params_kw}")
print(f"[rl_callback] params_kw: {params_kw}")
@ -23,9 +18,7 @@ try:
byted_token = (body.get("BytedToken") or body.get("bytedToken")
or body.get("byted_token") or body.get("Token") or "")
result_code = body.get("resultCode") or body.get("ResultCode") or ""
debug(f"[rl_callback] from body: byted_token={byted_token}, result_code={result_code}")
except Exception as e:
error(f"[rl_callback] body parse error: {e}")
debug(f"[rl_callback] body parse error: {e}")
# 2. Fallback: query string params (GET callback)
@ -37,8 +30,8 @@ if not byted_token:
if not result_code:
result_code = params_kw.get("resultCode", "")
debug(f"[rl_callback] final: byted_token={byted_token}, resultCode={result_code}")
print(f"[rl_callback] final: byted_token={byted_token}, resultCode={result_code}")
debug(f"[rl_callback] byted_token={byted_token}, resultCode={result_code}")
print(f"[rl_callback] byted_token={byted_token}, resultCode={result_code}")
if not byted_token:
debug("[rl_callback] ERROR: missing bytedToken")
@ -46,22 +39,17 @@ if not byted_token:
# Process callback
try:
debug(f"[rl_callback] calling rl_handle_callback with byted_token={byted_token}")
debug(f"[rl_callback] calling rl_handle_callback")
result = await rl_handle_callback(byted_token, project_name="default")
debug(f"[rl_callback] handle_callback result: {result}")
print(f"[rl_callback] handle_callback result: {result}")
debug(f"[rl_callback] result: {result}")
print(f"[rl_callback] result: {result}")
except Exception as e:
error(f"[rl_callback] rl_handle_callback exception: {e}\n{traceback.format_exc()}")
debug(f"[rl_callback] rl_handle_callback exception: {e}")
print(f"[rl_callback] rl_handle_callback exception: {e}")
debug(f"[rl_callback] exception: {e}")
print(f"[rl_callback] exception: {e}")
print(traceback.format_exc())
return json.dumps({"code": "500", "message": f"Internal error: {str(e)}"})
# Volcengine expects HTTP 200 with any body for success.
# Return a simple success/failure response.
if result.get("success"):
debug("[rl_callback] SUCCESS")
return json.dumps({"code": "200", "message": "ok"})
else:
debug(f"[rl_callback] FAILED: {result.get('message', 'unknown')}")
return json.dumps({"code": "500", "message": result.get("message", "callback error")})

View File

@ -1,4 +1,3 @@
import json
org_id = (await get_userorgid()) or '0'

View File

@ -1,4 +1,3 @@
import json
asset_id = params_kw.get('asset_id', '')

View File

@ -1,4 +1,3 @@
import json
vendor_group_id = params_kw.get('vendor_group_id', '')
source_url = params_kw.get('source_url', '')

View File

@ -12,7 +12,6 @@ if not upappid:
return {"success": False, "message": "上位系统ID不能为空"}
# Validate api_mapping is valid JSON
import json
try:
api_mapping_dict = json.loads(api_mapping) if api_mapping else {}
api_mapping = json.dumps(api_mapping_dict, ensure_ascii=False)

View File

@ -1,4 +1,3 @@
import json
vendor = params_kw.get('vendor', '')
project_name = params_kw.get('project_name', 'default')

View File

@ -1,4 +1,3 @@
import json
vendor = params_kw.get('vendor', '')
name = params_kw.get('name', '')

View File

@ -5,7 +5,6 @@ if not asset_id:
result = await rl_sync_asset_status(asset_id)
import json
return json.dumps({
"widgettype": "Message",
"options": {

View File

@ -6,7 +6,6 @@ if not group_id:
result = await rl_sync_assets_from_vendor(org_id, group_id)
import json
return json.dumps({
"widgettype": "Message",
"options": {

View File

@ -7,7 +7,6 @@ if not vendor:
result = await rl_sync_group_from_vendor(org_id, vendor, project_name)
import json
return json.dumps({
"widgettype": "Message",
"options": {