make cites in conversation API configurable (#576)

### What problem does this PR solve?

#566 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
KevinHuSh 2024-04-28 11:56:17 +08:00 committed by GitHub
parent ae501c58fa
commit 038822f3bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -136,7 +136,7 @@ def chat(dialog, messages, **kwargs):
chat_logger.info("User: {}|Assistant: {}".format( chat_logger.info("User: {}|Assistant: {}".format(
msg[-1]["content"], answer)) msg[-1]["content"], answer))
if knowledges and prompt_config.get("quote", True): if knowledges and (prompt_config.get("quote", True) and kwargs.get("quote", True)):
answer, idx = retrievaler.insert_citations(answer, answer, idx = retrievaler.insert_citations(answer,
[ck["content_ltks"] [ck["content_ltks"]
for ck in kbinfos["chunks"]], for ck in kbinfos["chunks"]],

View File

@ -221,6 +221,7 @@ This will be called to get the answer to users' questions.
|------|-------|----|----| |------|-------|----|----|
| conversation_id| string | No | This is from calling /new_conversation.| | conversation_id| string | No | This is from calling /new_conversation.|
| messages| json | No | All the conversation history stored here including the latest user's question.| | messages| json | No | All the conversation history stored here including the latest user's question.|
| quote | bool | Yes | Default: true |
### Response ### Response
```json ```json