This commit is contained in:
ping 2026-07-21 17:15:53 +08:00
parent 4af3ff5000
commit f2b432df51

View File

@ -19,7 +19,8 @@ async def sync_model_to_llm(ns={}):
}
domain = domain_li[0]['pvalue']
bearer_token = user_key[0]['pvalue']
sync_orgid = await get_sync_orgid(sor)
# sync_orgid = await get_sync_orgid(sor)
sync_orgid = "mIWUHBeeDM8mwAFPIQ8pS" # 固定写
if not sync_orgid:
return {
'status': False,
@ -63,11 +64,17 @@ async def sync_model_to_llm(ns={}):
'appid': item.get('upappid') or '',
'providerkey': provider_orgcode,
'state': '1',
'start_date': item.get('enabled_date'),
'end_date': item.get('expired_date') or '9999-12-31',
'salemode': ns.get('salemode') or '0',
'settle_mode': ns.get('settle_mode') or '0',
'settle_datep': ns.get('settle_datep')
'start_date': '2026-07-01',
'end_date': '9999-12-31',
'settle_flowid': '0',
'salemode': '0',
'settle_mode': '3',
'settle_datep': 'M00',
'contactor': '连战',
'contactor_phone': '13800138000',
'emailaddress': 'lianzhan@cntoai.com',
'address': '北京市海淀区',
'org_type': '4'
}
provider_res = await path_call('../provider/providerAdd.dspy', provider_ns)
if not provider_res.get('status'):
@ -89,17 +96,14 @@ async def sync_model_to_llm(ns={}):
'providerpid': item.get('id'),
'protocolid': protocolid,
'name': item.get('name'),
'description': item.get('description'),
'ptype': item.get('catelogname') or category_list.get('catelogname') or '',
'state': '1',
'product_code': item.get('model'),
'reseller_orgid': sync_orgid,
'salemode': ns.get('salemode') or '0',
'productgroup': item.get('catelog_id') or item.get('catelogid') or category_list.get('catelogid'),
'label': item.get('catelogname') or category_list.get('catelogname'),
'unit': ns.get('unit'),
'discount': ns.get('discount'),
'floorprice': ns.get('floorprice')
'classify': 'A',
'ptype': '21',
'unit': 'hour',
'discount': '1',
'product_area': '北京'
}
product_res = await path_call('../product/productAdd.dspy', product_ns)
if not product_res.get('status'):
@ -112,23 +116,33 @@ async def sync_model_to_llm(ns={}):
# 查找数据库中是否已经存在,不存在就插入
exist_llm = await sor.R('llm', {'model': item.get('model')})
if exist_llm:
# 更新
exits_id = exist_llm[0].get('id')
await sor.U('llm', {'id': exits_id}, item)
continue
new_llms = {
'id': item.get('id'),
'name': item.get('name'),
'model': item.get('model'),
'description': item.get('description'),
'llmcatelogid': item.get('catelog_id') or item.get('catelogid'),
'iconid': item.get('iconid'),
'upappid': item.get('upappid'),
'apiname': item.get('apiname'),
'providerid': provider_orgid,
'ownerid': item.get('ownerid') or '0',
'providerid': item.get('providerid'),
'ownerid': item.get('ownerid'),
'enabled_date': item.get('enabled_date'),
'expired_date': item.get('expired_date'),
'query_apiname': item.get('query_apiname') or '',
'min_balance': item.get('min_balance'),
'status': item.get('status'),
'catelogname': item.get('catelogname'),
'catelog_id': item.get('catelog_id'),
'apiname': item.get('apiname'),
'query_apiname': item.get('query_apiname'),
'query_period': item.get('query_period'),
'ppid': protocolid,
'ppid': item.get('ppid'),
'provider_name': item.get('provider_name'),
'pricing_display': item.get('pricing_display'),
'provider_iconurl': item.get('provider_iconurl')
}
new_llms_count += 1
new_llms_list.append(new_llms.get('model'))