|
|
@@ -14,6 +14,7 @@ const ASSISTANT_LABEL_DEFAULT = 'ChatGPT'
|
|
|
|
|
|
export class ChatGPTAPI {
|
|
|
protected _apiKey: string
|
|
|
+ protected _apiInstance: string
|
|
|
protected _apiEndpoint: string
|
|
|
protected _apiDeployment: string
|
|
|
protected _apiVersion: string
|
|
|
@@ -50,6 +51,7 @@ export class ChatGPTAPI {
|
|
|
const {
|
|
|
apiKey,
|
|
|
apiEndpoint,
|
|
|
+ apiInstance,
|
|
|
apiDeployment,
|
|
|
apiVersion,
|
|
|
apiOrg,
|
|
|
@@ -66,6 +68,7 @@ export class ChatGPTAPI {
|
|
|
|
|
|
this._apiKey = apiKey
|
|
|
this._apiEndpoint = apiEndpoint
|
|
|
+ this._apiInstance = apiInstance
|
|
|
this._apiDeployment = apiDeployment
|
|
|
this._apiVersion = apiVersion
|
|
|
this._apiOrg = apiOrg
|
|
|
@@ -176,7 +179,8 @@ export class ChatGPTAPI {
|
|
|
}
|
|
|
|
|
|
const responseP = new Promise<types.ChatMessage>(async (resolve, reject) => {
|
|
|
- const url = `${this._apiEndpoint}/openai/deployments/${this._apiDeployment}/chat/completions?api-version=${this._apiVersion}`
|
|
|
+ // const url = `${this._apiEndpoint}/openai/deployments/${this._apiDeployment}/chat/completions?api-version=${this._apiVersion}`
|
|
|
+ const url = `https://gateway.ai.cloudflare.com/v1/cc11bed478e65817d30878b0a796422d/openai-gateway/azure-openai/${this._apiInstance}/${this._apiDeployment}/chat/completions?api-version=${this._apiVersion}`
|
|
|
const headers = {
|
|
|
'Content-Type': 'application/json',
|
|
|
'api-key': `${this._apiKey}`
|