ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Bug]: api/completion endpoint returns 200 but body contains error

Open JamesAntisdel opened this issue 1 year ago • 5 comments

Is there an existing issue for the same bug?

  • [X] I have checked the existing issues.

Branch name

main

Commit ID

3b7b6240c3adb967c5fe9e98ed73c05cd60ecd46

Other environment information

No response

Actual behavior

API returns 200/OK with object:

data:{"retcode": 500, "retmsg": "'function' object is not subscriptable", "data": {"answer": "ERROR: 'function' object is not subscriptable", "reference": []}}

data:{"retcode": 0, "retmsg": "", "data": true}

Expected behavior

No response

Steps to reproduce

POST object with "conversation_id" and "messages" to <base_url>/v1/api/completion

Receive 200/OK and error

Additional information

No response

JamesAntisdel avatar Jun 12 '24 15:06 JamesAntisdel

Could you specify that errro. There's not any error message here.

KevinHuSh avatar Jun 13 '24 01:06 KevinHuSh

Screenshots attached. completionerror_hoppscotch completionerror

JamesAntisdel avatar Jun 13 '24 01:06 JamesAntisdel

What is the version of the docker image and the code? I suggest you to use dev version of image and pull the latest code.

KevinHuSh avatar Jun 14 '24 01:06 KevinHuSh

I have tried both latest and dev. They all have the same issue. All the other endpoints, including the ones that were not working before are functioning normally, i.e. list_chunks. It is just completion that shows this error.

Current env: Screenshot 2024-06-14 at 9 07 10 AM Screenshot 2024-06-14 at 9 08 07 AM

JamesAntisdel avatar Jun 14 '24 16:06 JamesAntisdel

I have worked around this issue but the bug remains. The issue is with the 'stream' option which if set to True will cause the retval 500. For now I am able to get completion results by specifying "stream": false.

JamesAntisdel avatar Jun 19 '24 16:06 JamesAntisdel