hua-sdk-lite
Version:
HUA Lite API SDK - Emotional AI Chatbot Integration
115 lines (114 loc) • 3.01 kB
TypeScript
export type Tone = 'gentle' | 'warm' | 'cheerful' | 'quirky' | 'delicate';
export type Mode = 'empathy' | 'analysis' | 'suggestion' | 'praise' | 'playful';
export type Tier = 1.0 | 2.0 | 3.0;
export type SupportedLang = 'ko' | 'en';
export type LLMProvider = 'openai' | 'mock';
export interface ChatRequest {
message: string;
tone?: Tone;
mode?: Mode;
tier?: Tier;
lang?: SupportedLang;
provider?: LLMProvider;
llmApiKey?: string;
}
export interface UsageInfo {
total_tokens: number;
input_tokens: number;
output_tokens: number;
}
export interface CreditInfo {
used: number;
remaining: number;
tier: string;
}
export interface ApiKeyUsageInfo {
total_requests: number;
is_guest: boolean;
limit_exceeded: boolean;
}
export interface ChatResponseData {
message: string;
usage: UsageInfo;
tier: string;
mode: string;
tone: string;
authenticated: boolean;
userId: string;
note: string;
credits?: CreditInfo;
api_key_usage?: ApiKeyUsageInfo;
}
export interface ChatResponse {
success: boolean;
data: ChatResponseData;
}
export interface IssueKeyResponse {
apiKey: string;
}
export interface HUAError {
error: string;
message: string;
details?: string;
}
export interface HUALiteConfig {
baseUrl?: string;
timeout?: number;
retries?: number;
retryDelay?: number;
}
export interface HUALiteInterface {
chat(request: ChatRequest): Promise<ChatResponse>;
issueKey(): Promise<string>;
}
export interface PresetDescription {
name: string;
description: string;
examples: string[];
}
export interface PresetInfo {
gentle: PresetDescription;
warm: PresetDescription;
cheerful: PresetDescription;
quirky: PresetDescription;
delicate: PresetDescription;
}
export interface ModeDescription {
name: string;
description: string;
useCases: string[];
}
export interface ModeInfo {
empathy: ModeDescription;
analysis: ModeDescription;
suggestion: ModeDescription;
praise: ModeDescription;
playful: ModeDescription;
}
export interface TierDescription {
name: string;
description: string;
creditCost: number;
maxTokens: number;
}
export interface TierInfo {
'1.0': TierDescription;
'2.0': TierDescription;
'3.0': TierDescription;
}
export declare const TONE_PRESETS: Tone[];
export declare const MODE_PRESETS: Mode[];
export declare const TIER_PRESETS: Tier[];
export declare const SUPPORTED_LANGS: SupportedLang[];
export declare const LLM_PROVIDERS: LLMProvider[];
export declare const DEFAULT_CONFIG: Required<HUALiteConfig>;
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export interface HUAEvent {
type: 'request' | 'response' | 'error' | 'retry';
timestamp: Date;
data: any;
}
export type EventListener = (event: HUAEvent) => void;