mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 07:22:34 +00:00
semantic search return content (#5897)
This commit is contained in:
@@ -344,6 +344,7 @@ export default class AISearch extends Component {
|
|||||||
items[i]['repo_id'] = data[i].repo_id;
|
items[i]['repo_id'] = data[i].repo_id;
|
||||||
items[i]['repo_name'] = data[i].repo_name;
|
items[i]['repo_name'] = data[i].repo_name;
|
||||||
items[i]['is_dir'] = data[i].is_dir;
|
items[i]['is_dir'] = data[i].is_dir;
|
||||||
|
items[i]['content'] = data[i].content;
|
||||||
items[i]['link_content'] = decodeURI(data[i].fullpath).substring(1);
|
items[i]['link_content'] = decodeURI(data[i].fullpath).substring(1);
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
|
@@ -20,6 +20,7 @@ from seahub.ai.utils import create_library_sdoc_index, search, update_library_sd
|
|||||||
get_file_download_token, get_search_repos, RELATED_REPOS_PREFIX, RELATED_REPOS_CACHE_TIMEOUT, SEARCH_REPOS_LIMIT, \
|
get_file_download_token, get_search_repos, RELATED_REPOS_PREFIX, RELATED_REPOS_CACHE_TIMEOUT, SEARCH_REPOS_LIMIT, \
|
||||||
format_repos
|
format_repos
|
||||||
from seahub.utils import is_org_context, normalize_cache_key
|
from seahub.utils import is_org_context, normalize_cache_key
|
||||||
|
from seahub.views import check_folder_permission
|
||||||
|
|
||||||
from seaserv import seafile_api
|
from seaserv import seafile_api
|
||||||
|
|
||||||
@@ -104,6 +105,11 @@ class Search(APIView):
|
|||||||
error_msg = 'Library %s not found.' % search_repo
|
error_msg = 'Library %s not found.' % search_repo
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
|
# permission check
|
||||||
|
if not check_folder_permission(request, search_repo, '/'):
|
||||||
|
error_msg = 'Permission denied.'
|
||||||
|
return api_error(status.HTTP_403_FORBIDDEN, error_msg)
|
||||||
|
|
||||||
repos = [(repo.id, repo.origin_repo_id, repo.origin_path, repo.name)]
|
repos = [(repo.id, repo.origin_repo_id, repo.origin_path, repo.name)]
|
||||||
is_all_repo = False
|
is_all_repo = False
|
||||||
|
|
||||||
@@ -175,6 +181,11 @@ class QuestionAnsweringSearchInLibrary(APIView):
|
|||||||
error_msg = 'Library %s not found.' % repo_id
|
error_msg = 'Library %s not found.' % repo_id
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
|
# permission check
|
||||||
|
if not check_folder_permission(request, repo_id, '/'):
|
||||||
|
error_msg = 'Permission denied.'
|
||||||
|
return api_error(status.HTTP_403_FORBIDDEN, error_msg)
|
||||||
|
|
||||||
repo = (repo.id, repo.origin_repo_id, repo.origin_path, repo.name)
|
repo = (repo.id, repo.origin_repo_id, repo.origin_path, repo.name)
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
|
Reference in New Issue
Block a user