mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
@@ -1,5 +1,3 @@
|
||||
import assert from 'node:assert';
|
||||
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { ClientOptions, OpenAI } from 'openai';
|
||||
|
||||
@@ -58,12 +56,11 @@ export class OpenAIProvider
|
||||
private existsModels: string[] | undefined;
|
||||
|
||||
constructor(config: ClientOptions) {
|
||||
assert(OpenAIProvider.assetsConfig(config));
|
||||
this.instance = new OpenAI(config);
|
||||
}
|
||||
|
||||
static assetsConfig(config: ClientOptions) {
|
||||
return !!config.apiKey;
|
||||
return !!config?.apiKey;
|
||||
}
|
||||
|
||||
get type(): CopilotProviderType {
|
||||
|
||||
Reference in New Issue
Block a user