diff --git a/component/src/services/azure/azureOpenAIAssistantIO.ts b/component/src/services/azure/azureOpenAIAssistantIO.ts index 6d9742045..89b737061 100644 --- a/component/src/services/azure/azureOpenAIAssistantIO.ts +++ b/component/src/services/azure/azureOpenAIAssistantIO.ts @@ -8,6 +8,8 @@ export class AzureOpenAIAssistantIO extends OpenAIAssistantIOI { private static readonly THREAD_RESOURCE = `threads`; private static readonly NEW_ASSISTANT_RESOURCE = 'assistants'; override permittedErrorPrefixes: string[] = [AzureOpenAIUtils.URL_DETAILS_ERROR_MESSAGE]; + override insertKeyPlaceholderText = 'Azure OpenAI API Key'; + override keyHelpUrl = 'https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key'; isTextInputDisabled = false; constructor(deepChat: DeepChat) { @@ -28,7 +30,7 @@ export class AzureOpenAIAssistantIO extends OpenAIAssistantIOI { getFilesPostfix: `/content${commonPostfix}`, }; - super(deepChat, config?.assistant, urlSegments, AzureOpenAIUtils.buildHeaders, apiKey); + super(deepChat, config?.assistant, urlSegments, AzureOpenAIUtils.buildKeyVerificationDetails(urlDetails), AzureOpenAIUtils.buildHeaders, apiKey); if (!AzureOpenAIUtils.validateURLDetails(urlDetails)) { this.isTextInputDisabled = true; diff --git a/component/src/services/openAI/assistant/openAIAssistantIO.ts b/component/src/services/openAI/assistant/openAIAssistantIO.ts index c11f80efc..0edd5b6de 100644 --- a/component/src/services/openAI/assistant/openAIAssistantIO.ts +++ b/component/src/services/openAI/assistant/openAIAssistantIO.ts @@ -21,7 +21,7 @@ export class OpenAIAssistantIO extends OpenAIAssistantIOI { const directConnectionCopy = JSON.parse(JSON.stringify(deepChat.directConnection)) as DirectConnection; const apiKey = directConnectionCopy.openAI; const config = directConnectionCopy.openAI?.assistant; - super(deepChat, config, OpenAIAssistantIO.URL_SEGMENTS, OpenAIUtils.buildHeaders, apiKey); + super(deepChat, config, OpenAIAssistantIO.URL_SEGMENTS, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, apiKey); this.connectSettings.headers ??= {}; this.connectSettings.headers['OpenAI-Beta'] ??= 'assistants=v2'; // runs keep failing but keep trying if (this.shouldFetchHistory && this.sessionId) this.fetchHistory = this.fetchHistoryFunc.bind(this); diff --git a/component/src/services/openAI/assistant/openAIAssistantIOI.ts b/component/src/services/openAI/assistant/openAIAssistantIOI.ts index 4bbbe8a38..4b0c125b2 100644 --- a/component/src/services/openAI/assistant/openAIAssistantIOI.ts +++ b/component/src/services/openAI/assistant/openAIAssistantIOI.ts @@ -23,6 +23,7 @@ import { } from '../../../types/openAIResult'; import {APIKey} from '../../../types/APIKey'; import {BuildHeadersFunc} from '../../../types/headers'; +import { KeyVerificationDetails } from '../../../types/keyVerificationDetails'; // https://platform.openai.com/docs/api-reference/messages/createMessage type MessageContentArr = { @@ -68,8 +69,8 @@ export class OpenAIAssistantIOI extends DirectServiceIO { private messageStream: MessageStream | undefined; private readonly filesToolType: OpenAIAssistant['files_tool_type']; - constructor(deepChat: DeepChat, config: OpenAI['assistant'], urlSegments: URLSegments, buildHeadersFunc: BuildHeadersFunc, apiKey?: APIKey) { - super(deepChat, OpenAIUtils.buildKeyVerificationDetails(), buildHeadersFunc, apiKey); + constructor(deepChat: DeepChat, config: OpenAI['assistant'], urlSegments: URLSegments, keyVerificationDetails: KeyVerificationDetails, buildHeadersFunc: BuildHeadersFunc, apiKey?: APIKey) { + super(deepChat, keyVerificationDetails, buildHeadersFunc, apiKey); this.urlSegments = urlSegments; if (typeof config === 'object') { this.config = config; // stored that assistant_id could be added