2024-10-14 17:26:04 +08:00
|
|
|
from controllers.console.datasets.hit_testing_base import DatasetsHitTestingBase
|
|
|
|
from controllers.service_api import api
|
2025-06-18 14:05:28 +08:00
|
|
|
from controllers.service_api.wraps import DatasetApiResource, cloud_edition_billing_rate_limit_check
|
2024-10-14 17:26:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
class HitTestingApi(DatasetApiResource, DatasetsHitTestingBase):
|
2025-06-18 14:05:28 +08:00
|
|
|
@cloud_edition_billing_rate_limit_check("knowledge", "dataset")
|
2024-10-14 17:26:04 +08:00
|
|
|
def post(self, tenant_id, dataset_id):
|
|
|
|
dataset_id_str = str(dataset_id)
|
|
|
|
|
|
|
|
dataset = self.get_and_validate_dataset(dataset_id_str)
|
|
|
|
args = self.parse_args()
|
|
|
|
self.hit_testing_args_check(args)
|
|
|
|
|
|
|
|
return self.perform_hit_testing(dataset, args)
|
|
|
|
|
|
|
|
|
2024-10-31 18:29:12 +08:00
|
|
|
api.add_resource(HitTestingApi, "/datasets/<uuid:dataset_id>/hit-testing", "/datasets/<uuid:dataset_id>/retrieve")
|