AlexStocks commented on PR #823: URL: https://github.com/apache/dubbo-go-samples/pull/823#issuecomment-2781234700
``` The changes in the pull request make several updates and improvements to the `dubbo-go-samples` repository. Below is a summary of the changes: ### Changes in `.env.example`: - Updated the environment variable `OLLAMA_MODEL` to `OLLAMA_MODELS` and added a second model (`qwen2.5:7b`). ### New file `llm/config/config.go`: - Added a new configuration file to handle loading environment variables and storing them in a `Config` struct. - The `Config` struct includes fields for multiple Ollama models, the Ollama URL, and a timeout value. - Added functions to load the configuration and retrieve default values. ### Changes in `llm/go-client/cmd/client.go`: - Imported the new configuration package. - Added variables to store available models and the current model. - Updated the `handleCommand` function to include commands for listing and switching models. - Modified the `main` function to load the configuration and initialize the available models and the current model. ### Changes in `llm/go-client/frontend/handlers/chat.go`: - Imported the new configuration package. - Added a `Model` field to the request struct and included it in the chat request. - Updated the `Chat` function to append messages with the AI role and include the selected model in the chat request. ### Changes in `llm/go-client/frontend/main.go`: - Removed the loading of environment variables using `godotenv` and replaced it with the new configuration package. - Loaded models from the configuration and passed them to the HTML template. ### Changes in `llm/go-client/frontend/static/script.js`: - Added a model selector dropdown and an event listener to handle model changes. - Included the selected model in the chat request payload. ### Changes in `llm/go-client/frontend/static/style.css`: - Updated styles to accommodate the new model selector. ### Changes in `llm/go-client/frontend/templates/index.html`: - Added a model selector dropdown to the chat UI. ### Changes in `llm/go-server/cmd/server.go`: - Imported the new configuration package. - Updated the `ChatServer` struct to store multiple LLMs. - Modified the `Chat` function to select the appropriate model based on the request. ### Changes in `llm/proto/chat.pb.go` and `llm/proto/chat.proto`: - Updated the protobuf definitions to include the `Model` field in `ChatRequest` and `ChatResponse`. ### Changes in `llm/proto/chat.triple.go`: - Updated to reflect changes in the protobuf source. ### General Observations: - The changes introduce a more flexible configuration system that supports multiple models. - The code now allows switching between different models during runtime, which can be useful for testing and comparison. - Error handling and logging have been improved in several places. ### Recommendations: - Ensure that all environment variables are set correctly in production to avoid runtime errors. - Test the new functionality thoroughly to confirm that model switching works as expected. - Update any relevant documentation to reflect the changes in environment variables and new commands available in the client. Overall, these changes enhance the flexibility and functionality of the project by allowing the use of multiple models and improving configuration management. ``` 上面是 copilot review 的结果,请处理 -- 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: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org