- Remove BMAD framework, IDE configs, dev screenshots, test files, internal docs, and backup files - Rename keep-notes/ to memento-note/ - Update all references from keep-notes to memento-note - Add Apache 2.0 license with Commons Clause (non-commercial restriction) - Add clean .gitignore and .env.docker.example
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
'use server'
|
|
|
|
import { paragraphRefactorService, RefactorMode, RefactorResult } from '@/lib/ai/services/paragraph-refactor.service'
|
|
|
|
export interface RefactorResponse {
|
|
result: RefactorResult
|
|
}
|
|
|
|
/**
|
|
* Refactor a paragraph with a specific mode
|
|
*/
|
|
export async function refactorParagraph(
|
|
content: string,
|
|
mode: RefactorMode
|
|
): Promise<RefactorResponse> {
|
|
try {
|
|
const result = await paragraphRefactorService.refactor(content, mode)
|
|
|
|
return { result }
|
|
} catch (error) {
|
|
console.error('Error refactoring paragraph:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get all 3 refactor options at once
|
|
*/
|
|
export async function refactorParagraphAllModes(
|
|
content: string
|
|
): Promise<{ results: RefactorResult[] }> {
|
|
try {
|
|
const results = await paragraphRefactorService.refactorAllModes(content)
|
|
|
|
return { results }
|
|
} catch (error) {
|
|
console.error('Error refactoring paragraph in all modes:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Validate word count before refactoring
|
|
*/
|
|
export async function validateRefactorWordCount(
|
|
content: string
|
|
): Promise<{ valid: boolean; error?: string }> {
|
|
return paragraphRefactorService.validateWordCount(content)
|
|
}
|