Alanxtl commented on code in PR #823: URL: https://github.com/apache/dubbo-go-samples/pull/823#discussion_r2030049200
########## llm/go-client/cmd/client.go: ########## @@ -77,13 +82,34 @@ func handleCommand(cmd string) (resp string) { currentCtxID = newID resp += fmt.Sprintf("Created new context: %s\n", newID) return resp - default: - resp += "Available commands:\n" - resp += "/? help - Show this help\n" - resp += "/list - List all contexts\n" - resp += "/cd <context> - Switch context\n" - resp += "/new - Create new context" + case cmd == "/models": + resp += "Available models:\n" + for _, model := range availableModels { + marker := " " + if model == currentModel { + marker = "*" + } + resp += fmt.Sprintf("%s %s\n", marker, model) + } + return resp + case strings.HasPrefix(cmd, "/model "): + modelName := strings.TrimPrefix(cmd, "/model ") + modelFound := false + for _, model := range availableModels { + if model == modelName { + currentModel = model + modelFound = true + break + } + } + if modelFound { + resp += fmt.Sprintf("Switched to model: %s\n", modelName) Review Comment: ```suggestion resp += fmt.Sprintf("Switched to model: %s", modelName) ``` ########## llm/go-client/cmd/client.go: ########## @@ -77,13 +82,34 @@ func handleCommand(cmd string) (resp string) { currentCtxID = newID resp += fmt.Sprintf("Created new context: %s\n", newID) return resp - default: - resp += "Available commands:\n" - resp += "/? help - Show this help\n" - resp += "/list - List all contexts\n" - resp += "/cd <context> - Switch context\n" - resp += "/new - Create new context" + case cmd == "/models": + resp += "Available models:\n" + for _, model := range availableModels { + marker := " " + if model == currentModel { + marker = "*" + } + resp += fmt.Sprintf("%s %s\n", marker, model) Review Comment: ```suggestion resp += fmt.Sprintf("\n%s %s", marker, model) ``` ########## llm/go-client/cmd/client.go: ########## @@ -77,13 +82,34 @@ func handleCommand(cmd string) (resp string) { currentCtxID = newID resp += fmt.Sprintf("Created new context: %s\n", newID) return resp - default: - resp += "Available commands:\n" - resp += "/? help - Show this help\n" - resp += "/list - List all contexts\n" - resp += "/cd <context> - Switch context\n" - resp += "/new - Create new context" + case cmd == "/models": + resp += "Available models:\n" Review Comment: ```suggestion resp += "Available models:" ``` -- 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