Ink-Osier / PandoraToV1Api

站在巨人的肩膀上的项目,感谢zhile大佬的Pandora-Next项目
517 stars 106 forks source link

初步尝试有问题,返回了{"message":"Welcome to Inker's World"} #45

Closed lin-z-z closed 5 months ago

lin-z-z commented 5 months ago

大佬,我的config的配置如下: { "log_level": "DEBUG", "need_log_to_file": "true", "process_workers": 2, "process_threads": 2, "pandora_base_url": "http://10.0.8.8:8181", "pandora_api_prefix": "tokensTool01", "backend_container_url": "http://10.0.8.8:50011", "backend_container_api_prefix": "", "key_for_gpts_info": "fk-", "gpt_4_s_new_name": "gpt-4-s", "gpt_4_mobile_new_name": "gpt-4-mobile,dall-e-3", "gpt_3_5_new_name": "gpt-3.5-turbo", "need_delete_conversation_after_response": "false", "use_oaiusercontent_url": "false", "use_pandora_file_server": "true", "custom_arkose_url": "false", "arkose_urls": "", "dalle_prompt_prefix": "请严格根据我的以下要求完成绘图任务,如果我没有发出指定的绘画指令,则绘制出我发出的文字对应的图片:", "bot_mode": { "enabled": "true", "enabled_markdown_image_output": "true", "enabled_plain_image_url_output": "false", "enabled_bing_reference_output": "false", "enabled_plugin_output": "false" } } 我使用curl命令如下: curl http://10.0.8.8:50011/v1/images/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer fk-" \ -d '{ "model": "gpt-4-s", "prompt": "A cute baby sea otter" }' 我在测试过程中,命令行调用结果如下: image 日志如下:

2024-01-08 08:10:15,867 [DEBUG] - 请求体: b'{\n    "model": "gpt-4-s",\n    "prompt": "A cute baby sea otter"\n  }'
10.0.8.8 - - [08/Jan/2024:08:10:15 +0000] "POST /v1/images/completions HTTP/1.1" 200 39 "-" "curl/7.29.0"
2024-01-08 08:23:36,138 [DEBUG] - 未知请求: v1/images/completions
2024-01-08 08:23:36,138 [DEBUG] - 请求方法: POST
2024-01-08 08:23:36,138 [DEBUG] - 请求头: User-Agent: curl/7.29.0
Host: 10.0.8.8:50011
Accept: */*
Content-Type: application/json
Authorization: Bearer fk-xxx
Content-Length: 67

2024-01-08 08:23:36,139 [DEBUG] - 请求体: b'{\n    "model": "gpt-4-s",\n    "prompt": "A cute baby sea otter"\n  }'
10.0.8.8 - - [08/Jan/2024:08:23:36 +0000] "POST /v1/images/completions HTTP/1.1" 200 39 "-" "curl/7.29.0"

初始启动日志如下:

2024-01-08 07:53:34,275 [INFO] - need_delete_conversation_after_response: False
2024-01-08 07:53:34,275 [INFO] - use_oaiusercontent_url: False
2024-01-08 07:53:34,275 [INFO] - Chat 接口 URI: /v1/chat/completions
2024-01-08 07:53:34,275 [INFO] - use_pandora_file_server: True
2024-01-08 07:53:34,275 [INFO] - 绘图接口 URI: /v1/images/generations
2024-01-08 07:53:34,276 [INFO] - custom_arkose_url: False
2024-01-08 07:53:34,276 [INFO] - need_delete_conversation_after_response: False
2024-01-08 07:53:34,276 [INFO] - DALLE_prompt_prefix: 请严格根据我的以下要求完成绘图任务,如果我没有发出指定的绘画指令,则绘制出我发出的文字对应的图片:
2024-01-08 07:53:34,276 [INFO] - use_oaiusercontent_url: False
2024-01-08 07:53:34,276 [INFO] - ==========================================
2024-01-08 07:53:34,276 [INFO] - use_pandora_file_server: True
2024-01-08 07:53:34,276 [INFO] - GPTS 配置信息
2024-01-08 07:53:34,276 [INFO] - custom_arkose_url: False
2024-01-08 07:53:34,276 [INFO] - DALLE_prompt_prefix: 请严格根据我的以下要求完成绘图任务,如果我没有发出指定的绘画指令,则绘制出我发出的文字对应的图片:
2024-01-08 07:53:34,276 [INFO] - ==========================================
2024-01-08 07:53:34,276 [INFO] - GPTS 配置信息
2024-01-08 07:53:34,278 [DEBUG] - Starting new HTTP connection (1): 10.0.8.8:8181
2024-01-08 07:53:34,278 [DEBUG] - Starting new HTTP connection (1): 10.0.8.8:8181
2024-01-08 07:53:35,252 [DEBUG] - http://10.0.8.8:8181 "GET /tokensTool01/backend-api/gizmos/g-YyyyMT9XH-chatgpt-classic HTTP/1.1" 200 1842
2024-01-08 07:53:35,254 [DEBUG] - Starting new HTTP connection (1): 10.0.8.8:8181
2024-01-08 07:53:35,779 [DEBUG] - http://10.0.8.8:8181 "GET /tokensTool01/backend-api/gizmos/g-CFsXuTRfy-pandoranextzhu-shou HTTP/1.1" 200 None
2024-01-08 07:53:35,780 [INFO] - 当前可用 GPTS 列表: ['gpt-4-s', 'gpt-4-mobile', 'dall-e-3', 'gpt-3.5-turbo', 'gpt-4-classic', 'pandoraNext']
2024-01-08 07:53:35,780 [INFO] - ==========================================
2024-01-08 07:53:36,206 [DEBUG] - http://10.0.8.8:8181 "GET /tokensTool01/backend-api/gizmos/g-YyyyMT9XH-chatgpt-classic HTTP/1.1" 200 1842
2024-01-08 07:53:36,208 [DEBUG] - Starting new HTTP connection (1): 10.0.8.8:8181
2024-01-08 07:53:36,940 [DEBUG] - http://10.0.8.8:8181 "GET /tokensTool01/backend-api/gizmos/g-CFsXuTRfy-pandoranextzhu-shou HTTP/1.1" 200 None
2024-01-08 07:53:36,941 [INFO] - 当前可用 GPTS 列表: ['gpt-4-s', 'gpt-4-mobile', 'dall-e-3', 'gpt-3.5-turbo', 'gpt-4-classic', 'pandoraNext']
2024-01-08 07:53:36,941 [INFO] - ==========================================
2024-01-08 07:57:12,164 [DEBUG] - 未知请求: v1/completions
2024-01-08 07:57:12,165 [DEBUG] - 请求方法: POST
2024-01-08 07:57:12,165 [DEBUG] - 请求头: User-Agent: curl/7.29.0
Host: 10.0.8.8:50011

我想请问下这配置中是否有什么错误么,无论我把model修改为其他的,返回的都是{"message":"Welcome to Inker's World"}

Ink-Osier commented 5 months ago
2024-01-08 07:53:34,275 [INFO] - Chat 接口 URI: /v1/chat/completions
2024-01-08 07:53:34,275 [INFO] - 绘图接口 URI: /v1/images/generations
lin-z-z commented 5 months ago

chat/completions

打扰了大佬,写错url了,我测试画图接口没问题,但是测试chat接口会出现这个报错, 请求如下: curl http://10.0.8.8:50011/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer fk-***" \ -d '{ "model": "gpt-3.5-turbo", "prompt": "say this is a test", "max_tokens": 7, "temperature": 0 }' 报错日志如下:

2024-01-08 08:36:06,836 [ERROR] - Exception on /v1/chat/completions [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/app/main.py", line 1478, in chat_completions
    upstream_response = send_text_prompt_and_get_response(messages, api_key, stream, model)
  File "/app/main.py", line 529, in send_text_prompt_and_get_response
    for message in messages:
TypeError: 'NoneType' object is not iterable
10.0.8.8 - - [08/Jan/2024:08:36:06 +0000] "POST /v1/chat/completions HTTP/1.1" 500 265 "-" "curl/7.29.0"
Ink-Osier commented 5 months ago

请求格式有问题,请求体具体格式见openai官方的api说明

lin-z-z commented 5 months ago

请求格式有问题,请求体具体格式见openai官方的api说明

额,我在官网看到的请求格式就是这样的,是因为不同的模型有差别么 image

Ink-Osier commented 5 months ago

/v1/chat/completions看这个接口的文档

lin-z-z commented 5 months ago

/v1/chat/completions看这个接口的文档

可以了,谢谢大佬耐心的解答

clippers1 commented 5 months ago

想问一下。画图是不是需要自己账号支持gpt4

lin-z-z commented 5 months ago

想问一下。画图是不是需要自己账号支持gpt4

是的,确保自己开通了plus