Copilot commented on code in PR #932:
URL: https://github.com/apache/dubbo-go-samples/pull/932#discussion_r2384424035


##########
llm/config/config.go:
##########
@@ -104,12 +131,36 @@ func Load(envFile string) (*Config, error) {
                        return
                }
 
+               // Load LLM base URL and API key
+               llmBaseURL := os.Getenv("LLM_BASE_URL")
+               llmAPIKey := os.Getenv("LLM_API_KEY")
+
+               // For backward compatibility with Ollama
                ollamaURL := os.Getenv("OLLAMA_URL")
-               if ollamaURL == "" {
-                       configErr = fmt.Errorf("OLLAMA_URL is not set")
+               if llmBaseURL == "" && ollamaURL != "" {
+                       // Use OLLAMA_URL as fallback for LLM_BASE_URL
+                       llmBaseURL = ollamaURL
+               }
+
+               // Set default URL for Ollama if not configured
+               if llmBaseURL == "" && config.LLMProvider == "ollama" {
+                       llmBaseURL = "http://localhost:11434";
+               }
+
+               // Validate configuration based on provider
+               if config.LLMProvider != "ollama" && llmBaseURL == "" {

Review Comment:
   This validation is incorrect for OpenAI provider. OpenAI doesn't require 
LLM_BASE_URL as it has a default endpoint, but this code will fail if 
LLM_BASE_URL is not set for OpenAI.
   ```suggestion
                // Set default URL for OpenAI if not configured
                if llmBaseURL == "" && config.LLMProvider == "openai" {
                        llmBaseURL = "https://api.openai.com/v1";
                }
   
                // Validate configuration based on provider
                if config.LLMProvider != "ollama" && config.LLMProvider != 
"openai" && llmBaseURL == "" {
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to