Added plan.md with complete architecture for format-agnostic content generation: - Support for Markdown, HTML, Plain Text, JSON formats - New FormatExporter module with neutral data structure - Integration strategy with existing ContentAssembly and ArticleStorage - Bonus features: SEO metadata generation, readability scoring, WordPress Gutenberg format - Implementation roadmap with 4 phases (6h total estimated) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
887 B
JavaScript
25 lines
887 B
JavaScript
/**
|
|
* Mock LLMManager : renvoie des sorties déterministes selon l'input,
|
|
* et peut simuler des erreurs transitoires (429/500) via flags.
|
|
*/
|
|
export class MockLLMManager {
|
|
constructor({failTimes=0, failCode=429} = {}) {
|
|
this.failTimes = failTimes;
|
|
this.failCode = failCode;
|
|
this.calls = [];
|
|
}
|
|
async callModel({provider='mock', model='mock-1', input}) {
|
|
this.calls.push({provider, model, input});
|
|
if (this.failTimes > 0) {
|
|
this.failTimes--;
|
|
const err = new Error(`Mock transient ${this.failCode}`);
|
|
err.statusCode = this.failCode;
|
|
throw err;
|
|
}
|
|
// sortie déterministe simple
|
|
const text = (typeof input === 'string' ? input : JSON.stringify(input));
|
|
const completion = `MOCK[${model}]::` + text.slice(0, 60);
|
|
return { completion, usage: { prompt_tokens: 100, completion_tokens: 200 } };
|
|
}
|
|
}
|