membphis commented on code in PR #12878: URL: https://github.com/apache/apisix/pull/12878#discussion_r2680955996
########## apisix/plugins/ai-proxy/schema.lua: ########## Review Comment: try to reuse the provider array list <img width="623" height="630" alt="Image" src="https://github.com/user-attachments/assets/a8825157-c0a7-4452-9eb6-3f2deb7e61fe" /> we can put the array list in `schema.lua` ########## apisix/plugins/ai-drivers/schema.lua: ########## @@ -45,14 +45,16 @@ _M.chat_request_schema = { ["openai"] = openai_compatible_chat_schema, ["deepseek"] = openai_compatible_chat_schema, ["openai-compatible"] = openai_compatible_chat_schema, - ["azure-openai"] = openai_compatible_chat_schema + ["azure-openai"] = openai_compatible_chat_schema, + ["openrouter"] = openai_compatible_chat_schema } function _M.is_openai_compatible_provider(provider) if provider == "openai" or Review Comment: I think we can use an array object to maintain it It is easy to maintain in this way, here is the example code: ```lua do local openai_compatible_list = { "openai", "azure_openai", ... ... "together", } local openai_compatible_kv = {} for _, provider in ipairs(openai_compatible_list) do openai_compatible_kv[provider] = true end function _M.is_openai_compatible_provider(provider) if openai_compatible_kv[provider] then return true end ... end end ########## apisix/plugins/ai-proxy/schema.lua: ########## @@ -130,7 +131,8 @@ _M.ai_proxy_schema = { "deepseek", "aimlapi", "openai-compatible", - "azure-openai" + "azure-openai", Review Comment: ditto ########## apisix/plugins/ai-drivers/schema.lua: ########## @@ -45,14 +45,16 @@ _M.chat_request_schema = { ["openai"] = openai_compatible_chat_schema, ["deepseek"] = openai_compatible_chat_schema, ["openai-compatible"] = openai_compatible_chat_schema, - ["azure-openai"] = openai_compatible_chat_schema + ["azure-openai"] = openai_compatible_chat_schema, + ["openrouter"] = openai_compatible_chat_schema Review Comment: we can add `,` at the end of this line -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
