Skip to content

fix(ai-proxy-multi): panic when instance dont have custom endpoint#12584

Merged
Revolyssup merged 3 commits into
apache:masterfrom
Revolyssup:revolyssup/fix-ai-health-check
Sep 4, 2025
Merged

fix(ai-proxy-multi): panic when instance dont have custom endpoint#12584
Revolyssup merged 3 commits into
apache:masterfrom
Revolyssup:revolyssup/fix-ai-health-check

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Description

local endpoint = core.table.try_read_attr(instance_conf, "override", "endpoint")

endpoint will be nil when user use official ai service as instance.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Sep 3, 2025
Comment thread apisix/plugins/ai-proxy-multi.lua
@Revolyssup
Revolyssup requested a review from membphis September 4, 2025 06:40
membphis
membphis previously approved these changes Sep 4, 2025
nic-6443
nic-6443 previously approved these changes Sep 4, 2025
Comment thread apisix/plugins/ai-proxy-multi.lua Outdated
if port == "" then
port = (scheme == "https") and "443" or "80"
if endpoint then
scheme, host, port = endpoint:match("^(https?)://([^:/]+):?(%d*)/?.*$")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use this constant endpoint_regex.

local endpoint_regex = "^(https?)://([^:/]+):?(%d*)/?.*$"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@Revolyssup
Revolyssup dismissed stale reviews from nic-6443 and membphis via 49291ee September 4, 2025 10:27
@Revolyssup
Revolyssup merged commit 9e34661 into apache:master Sep 4, 2025
29 of 31 checks passed
@Revolyssup
Revolyssup deleted the revolyssup/fix-ai-health-check branch September 4, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants