mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 23:26:30 +08:00
refactor(server): config system (#11081)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { ChatPrompt, PromptService } from '../../prompt';
|
||||
import { CopilotProviderService } from '../../providers';
|
||||
import { CopilotChatOptions, CopilotImageProvider } from '../../types';
|
||||
import {
|
||||
CopilotChatOptions,
|
||||
CopilotImageProvider,
|
||||
CopilotProviderFactory,
|
||||
} from '../../providers';
|
||||
import { WorkflowNodeData, WorkflowNodeType } from '../types';
|
||||
import { NodeExecuteResult, NodeExecuteState, NodeExecutorType } from './types';
|
||||
import { AutoRegisteredWorkflowExecutor } from './utils';
|
||||
@@ -11,7 +14,7 @@ import { AutoRegisteredWorkflowExecutor } from './utils';
|
||||
export class CopilotChatImageExecutor extends AutoRegisteredWorkflowExecutor {
|
||||
constructor(
|
||||
private readonly promptService: PromptService,
|
||||
private readonly providerService: CopilotProviderService
|
||||
private readonly providerFactory: CopilotProviderFactory
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -42,7 +45,7 @@ export class CopilotChatImageExecutor extends AutoRegisteredWorkflowExecutor {
|
||||
`Prompt ${data.promptName} not found when running workflow node ${data.name}`
|
||||
);
|
||||
}
|
||||
const provider = await this.providerService.getProviderByModel(
|
||||
const provider = await this.providerFactory.getProviderByModel(
|
||||
prompt.model
|
||||
);
|
||||
if (provider && 'generateImages' in provider) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { ChatPrompt, PromptService } from '../../prompt';
|
||||
import { CopilotProviderService } from '../../providers';
|
||||
import { CopilotChatOptions, CopilotTextProvider } from '../../types';
|
||||
import {
|
||||
CopilotChatOptions,
|
||||
CopilotProviderFactory,
|
||||
CopilotTextProvider,
|
||||
} from '../../providers';
|
||||
import { WorkflowNodeData, WorkflowNodeType } from '../types';
|
||||
import { NodeExecuteResult, NodeExecuteState, NodeExecutorType } from './types';
|
||||
import { AutoRegisteredWorkflowExecutor } from './utils';
|
||||
@@ -11,7 +14,7 @@ import { AutoRegisteredWorkflowExecutor } from './utils';
|
||||
export class CopilotChatTextExecutor extends AutoRegisteredWorkflowExecutor {
|
||||
constructor(
|
||||
private readonly promptService: PromptService,
|
||||
private readonly providerService: CopilotProviderService
|
||||
private readonly providerFactory: CopilotProviderFactory
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -42,7 +45,7 @@ export class CopilotChatTextExecutor extends AutoRegisteredWorkflowExecutor {
|
||||
`Prompt ${data.promptName} not found when running workflow node ${data.name}`
|
||||
);
|
||||
}
|
||||
const provider = await this.providerService.getProviderByModel(
|
||||
const provider = await this.providerFactory.getProviderByModel(
|
||||
prompt.model
|
||||
);
|
||||
if (provider && 'generateText' in provider) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CopilotChatOptions } from '../../types';
|
||||
import { CopilotChatOptions } from '../../providers';
|
||||
import type { WorkflowNode } from '../node';
|
||||
import { WorkflowNodeData, WorkflowParams } from '../types';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import Piscina from 'piscina';
|
||||
|
||||
import { CopilotChatOptions } from '../types';
|
||||
import { CopilotChatOptions } from '../providers';
|
||||
import type { NodeExecuteResult, NodeExecutor } from './executor';
|
||||
import { getWorkflowExecutor, NodeExecuteState } from './executor';
|
||||
import type {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
|
||||
import { CopilotChatOptions } from '../types';
|
||||
import { CopilotChatOptions } from '../providers';
|
||||
import { WorkflowGraphList } from './graph';
|
||||
import { WorkflowNode } from './node';
|
||||
import type { WorkflowGraph, WorkflowGraphInstances } from './types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
import { CopilotChatOptions } from '../types';
|
||||
import { CopilotChatOptions } from '../providers';
|
||||
import { NodeExecuteState } from './executor';
|
||||
import { WorkflowNode } from './node';
|
||||
import type { WorkflowGraphInstances, WorkflowNodeState } from './types';
|
||||
|
||||
Reference in New Issue
Block a user