text-generation-webui
text-generation-webui copied to clipboard
405 Method Not Allowed
Describe the bug
curl -v http://127.0.0.1:8000/v1/chat/completions
- Trying 127.0.0.1:8000...
- Connected to 127.0.0.1 (127.0.0.1) port 8000
GET /v1/chat/completions HTTP/1.1 Host: 127.0.0.1:8000 User-Agent: curl/8.6.0 Accept: /
< HTTP/1.1 405 Method Not Allowed < date: Fri, 22 Mar 2024 23:05:10 GMT < server: uvicorn < allow: POST < content-length: 31 < content-type: application/json <
- Connection #0 to host 127.0.0.1 left intact {"detail":"Method Not Allowed"}%
Is there an existing issue for this?
- [X] I have searched the existing issues
Reproduction
python server.py --trust-remote-code --extension openai --listen --api --api-port 8000
Screenshot
No response
Logs
Exception in ASGI application
Traceback (most recent call last):
File "/home/nano/.local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/applications.py", line 116, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
await self.app(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
raise exc
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
await app(scope, receive, sender)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 746, in __call__
await route.handle(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 75, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
raise exc
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
await app(scope, receive, sender)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 70, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/extensions/openai/script.py", line 137, in openai_chat_completions
response = OAIcompletions.chat_completions(to_dict(request_data), is_legacy=is_legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/extensions/openai/completions.py", line 536, in chat_completions
return deque(generator, maxlen=1).pop()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/extensions/openai/completions.py", line 315, in chat_completions_common
prompt = generate_chat_prompt(user_input, generate_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/modules/chat.py", line 97, in generate_chat_prompt
user_bio=replace_character_names(state['user_bio'], state['name1'], state['name2']),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/modules/chat.py", line 636, in replace_character_names
text = text.replace('{{user}}', name1).replace('{{char}}', name2)
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
Exception in ASGI application
Traceback (most recent call last):
File "/home/nano/.local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/applications.py", line 116, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
await self.app(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
raise exc
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
await app(scope, receive, sender)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 746, in __call__
await route.handle(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 75, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
raise exc
File "/home/nano/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
await app(scope, receive, sender)
File "/home/nano/.local/lib/python3.11/site-packages/starlette/routing.py", line 70, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nano/.local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/extensions/openai/script.py", line 137, in openai_chat_completions
response = OAIcompletions.chat_completions(to_dict(request_data), is_legacy=is_legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/extensions/openai/completions.py", line 536, in chat_completions
return deque(generator, maxlen=1).pop()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/extensions/openai/completions.py", line 315, in chat_completions_common
prompt = generate_chat_prompt(user_input, generate_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/modules/chat.py", line 97, in generate_chat_prompt
user_bio=replace_character_names(state['user_bio'], state['name1'], state['name2']),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/text-generation-webui/modules/chat.py", line 636, in replace_character_names
text = text.replace('{{user}}', name1).replace('{{char}}', name2)
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
System Info
archlinux
Kernel: 6.6.22-1-lts
curl -v http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json"
-d '{
"messages": [
{
"role": "user",
"content": "Hello! Who are you?"
}
],
"mode": "chat",
"character": "Example"
}'
- Trying 127.0.0.1:8000...
- Connected to 127.0.0.1 (127.0.0.1) port 8000
POST /v1/chat/completions HTTP/1.1 Host: 127.0.0.1:8000 User-Agent: curl/8.6.0 Accept: / Content-Type: application/json Content-Length: 158
< HTTP/1.1 500 Internal Server Error < date: Fri, 22 Mar 2024 22:59:50 GMT < server: uvicorn < content-length: 21 < content-type: text/plain; charset=utf-8 <
- Connection #0 to host 127.0.0.1 left intact Internal Server Error%
I'm having the same issue here as well
I also got this error it seems to be in the chat endpoint.
I'm having this error as well
Having the same error with the exact same message
I'm having the same issue here as well
https://github.com/oobabooga/text-generation-webui/pull/5716/files
the error is in chatcompletions and there were changes
solution, add a user_bio key value https://github.com/oobabooga/text-generation-webui/issues/5761
I tried to go back to snapshot 2024-03-10 without success.