infiniflow / ragflow

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.
https://ragflow.io
Apache License 2.0
18.18k stars 1.84k forks source link

[Feature Request]: Requirement: Currently, the answers in the chat API do not show citations. It is recommended to show citations. #2593

Open mi-zy opened 2 days ago

mi-zy commented 2 days ago

Is there an existing issue for the same feature request?

Is your feature request related to a problem?

Show Quote is selected,so chat API recommended to show citations.

Describe the feature you'd like

chat API recommended to show citations.

Describe implementation you've considered

No response

Documentation, adoption, use case

No response

Additional information

No response

Feiue commented 1 day ago

Is there an existing issue for the same feature request?

  • [x] I have checked the existing issues.

Is your feature request related to a problem?

Show Quote is selected,so chat API recommended to show citations.

Describe the feature you'd like

chat API recommended to show citations.

Describe implementation you've considered

No response

Documentation, adoption, use case

No response

Additional information

No response

Which API endpoint are you using? I'd like to see your URL or request.

mi-zy commented 1 day ago

url like this : ip:port/chat/share?shared_id=ragflow-IzN2JjNTc4NzY5ZTE4NGVhZT&from=chat

mi-zy commented 1 day ago

![Uploading 1.JPG…]()

Feiue commented 1 day ago

url like this : ip:port/chat/share?shared_id=ragflow-IzN2JjNTc4NzY5ZTE4NGVhZT&from=chat

ok,I will check it

Feiue commented 1 day ago

This jpg link seems to be wrong

Feiue commented 1 day ago

If you use ip:port/chat/share?shared_id=ragflow-IzN2JjNTc4NzY5ZTE4NGVhZT&from=chat, you can't set quote=true, so you can't see the quote.

Suggest you use ip:port/v1/api/completion if you want to set quote. This is the api. You can curl this url and set data like:

{
    "conversation_id":"99071d7e7bed11ef8a5d0242ac120006",
    "messages":[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "1"}
    ],
    "quote":true
}

Then you could see the reference

mi-zy commented 22 hours ago

If I call the API using the GET method in the address bar, can "quote" be set to true by default? What you mentioned is a POST request, where parameters are placed in the request body and won't be displayed in the address bar. But I am using the address bar. GET方式显示引文

Feiue commented 22 hours ago

If I call the API using the GET method in the address bar, can "quote" be set to true by default? What you mentioned is a POST request, where parameters are placed in the request body and won't be displayed in the address bar. But I am using the address bar.

If you want to see reference in ip:port/chat/share?shared_id=ragflow-IzN2JjNTc4NzY5ZTE4NGVhZT&from=chat. You can try to change the source code which is in api/apps/api_app.py line 197. if "quote" not in req: req["quote"] = False. If you must use it in demo, tell me please.

mi-zy commented 22 hours ago

OK,thanks。Here is another phenomenon. see what the problem is. “AttributeError("'list' object has no attribute 'get'")” typewong

Feiue commented 21 hours ago

OK,thanks。Here is another phenomenon. see what the problem is. “AttributeError("'list' object has no attribute 'get'")” typewong

The problem appears in which situation?

mi-zy commented 21 hours ago

by https://demo.ragflow.io/ Chat Bot API-->Preview,at https://demo.ragflow.io/chat/share?shared_id=ragflow-Y3Zjc3...YTA3NDIwMT&from=chat ask a quetion ,Switch tabs. Then this error occurs.

mi-zy commented 21 hours ago

If I call the API using the GET method in the address bar, can "quote" be set to true by default? What you mentioned is a POST request, where parameters are placed in the request body and won't be displayed in the address bar. But I am using the address bar.

If you want to see reference in ip:port/chat/share?shared_id=ragflow-IzN2JjNTc4NzY5ZTE4NGVhZT&from=chat. You can try to change the source code which is in api/apps/api_app.py line 197. if "quote" not in req: req["quote"] = False. If you must use it in demo, tell me please.

I hope to make this changes(...if "quote" not in req: req["quote"] = True) in the images file.(image: swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:dev)

Feiue commented 21 hours ago

If I call the API using the GET method in the address bar, can "quote" be set to true by default? What you mentioned is a POST request, where parameters are placed in the request body and won't be displayed in the address bar. But I am using the address bar.

If you want to see reference in . You can try to change the source code which is in line 197. . If you must use it in , tell me please.ip:port/chat/share?shared_id=ragflow-IzN2JjNTc4NzY5ZTE4NGVhZT&from=chat``api/apps/api_app.py``if "quote" not in req: req["quote"] = False``demo

I hope to make this changes(...if "quote" not in req: req["quote"] = True) in the images file.(image: swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:dev)

This may can't be implemented in demo, you can change it in local.

Feiue commented 21 hours ago

OK,thanks。Here is another phenomenon. see what the problem is. “AttributeError("'list' object has no attribute 'get'")” typewong

I understand it, it's a bug and will fix it