Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshal Ranjhani authored and Harshal Ranjhani committed Apr 8, 2024
1 parent 5b5aae7 commit 9873637
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@ func getAPIKeyFromUser(promptMessage string) string {
}

func storeKeyIfNotPresent(accountName string, promptMessage string) string {
// Try to get the API key from keyring
apiKey, err := keyring.Get(serviceName, accountName)

if err != nil {
// If API key is not found, prompt the user
apiKey = getAPIKeyFromUser(promptMessage)

// Store the API key securely
err := keyring.Set(serviceName, accountName, apiKey)
if err != nil {
fmt.Printf("Failed to store %s: %s\n", accountName, err)
Expand All @@ -50,7 +47,6 @@ var initCmd = &cobra.Command{
Long: `store your API keys securely in the system keychain.`,
Run: func(cmd *cobra.Command, args []string) {

// check if the API keys are already stored
_, err := keyring.Get(serviceName, openAIKeyName)
_, err2 := keyring.Get(serviceName, geminiKeyName)
if err == nil || err2 == nil {
Expand All @@ -64,7 +60,6 @@ var initCmd = &cobra.Command{

ssidKey := storeKeyIfNotPresent(ssidKeyName, "Enter your SSID:")

// Use the API keys for your application's logic
fmt.Println("API Keys are securely stored and ready for use.")

fmt.Println("OpenAI API Key:", openAIKey)
Expand Down
4 changes: 1 addition & 3 deletions helpers/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ func GenerateImage(prompt string) (string, error) {
return "", fmt.Errorf("failed to execute python script: %w", err)
}

// The output of your Python script is now in out.String(), which is the filename
filename := out.String() // Make sure to trim or process this as needed
filename := out.String()

// Return the filename (or process as needed)
return filename, nil
}

0 comments on commit 9873637

Please sign in to comment.