import { AiConfig } from "./ai-config.entity";

export interface AiServiceAdapter {
  generateText(model: string, prompt: string, config?: Record<string, any>): Promise<string>;
  chat(model: string, messages: Array<{role: string, content: string}>, config?: Record<string, any>): Promise<string>;
}

export class DeepSeekAdapter implements AiServiceAdapter {
  constructor(private readonly config: AiConfig) {}

  async generateText(model: string, prompt: string): Promise<string> {
    // 实现DeepSeek的文本生成逻辑
    return `Generated text by ${model}: ${prompt}`;
  }

  async chat(model: string, messages: Array<{role: string, content: string}>): Promise<string> {
    // 实现DeepSeek的对话交互逻辑
    return `Chat response from ${model}: ${JSON.stringify(messages)}`;
  }
}

export class TongyiAdapter implements AiServiceAdapter {
  constructor(private readonly config: AiConfig) {}

  async generateText(model: string, prompt: string): Promise<string> {
    // 实现通义千问的文本生成逻辑
    return `Tongyi generated text: ${prompt}`;
  }

  async chat(model: string, messages: Array<{role: string, content: string}>): Promise<string> {
    // 实现通义千问的对话交互逻辑
    return `Tongyi chat response: ${JSON.stringify(messages)}`;
  }
}