Skip to content

Commit

Permalink
fix(ai-proxy): internal server error on path parse failure
Browse files Browse the repository at this point in the history
(cherry picked from commit 6374c55)
  • Loading branch information
tysoekong authored and locao committed May 8, 2024
1 parent 270b426 commit 4ae77cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kong/llm/drivers/llama2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function _M.configure_request(conf)
local parsed_url = socket_url.parse(conf.model.options.upstream_url)

-- if the path is read from a URL capture, ensure that it is valid
parsed_url.path = string_gsub(parsed_url.path, "^/*", "/")
parsed_url.path = (parsed_url.path and string_gsub(parsed_url.path, "^/*", "/")) or "/"

kong.service.request.set_path(parsed_url.path)
kong.service.request.set_scheme(parsed_url.scheme)
Expand Down
2 changes: 1 addition & 1 deletion kong/llm/drivers/mistral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function _M.configure_request(conf)
local parsed_url = socket_url.parse(conf.model.options.upstream_url)

-- if the path is read from a URL capture, ensure that it is valid
parsed_url.path = string_gsub(parsed_url.path, "^/*", "/")
parsed_url.path = (parsed_url.path and string_gsub(parsed_url.path, "^/*", "/")) or "/"

kong.service.request.set_path(parsed_url.path)
kong.service.request.set_scheme(parsed_url.scheme)
Expand Down

0 comments on commit 4ae77cb

Please sign in to comment.