feat: v2.12.0 - UI/UX Refinement (Model Sync & Premium Tooltips)
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { getConfig } from '../config';
|
||||
|
||||
export abstract class BaseAgent {
|
||||
constructor(protected readonly modelName: string) {}
|
||||
|
||||
protected async callLLM(persona: string, prompt: string): Promise<string> {
|
||||
const { ollamaUrl } = getConfig();
|
||||
const messages = [
|
||||
{ role: 'system', content: persona },
|
||||
{ role: 'user', content: prompt }
|
||||
];
|
||||
|
||||
// API 호출 로직 (Streaming 생략하고 결과만 반환하는 헬퍼)
|
||||
const response = await fetch(`${ollamaUrl}/api/chat`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
model: this.modelName,
|
||||
messages,
|
||||
stream: false,
|
||||
options: { temperature: 0.3 }
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Agent API Error: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const data = await response.json() as any;
|
||||
return data.message?.content || data.choices?.[0]?.message?.content || '';
|
||||
}
|
||||
|
||||
abstract execute(input: string, context?: string): Promise<string>;
|
||||
}
|
||||
|
||||
export class PlannerAgent extends BaseAgent {
|
||||
private readonly persona = `You are the [Planner Agent]. Analyze the request and output a structured <plan>.`;
|
||||
async execute(input: string, brainContext?: string): Promise<string> {
|
||||
return this.callLLM(this.persona, `Request: ${input}\nContext: ${brainContext}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class ResearcherAgent extends BaseAgent {
|
||||
private readonly persona = `You are the [Researcher Agent]. Gather facts based on the plan.`;
|
||||
async execute(input: string, brainContext?: string): Promise<string> {
|
||||
return this.callLLM(this.persona, `Plan: ${input}\nContext: ${brainContext}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class WriterAgent extends BaseAgent {
|
||||
private readonly persona = `You are the [Writer Agent]. Synthesize research into a final report.`;
|
||||
async execute(input: string, originalRequest?: string): Promise<string> {
|
||||
return this.callLLM(this.persona, `Data: ${input}\nOriginal Request: ${originalRequest}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user