Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api接收的数据与chat2db发送的不一致 #7

Open
clyhs opened this issue Jul 18, 2024 · 0 comments
Open

api接收的数据与chat2db发送的不一致 #7

clyhs opened this issue Jul 18, 2024 · 0 comments

Comments

@clyhs
Copy link

clyhs commented Jul 18, 2024

chat2db发送的格式为:
,{"messages":[{"role":"user","content":"### Please follow the below table properties and SQL inputConvert natural language into SQL queries. \n#\n### MYSQL SQL tables, with their properties:\n#\n# ["CREATE TABLE user ) ENGINE=InnoDB AUTO_INCREMENT=11075 DEFAULT CHARSET=utf8"]\n#\n#\n### SQL input: username"}],"stream":true,"model":"sqlcoder-7b"}

而项目的解析
json_post_raw = await request.json()
print(json_post_raw)
json_post = json.dumps(json_post_raw)
json_post_list = json.loads(json_post)
question = json_post_list.get('prompt')
prompt = prompt_template.format(
user_question=question.replace("#","")
)
取prompt怎么能取到?
报错如下:
File "/root/miniconda3/envs/chat2dbsqlcoder/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
File "/home/tiancom/chat2db-sqlcoder-deploy/api.py", line 33, in create_item
user_question=question.replace("#","")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant