Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
seemywingz committed Mar 30, 2023
2 parents 9072a4b + dd59c54 commit c5bf864
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Visit your [API Keys](https://platform.openai.com/account/api-keys) page to retr

### Required Environment Variables
###### ℹ️ These Environment Variables are required for both docker and cli usage
###### ℹ️ These Environment Variables are required, but can be "placeholders" or empty strings if you're not using the API endpoint that requires the key
###### ℹ️ You can omit keys for unused API endpoints
```bash
OPENAI_API_KEY={YOUR OPENAI API KEY}
PRINTIFY_API_KEY={YOUR PRINTIFY API KEY}
Expand Down Expand Up @@ -76,7 +76,7 @@ ponder image -p "watercolor of a corgie"

Ponder
GitHub: https://github.com/seemywingz/ponder
App Version: v0.0.0
App Version: v0.0.1

Ponder uses OpenAI's GPT-3.5-Turbo API to generate text responses to user input.
You can use Ponder as a Discord chat bot or to generate images using the DALL-E API.
Expand Down
8 changes: 4 additions & 4 deletions cmd/Discord_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func handleMessages(s *discordgo.Session, m *discordgo.MessageCreate) {
channelName := discordGetChannelName(m.ChannelID)

// Respond to messages in the #ponder channel
if channelName == "ponder" {
if channelName == "ponder" || m.GuildID == "" {
discordOpenAIResponse(s, m, false)
return
}
Expand Down Expand Up @@ -143,9 +143,9 @@ func discordOpenAIResponse(s *discordgo.Session, m *discordgo.MessageCreate, men
openAIUser = ponderID + m.Author.Username
oaiResponse := openai_ChatComplete(openaiMessages)
responseMessage := oaiResponse.Choices[0].Message.Content
if mention {
responseMessage = m.Author.Mention() + " " + responseMessage
}
// if mention {
// responseMessage = m.Author.Mention() + " " + responseMessage
// }
s.ChannelMessageSend(m.ChannelID, responseMessage)
}

Expand Down
13 changes: 2 additions & 11 deletions cmd/OpenAI_API.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func openai_ChatComplete(messages []OPENAI_Message) OPENAI_ChatCompletionRespons
TopP: 0.1,
FrequencyPenalty: 0.0,
PresencePenalty: 0.6,
MaxTokens: 1000,
MaxTokens: 999,
User: openAIUser,
}
openAI_PostJson(oaiRequest, &oaiResponse, openai_endpoint+"chat/completions")
Expand All @@ -153,7 +153,7 @@ func openAI_Chat(prompt string) OPENAI_ChatResponse {
oaiResponse := OPENAI_ChatResponse{}
oaiRequest := &OPENAI_ChatRequest{
Prompt: prompt,
MaxTokens: 1000,
MaxTokens: 999,
Model: "text-davinci-003",
Temperature: 0,
TopP: 0.1,
Expand Down Expand Up @@ -187,12 +187,3 @@ func openAI_PostJson(requestJson, responseJson interface{}, endpoint string) {

httpMakeRequest(req, responseJson)
}

// func openai_ChatTXTonly(prompt string) string {
// oaiResponse := openAI_Chat(prompt)
// responseMessage := ""
// for _, v := range oaiResponse.Choices {
// responseMessage += v.Text[2:]
// }
// return responseMessage
// }
9 changes: 4 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Copyright © 2023 Kevin Jayne <[email protected]>
package cmd

import (
"errors"
"fmt"
"hash/fnv"
"net/url"
Expand Down Expand Up @@ -65,19 +64,19 @@ func init() {
// Check for Required Environment Variables
OPENAI_API_KEY = os.Getenv("OPENAI_API_KEY")
if OPENAI_API_KEY == "" {
catchErr(errors.New("OPENAI_API_KEY environment variable is not set"))
fmt.Println("OPENAI_API_KEY environment variable is not set, continuing without OpenAI API Key")
}
PRINTIFY_API_KEY = os.Getenv("PRINTIFY_API_KEY")
if PRINTIFY_API_KEY == "" {
catchErr(errors.New("PRINTIFY_API_KEY environment variable is not set"))
fmt.Println("PRINTIFY_API_KEY environment variable is not set, continuing without Printify API Key")
}
DISCORD_API_KEY = os.Getenv("DISCORD_API_KEY")
if DISCORD_API_KEY == "" {
catchErr(errors.New("DISCORD_API_KEY environment variable is not set"))
fmt.Println("DISCORD_API_KEY environment variable is not set, continuing without Discord API Key")
}
DISCORD_PUB_KEY = os.Getenv("DISCORD_PUB_KEY")
if DISCORD_PUB_KEY == "" {
catchErr(errors.New("DISCORD_PUB_KEY environment variable is not set"))
fmt.Println("DISCORD_PUB_KEY environment variable is not set, continuing without Discord Public Key")
}

// Create a unique user for OpenAI
Expand Down
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v0.0.0
version: v0.0.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.0.0"
appVersion: "v0.0.1"
2 changes: 1 addition & 1 deletion helm/values_development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replicaCount: 1
image:
repository: ghcr.io/seemywingz/ponder
pullPolicy: Always
tag: development
tag: develop

imagePullSecrets: []
nameOverride: ""
Expand Down
2 changes: 1 addition & 1 deletion helm/values_production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replicaCount: 1
image:
repository: ghcr.io/seemywingz/ponder
pullPolicy: Always
tag: "v0.1.2"
tag: "v0.0.1"

imagePullSecrets: []
nameOverride: ""
Expand Down

0 comments on commit c5bf864

Please sign in to comment.