From 6081f9ba463c0c7e42aedecf669617df3dd34b16 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 13 Mar 2026 13:16:26 +0800 Subject: [PATCH] bugfix --- wwwroot/kboss/promote.dspy | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 wwwroot/kboss/promote.dspy diff --git a/wwwroot/kboss/promote.dspy b/wwwroot/kboss/promote.dspy new file mode 100644 index 0000000..bf930db --- /dev/null +++ b/wwwroot/kboss/promote.dspy @@ -0,0 +1,31 @@ +prompt = params_kw.prompt +client_ip = request['client_ip'] +if client_ip not in ['180.76.115.73', '180.76.111.84']: + raise Exception(f'Client invalid({client_ip})') +await remember_user('BDfl0Ts-sZp_UgRDGfDM4', 'sword', '0') +url = 'https://dev.opencomputing.cn/product/get_ncmatch_publish_product_to_model.dspy' +hc = StreamHttpClient() +try: + data = hc.request('GET', url) + if data: + d = DictObject(**json.loads(data)) + if d is None: + raise Exception(f'{url} return none') + data = [{ + 'id': e.id, + 'product_name': e.product_name, + 'requirement_summary': e.requirement_summary, + 'application_scenario': e.application_scenario + } for e in d.data] + + new_prompt = f"按照用户需求从可选项中选择满足客户需求的数据返回,返回纯json格式,用户需求:{prompt}\n可选项:\n{data}" + params = { + "prompt": prompt, + "llmid": 'BDfl0Ts-sZp_UgRDGfDM4' + } + f = partial(inference_generator, request, params_kw=params) + return stream_response(request, f) +except Exception as e: + exception(f'{e}') + raise e +