[Bug]: /api/v1/chats/{chat_id}/sessions default opening is wrong
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Branch name
0.13.0
Commit ID
issue_create_session_241108
Other environment information
No response
Actual behavior
create sessions接口 /api/v1/chats/{chat_id}/sessions默认的助手开场白不对,应该根据chatId获取设置的,然后再返回
Expected behavior
No response
Steps to reproduce
create sessions接口 /api/v1/chats/{chat_id}/sessions默认的助手开场白不对,应该根据chatId获取设置的,然后再返回
Additional information
No response
这个我一直无法访问
/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}")
@Feiue Any updates?
/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}")
'Authorization': 'Bearer ragflow-JlMmIyYTFlOTc4OTExZWY5YmNiMDI'. This authentication method is correct.