chore(server): patch config system (#11260)

This commit is contained in:
liuyi
2025-03-28 16:19:04 +08:00
committed by GitHub
parent dccd7c20aa
commit ca301f0dab
3 changed files with 22 additions and 6 deletions
@@ -24,15 +24,27 @@ const CONTEXT_SESSION_KEY = 'context-session';
@Injectable()
export class CopilotContextService implements OnApplicationBootstrap {
private supportEmbedding = false;
private readonly client: EmbeddingClient | undefined;
private client: EmbeddingClient | undefined;
constructor(
config: Config,
private readonly config: Config,
private readonly cache: Cache,
private readonly models: Models
) {
const configure = config.copilot.providers.openai;
if (configure) {
) {}
@OnEvent('config.init')
onConfigInit() {
this.setup();
}
@OnEvent('config.changed')
onConfigChanged() {
this.setup();
}
private setup() {
const configure = this.config.copilot.providers.openai;
if (configure.apiKey) {
this.client = new OpenAIEmbeddingClient(new OpenAI(configure));
}
}