Updated dataset query attribution to use the UserFrom enum in the callback and hit-testing paths, matching the retrieval flow and removing literal role strings. Adjusted api/core/callback_handler/index_tool_callback_handler.py and api/services/hit_testing_service.py where DatasetQuery records are created.

fix(api): use UserFrom for dataset query created_by_role

Tests not run (not requested).
This commit is contained in:
-LAN-
2026-01-06 19:00:21 +08:00
parent 27932cb669
commit c7a3a4fc0e
2 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,7 @@ from core.rag.retrieval.retrieval_methods import RetrievalMethod
from extensions.ext_database import db
from models import Account
from models.dataset import Dataset, DatasetQuery
from models.enums import UserFrom
logger = logging.getLogger(__name__)
@ -98,7 +99,7 @@ class HitTestingService:
content=json.dumps(dataset_queries),
source="hit_testing",
source_app_id=None,
created_by_role="account",
created_by_role=UserFrom.ACCOUNT,
created_by=account.id,
)
db.session.add(dataset_query)
@ -138,7 +139,7 @@ class HitTestingService:
content=query,
source="hit_testing",
source_app_id=None,
created_by_role="account",
created_by_role=UserFrom.ACCOUNT,
created_by=account.id,
)