bugfix
This commit is contained in:
parent
a87a734285
commit
6081f9ba46
31
wwwroot/kboss/promote.dspy
Normal file
31
wwwroot/kboss/promote.dspy
Normal file
@ -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
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user