rag/wwwroot/test_query.dspy
2025-11-28 16:20:20 +08:00

36 lines
947 B
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.

debug(f'{params_kw=}')
orgid = await get_userorgid()
if not orgid:
return UiError(
title='授权错误',
message='请先登录'
)
query = params_kw.query
image = params_kw.image
fiids = params_kw.fiids
limit = params_kw.limit
if (not query and not image) or not fiids or not limit:
return UiError(
title='无效输入',
message='请输入查询文本或上传image并选择至少一个知识库和填写返回条数'
)
try:
env = DictObject(**globals())
keys = [k for k in env.keys()]
debug(f'{keys=}')
result = await rfexe('fusedsearch', request, params_kw)
debug(f'fusedsearch result: {result}')
return {
"widgettype":"MdWidget",
"options":{
"width": "100%",
"mdtext": json.dumps(result, ensure_ascii=False)
}
}
except Exception as e:
return UiError(title='search failed', message=f'召回失败failed({e})')