diff --git a/b/cntoai/model_management_search.dspy b/b/cntoai/model_management_search.dspy index 6893ee2..2547234 100644 --- a/b/cntoai/model_management_search.dspy +++ b/b/cntoai/model_management_search.dspy @@ -26,7 +26,7 @@ def _build_model_dict(ns, include_listing_status=False): async def model_management_search(ns={}): """ 分页查询模型列表,支持按 model_name / model_type / provider 筛选。 - 返回模型总数、待上架总数、已上架总数。 + 返回模型总数、待上架总数、已上架总数,以及厂商列表、模型类型列表。 """ import traceback @@ -35,10 +35,10 @@ async def model_management_search(ns={}): offset = (current_page - 1) * page_size conditions = ['1=1'] - if ns.get('model_name'): - model_name = ns.get('model_name') + if ns.get('display_name'): + display_name = ns.get('display_name') # 模糊查询 - conditions.append(f"model_name LIKE '%%%%{model_name}%%%%'") + conditions.append(f"display_name LIKE '%%%%{display_name}%%%%'") if ns.get('model_type'): conditions.append("model_type = '%s'" % _escape(ns.get('model_type'))) if ns.get('provider'): @@ -55,10 +55,23 @@ async def model_management_search(ns={}): stats_li = await sor.sqlExe(stats_sql, {}) stats = stats_li[0] if stats_li else {} + provider_sql = """ + SELECT DISTINCT provider FROM model_management + WHERE provider IS NOT NULL AND provider != '' + ORDER BY provider; + """ + model_type_sql = """ + SELECT DISTINCT model_type FROM model_management + WHERE model_type IS NOT NULL AND model_type != '' + ORDER BY model_type; + """ + count_sql = """SELECT COUNT(*) AS total_count FROM model_management WHERE %s;""" % where_clause filter_total = (await sor.sqlExe(count_sql, {}))[0]['total_count'] find_sql = """SELECT * FROM model_management WHERE %s ORDER BY sort_order ASC LIMIT %s OFFSET %s;""" % (where_clause, page_size, offset) + provider_rows = await sor.sqlExe(provider_sql, {}) + model_type_rows = await sor.sqlExe(model_type_sql, {}) model_list = await sor.sqlExe(find_sql, {}) return { @@ -68,6 +81,8 @@ async def model_management_search(ns={}): 'total_count': stats.get('total_count', 0), 'pending_count': int(stats.get('pending_count') or 0), 'listed_count': int(stats.get('listed_count') or 0), + 'provider_list': [r['provider'] for r in provider_rows], + 'model_type_list': [r['model_type'] for r in model_type_rows], 'filter_total': filter_total, 'page_size': page_size, 'current_page': current_page, diff --git a/b/product/get_firstpage_product_tree.dspy b/b/product/get_firstpage_product_tree.dspy index 2e899fc..b7fab08 100644 --- a/b/product/get_firstpage_product_tree.dspy +++ b/b/product/get_firstpage_product_tree.dspy @@ -539,6 +539,12 @@ jiajie_ali_products = [ ] async def get_firstpage_product_tree(ns={}): + token_market = await path_call('../cntoai/model_management_customer_search.dspy', ns) + # if token_market.get('status'): + # token_market = token_market.get('data') + # else: + # token_market = None + data = { "product_service": [ { @@ -590,7 +596,8 @@ async def get_firstpage_product_tree(ns={}): # }, # ], }, - ] + ], + 'token_market': token_market }, { 'id': "2", 'firTitle': "元境", 'secMenu': [