[Question]: How to get correct HTTP response.
Describe your problem
/api/v1/chats/{chat_id}/sessions
通过这个链接http://localhost/api/v1/chats/chat_id/sessions无法访问这个链接,我想通过request获得响应的结果,但是无法传递access_token请问该怎么解决? 我的代码是这样的“ import requests import json
login
session=requests.session()
session.headers={ "User-agent":'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36', 'Content-Type': 'application/json', 'Authorization': 'Bearer ragflow-JlMmIyYTFlOTc4OTExZWY5YmNiMDI' }
login_url='http://localhost/v1/user/login'
login_payload={
"email": "[email protected]",
"password": "..."
}
login_response=session.post(login_url,headers=session.headers,json=login_payload)
print("Login Cookies:", session.cookies.get_dict())
if login_response.ok: with open('rag.html', 'wb') as f: f.write(login_response.content) print("登录成功,页面已保存到 rag.html")
try:
login_data= login_response.json()
new_access_token = login_data['data']['access_token']
session.headers['access_token']=new_access_token
print(f"Access token: {new_access_token}")
Conversation_url='http://localhost/chat?dialogId=b6f6576c943911efaa650242ac120006&conversationId=ca5c652be2ff49a9b32be1c5c70a70cb&isNew='
params={
'conversation_id': 'ca5c652be2ff49a9b32be1c5c70a70cb'
}
response2=session.get(Conversation_url,headers=session.headers,params=params)
if response2.ok:
with open('reply.html',"wb") as f:
f.write(response2.content)
print("成功回复")
else:
print("登陆失败")
except json.JSONDecoderError:
print("登录响应不是有效的JSON格式")
except KeyError:
print("无法登录响应从中提取access_token")
else: print(f"登录失败: {login_response.status_code} - {login_response.text}")
响应的结果是:
代码可以正常运行,但是无法拿到结果,分析可能是因为access_token在变化,无法登录,而且每次运行后,ragflow会退出登录,请问该怎么解决?
Please refer this to apply HTTP API.
Please refer this to apply HTTP API.
unfortunately, i got this: { "data": null, "retcode": 100, "retmsg": "<NotFound '404: Not Found'>" } when i use all http api from here:https://github.com/infiniflow/ragflow/blob/main/example/http/simple_example.sh
What's the version of the docker image?
What's the version of the docker image?
Actually,it is the Dev version. which version is more reliable?
Please refer this to apply HTTP API.
unfortunately, i got this: { "data": null, "retcode": 100, "retmsg": "<NotFound '404: Not Found'>" } when i use all http api from here:https://github.com/infiniflow/ragflow/blob/main/example/http/simple_example.sh
i take following steps and get correct result: 1 update to latest code(https://github.com/infiniflow/ragflow); 2 cd infiniflow/ragflow; 3 docker compose -f docker-compose.yml up -d;
Please refer this to apply HTTP API.↳
unfortunately, i got this: { "data": null, "retcode": 100, "retmsg": "<NotFound '404: Not Found'>" } when i use all http api from here:https://github.com/infiniflow/ragflow/blob/main/example/http/simple_example.sh↳
i take following steps and get correct result: 1 update to latest code(https://github.com/infiniflow/ragflow); 2 cd infiniflow/ragflow; 3 docker compose -f docker-compose.yml up -d;↳
Try to modify RAGFLOW_IMAGE=infiniflow/ragflow:dev-slim to dev in docker/.env , then docker compose -f docker-compose.yml up -d