sage/wwwroot/kboss/promote.dspy
2026-03-13 13:45:10 +08:00

32 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

prompt = params_kw.prompt or "推荐部署千问3.5-16B大模型的主机"
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 = await hc.request('GET', url)
if data:
d = DictObject(**json.loads(data.decode('utf-8')))
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 = DictObject(**{
"prompt": prompt,
"llmid": 'BDfl0Ts-sZp_UgRDGfDM4'
})
f = partial(inference_generator, request, params_kw=params)
return await stream_response(request, f)
except Exception as e:
exception(f'{e}')
raise e