+18


![dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>](/assets/img/avatar_default.png)

![autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>](/assets/img/avatar_default.png)




FFXN
GitHub
yyh
盐粒 Yanli
autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Tianle
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Yunlu Wen
zyssyz123
Claude Opus 4.7
chariri
Asuka Minato
Copilot Autofix powered by AI
Nian
非法操作
Carmen Fernández Ruiz
wangxiaolei
QuantumGhost
L1nSn0w
Evan
Escape0707
Jingyi
Amr Sherif
ZHOU ZHICHEN
unknown
JzoNg
Xiyuan Chen
-LAN-
107bba0116
Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: EvanYao826 <[email protected]> Co-authored-by: yyh <[email protected]> Co-authored-by: 盐粒 Yanli <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Tianle <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yunlu Wen <[email protected]> Co-authored-by: zyssyz123 <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: chariri <[email protected]> Co-authored-by: Asuka Minato <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]> Co-authored-by: Nian <[email protected]> Co-authored-by: 非法操作 <[email protected]> Co-authored-by: Carmen Fernández Ruiz <[email protected]> Co-authored-by: wangxiaolei <[email protected]> Co-authored-by: QuantumGhost <[email protected]> Co-authored-by: L1nSn0w <[email protected]> Co-authored-by: Evan <[email protected]> Co-authored-by: Escape0707 <[email protected]> Co-authored-by: Jingyi <[email protected]> Co-authored-by: Amr Sherif <[email protected]> Co-authored-by: ZHOU ZHICHEN <[email protected]> Co-authored-by: unknown <[email protected]> Co-authored-by: JzoNg <[email protected]> Co-authored-by: Xiyuan Chen <[email protected]> Co-authored-by: -LAN- <[email protected]>
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
from uuid import UUID
|
|
|
|
from flask_restx import Resource
|
|
|
|
from controllers.common.schema import register_response_schema_models, register_schema_models
|
|
from fields.hit_testing_fields import HitTestingResponse
|
|
from libs.helper import dump_response
|
|
from libs.login import login_required
|
|
|
|
from .. import console_ns
|
|
from ..datasets.hit_testing_base import DatasetsHitTestingBase, HitTestingPayload
|
|
from ..wraps import (
|
|
account_initialization_required,
|
|
cloud_edition_billing_rate_limit_check,
|
|
setup_required,
|
|
)
|
|
|
|
register_schema_models(console_ns, HitTestingPayload)
|
|
register_response_schema_models(console_ns, HitTestingResponse)
|
|
|
|
|
|
@console_ns.route("/datasets/<uuid:dataset_id>/hit-testing")
|
|
class HitTestingApi(Resource, DatasetsHitTestingBase):
|
|
@console_ns.doc("test_dataset_retrieval")
|
|
@console_ns.doc(description="Test dataset knowledge retrieval")
|
|
@console_ns.doc(params={"dataset_id": "Dataset ID"})
|
|
@console_ns.expect(console_ns.models[HitTestingPayload.__name__])
|
|
@console_ns.response(
|
|
200,
|
|
"Hit testing completed successfully",
|
|
model=console_ns.models[HitTestingResponse.__name__],
|
|
)
|
|
@console_ns.response(404, "Dataset not found")
|
|
@console_ns.response(400, "Invalid parameters")
|
|
@setup_required
|
|
@login_required
|
|
@account_initialization_required
|
|
@cloud_edition_billing_rate_limit_check("knowledge")
|
|
def post(self, dataset_id: UUID) -> dict[str, object]:
|
|
dataset_id_str = str(dataset_id)
|
|
|
|
dataset = self.get_and_validate_dataset(dataset_id_str)
|
|
args = self.parse_args(console_ns.payload)
|
|
self.hit_testing_args_check(args)
|
|
|
|
return dump_response(HitTestingResponse, self.perform_hit_testing(dataset, args))
|