@zhanghongping/json-sage-workflow-cli
Version:
An intelligent JSON processing workflow system with improved error handling and configuration
31 lines (25 loc) • 853 B
text/typescript
import { AgentConfig } from '../types';
export abstract class BaseAgent {
protected config: AgentConfig;
constructor(config: AgentConfig) {
this.validateConfig(config);
this.config = this.normalizeConfig(config);
}
private validateConfig(config: AgentConfig): void {
if (!config.deepseekApiKey) {
throw new Error('DeepSeek API key is required');
}
}
private normalizeConfig(config: AgentConfig): AgentConfig {
return {
...config,
model: config.model || 'deepseek-chat',
maxTokens: config.maxTokens || 2000,
temperature: config.temperature || 0.7,
caching: config.caching !== false
};
}
protected getConfig(): AgentConfig {
return { ...this.config };
}
}