import { AgenticSystem, field, action, stream } from 'idyllic';
export default class DocImprover extends AgenticSystem {
@field content = '';
@field improved = stream<string>('');
@field status: 'idle' | 'improving' = 'idle';
@action()
async setContent(text: string) {
this.content = text;
}
@action()
async improve() {
this.status = 'improving';
this.improved.reset();
for await (const chunk of ai.stream(
`Improve this text, making it clearer and more professional:\n\n${this.content}`
)) {
this.improved.append(chunk);
}
this.improved.complete();
this.status = 'idle';
}
}