Skip to content

Commit

Permalink
Increase max OpenAI API key size to 256 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
sacredbanana committed Sep 1, 2024
1 parent 15de98c commit a4050ad
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.6.2 (2024-09-01)

- Increase max OpenAI API key size to 256 characters

## 1.6.1 (2024-08-31)

- Default to speech disabled
Expand Down
4 changes: 4 additions & 0 deletions bundle/AmigaGPT/AmigaGPT.guide
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,10 @@ Training data: Up to Sep 2021
@node changelog "Changelog"
@{b}Changelog@{ub}

@{b}1.6.2 (2024-09-01)@{ub}

- Increase max OpenAI API key size to 256 characters

@{b}1.6.1 (2024-08-31)@{ub}

- Default to speech disabled
Expand Down
6 changes: 6 additions & 0 deletions bundle/AmigaGPT/AmigaGPT.readme
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ Special Thanks:

Changelog:

------------------
1.6.2 (2024-09-01)
------------------

- Increase max OpenAI API key size to 256 characters

------------------
1.6.1 (2024-08-31)
------------------
Expand Down
4 changes: 2 additions & 2 deletions src/openai.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static ULONG createSSLConnection(CONST_STRPTR host, UWORD port) {
* @param stream whether to stream the response or not
* @return a pointer to a new array of json_object containing the response(s) or NULL -- Free it with json_object_put() for all responses then FreeVec() for the array when you are done using it
**/
struct json_object** postChatMessageToOpenAI(struct MinList *conversation, enum ChatModel model, CONST_STRPTR openAiApiKey, BOOL stream) {
struct json_object** postChatMessageToOpenAI(struct Conversation *conversation, enum ChatModel model, CONST_STRPTR openAiApiKey, BOOL stream) {
struct json_object **responses = AllocVec(sizeof(struct json_object *) * RESPONSE_ARRAY_BUFFER_LENGTH, MEMF_ANY | MEMF_CLEAR);
static BOOL streamingInProgress = FALSE;
UWORD responseIndex = 0;
Expand All @@ -360,7 +360,7 @@ struct json_object** postChatMessageToOpenAI(struct MinList *conversation, enum
json_object_object_add(obj, "model", json_object_new_string(CHAT_MODEL_NAMES[model]));
struct json_object *conversationArray = json_object_new_array();

struct MinNode *conversationNode = conversation->mlh_Head;
struct MinNode *conversationNode = conversation->messages->mlh_Head;
while (conversationNode->mln_Succ != NULL) {
struct ConversationNode *message = (struct ConversationNode *)conversationNode;
struct json_object *messageObj = json_object_new_object();
Expand Down
13 changes: 9 additions & 4 deletions src/openai.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define WRITE_BUFFER_LENGTH 131072
#define RESPONSE_ARRAY_BUFFER_LENGTH 1024
#define CHAT_SYSTEM_LENGTH 512
#define OPENAI_API_KEY_LENGTH 64
#define OPENAI_API_KEY_LENGTH 256

/**
* A node in the conversation
Expand All @@ -15,15 +15,20 @@ struct ConversationNode {
**/
struct MinNode node;
/**
* The role of the speaker. Currently the only roles supported by OpenAI are "user", "assistant" and "systen"
* The role of the speaker. Currently the only roles supported by OpenAI are "user", "assistant" and "system"
**/
UBYTE role[64];
UBYTE role[10];
/**
* The text of the message
**/
STRPTR content;
};

struct Conversation {
struct MinList *messages;
STRPTR name;
};

/**
* The chat model OpenAI should use
**/
Expand Down Expand Up @@ -127,7 +132,7 @@ LONG initOpenAIConnector();
* @param stream whether to stream the response or not
* @return a pointer to a new array of json_object containing the response(s) or NULL -- Free it with json_object_put() for all responses then FreeVec() for the array when you are done using it
**/
struct json_object** postChatMessageToOpenAI(struct MinList *conversation, enum ChatModel model, CONST_STRPTR openAiApiKey, BOOL stream);
struct json_object** postChatMessageToOpenAI(struct Conversation *conversation, enum ChatModel model, CONST_STRPTR openAiApiKey, BOOL stream);

/**
* Post a image creation request to OpenAI
Expand Down
4 changes: 2 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define APP_VERSION "1.6.1"
#define BUILD_NUMBER "3058"
#define APP_VERSION "1.6.2"
#define BUILD_NUMBER "3425"
#define APP_NAME "AmigaGPT"

0 comments on commit a4050ad

Please sign in to comment.