@crowdin/app-project-module
Version:
Module that generates for you all common endpoints for serving standalone Crowdin App
50 lines (49 loc) • 1.48 kB
TypeScript
import { CrowdinContextInfo, UiModule } from '../../types';
import Crowdin from '@crowdin/crowdin-api-client';
export declare enum PromptActions {
PRE_TRANSLATE = "pre_translate",
ASSIST = "assist",
QA_CHECK = "qa_check"
}
export interface AiPromptProviderModule extends UiModule {
/**
* generates prompt text based on provided options
*/
compile: (options: {
options: any;
payload: any;
client: Crowdin;
context: CrowdinContextInfo;
requestData: any;
}) => Promise<string>;
/**
* Represents a collection of supported actions. If not provided, all actions are supported.
*/
actions?: PromptActions[] | `custom:${string}`[];
/**
* Allow auto-retry on QA issues in user interface.
* Default: true
*/
allowRetryOnQaIssues?: boolean;
/**
* Optional handler that returns prompt status info (used providers, configuration state, errors).
* When provided, Crowdin will call this to display real-time status for external prompts.
*/
status?: (options: {
options: any;
aiPromptId: number;
client: Crowdin;
context: CrowdinContextInfo;
}) => Promise<{
usedAiProviderIds: number[];
isConfigured: boolean;
errors: Array<{
code: string;
message: string;
}>;
warnings: Array<{
code: string;
message: string;
}>;
}>;
}