Skip to content

Commit

Permalink
update skeet openai
Browse files Browse the repository at this point in the history
  • Loading branch information
POPPIN-FUMI committed Apr 15, 2024
1 parent feea1a2 commit 14896f8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/angry-ties-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@skeet-framework/skeet-func-template": patch
"@skeet-framework/ai": patch
---

Update - openai
7 changes: 7 additions & 0 deletions packages/ai/src/lib/openAIChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ export const openAIChat = async (
contents: Array<ChatCompletionMessageParam>,
config = defaultOpenAIConfig,
) => {
if (config.organizationKey === '' || config.apiKey === '') {
console.error(
'CHAT_GPT_ORG and CHAT_GPT_KEY are required in .env file.\n\nor you can pass them as arguments to the function.',
)
process.exit(1)
}

const ai = new OpenAI({
apiKey,
organization: organizationKey,
Expand Down
2 changes: 2 additions & 0 deletions templates/skeet-func-template/functions/skeet-func/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void (async () => {
'firebase-functions',
'dotenv',
'@skeet-framework/cloud-task',
'@skeet-framework/ai'
],
})

Expand All @@ -42,6 +43,7 @@ void (async () => {
'firebase-functions',
'dotenv',
'@skeet-framework/cloud-task',
'@skeet-framework/ai'
],
tsconfig: './tsconfig.json',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void (async () => {
'firebase-functions',
'dotenv',
'@skeet-framework/cloud-task',
'@skeet-framework/ai',
],
})

Expand All @@ -42,6 +43,7 @@ void (async () => {
'firebase-functions',
'dotenv',
'@skeet-framework/cloud-task',
'@skeet-framework/ai',
],
tsconfig: './tsconfig.json',
})
Expand Down
10 changes: 5 additions & 5 deletions templates/skeet-func-template/functions/skeet-func/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"logs": "firebase functions:log"
},
"dependencies": {
"@skeet-framework/ai": "1.8.6",
"@skeet-framework/cloud-task": "0.4.2",
"@skeet-framework/firestore": "2.5.2",
"@skeet-framework/utils": "1.3.9",
"@skeet-framework/ai": "1.8.8",
"@skeet-framework/cloud-task": "1.0.0",
"@skeet-framework/firestore": "2.6.0",
"@skeet-framework/utils": "1.3.10",
"firebase-admin": "12.0.0",
"firebase-functions": "4.8.1",
"dotenv": "16.4.5"
Expand All @@ -53,7 +53,7 @@
"prettier": "3.2.5",
"tsx": "4.7.1",
"typescript": "5.4.3",
"vite": "^5.2.6",
"vite": "5.2.6",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.4.0"
}
Expand Down

0 comments on commit 14896f8

Please sign in to comment.