Skip to content

Commit

Permalink
Add API to get doc info by doc ids (#1986)
Browse files Browse the repository at this point in the history
Supports use API to get doc info by doc ids

### What problem does this PR solve?

feat: Supports use API to get doc info by doc ids

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
  • Loading branch information
wingjson and KevinHuSh authored Aug 19, 2024
1 parent 2302a6b commit 5a4e64e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/apps/api_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,19 @@ def list_kb_docs():
except Exception as e:
return server_error_response(e)

@manager.route('/document/infos', methods=['POST'])
@validate_request("doc_ids")
def docinfos():
token = request.headers.get('Authorization').split()[1]
objs = APIToken.query(token=token)
if not objs:
return get_json_result(
data=False, retmsg='Token is not valid!"', retcode=RetCode.AUTHENTICATION_ERROR)
req = request.json
doc_ids = req["doc_ids"]
docs = DocumentService.get_by_ids(doc_ids)
return get_json_result(data=list(docs.dicts()))


@manager.route('/document', methods=['DELETE'])
# @login_required
Expand Down

0 comments on commit 5a4e64e

Please sign in to comment.