feat: economical index support retrieval testing (#3563)

This commit is contained in:
Joel 2024-04-17 17:40:28 +08:00 committed by GitHub
parent be3b37114c
commit 40b48510f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 19 deletions

View File

@ -49,7 +49,14 @@ const TextAreaWithButton = ({
const onSubmit = async () => { const onSubmit = async () => {
setLoading(true) setLoading(true)
const [e, res] = await asyncRunSafe<HitTestingResponse>( const [e, res] = await asyncRunSafe<HitTestingResponse>(
hitTesting({ datasetId, queryText: text, retrieval_model: retrievalConfig }) as Promise<HitTestingResponse>, hitTesting({
datasetId,
queryText: text,
retrieval_model: {
...retrievalConfig,
search_method: isEconomy ? RETRIEVE_METHOD.keywordSearch : retrievalConfig.search_method,
},
}) as Promise<HitTestingResponse>,
) )
if (!e) { if (!e) {
setHitResult(res) setHitResult(res)
@ -117,22 +124,17 @@ const TextAreaWithButton = ({
200 200
</Tag> </Tag>
)} )}
<Tooltip
selector="hit-testing-submit"
disabled={indexingTechnique === 'high_quality'}
content={t('datasetHitTesting.input.indexWarning') as string}
>
<div> <div>
<Button <Button
onClick={onSubmit} onClick={onSubmit}
type="primary" type="primary"
loading={loading} loading={loading}
disabled={indexingTechnique !== 'high_quality' ? true : (!text?.length || text?.length > 200)} disabled={(!text?.length || text?.length > 200)}
> >
{t('datasetHitTesting.input.testing')} {t('datasetHitTesting.input.testing')}
</Button> </Button>
</div> </div>
</Tooltip>
</div> </div>
</div> </div>

View File

@ -33,6 +33,7 @@ export enum RETRIEVE_METHOD {
fullText = 'full_text_search', fullText = 'full_text_search',
hybrid = 'hybrid_search', hybrid = 'hybrid_search',
invertedIndex = 'invertedIndex', invertedIndex = 'invertedIndex',
keywordSearch = 'keyword_search',
} }
export type VariableInput = { export type VariableInput = {