Skip to content

Commit

Permalink
fix openai instance
Browse files Browse the repository at this point in the history
  • Loading branch information
dayesouza committed Apr 10, 2024
1 parent e185e2d commit e07f8e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ trigger:
branches:
include:
- main
- fix-st

schedules:
- cron: "0 0 * * 0" # Runs every Sunday at midnight (UTC)
Expand Down Expand Up @@ -112,8 +113,9 @@ stages:
script: docker push $(DOCKER_REGISTRY)/intel-toolkit:latest

- stage: Build NSIS
dependsOn: Build
condition: eq(variables.isTagged, 'true')
# dependsOn: Build
dependsOn: []
# condition: eq(variables.isTagged, 'true')
jobs:
- job: NSIS_Build
pool:
Expand Down
13 changes: 7 additions & 6 deletions app/util/openai_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from util.SecretsHandler import SecretsHandler

key = 'openaikey'
class _OpenAI:
_instance = None
_key = None
Expand All @@ -13,14 +14,14 @@ def __init__(self):
self._secrets = SecretsHandler()

def client(self):
if self._secrets.get_secret("api_key") != '':
key = st.secrets["api_key"]
if self._secrets.get_secret(key) != '':
api_key = self._secrets.get_secret(key)
else:
key = get_key_env()
if key != self._key:
self._key = key
api_key = get_key_env()
if api_key != self._key:
self._key = api_key
try:
self._instance = OpenAI(api_key=key)
self._instance = OpenAI(api_key=self._key)
except Exception as e:
print(f'Error creating OpenAI client: {e}')

Expand Down

0 comments on commit e07f8e3

Please sign in to comment.