All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fixes all 542 ESLint problems in the web package to achieve 0 errors and 0 warnings. Changes: - Fixed 144 issues: nullish coalescing, return types, unused variables - Fixed 118 issues: unnecessary conditions, type safety, template literals - Fixed 79 issues: non-null assertions, unsafe assignments, empty functions - Fixed 67 issues: explicit return types, promise handling, enum comparisons - Fixed 45 final warnings: missing return types, optional chains - Fixed 25 typecheck-related issues: async/await, type assertions, formatting - Fixed JSX.Element namespace errors across 90+ files All Quality Rails violations resolved. Lint and typecheck both pass with 0 problems. Files modified: 118 components, tests, hooks, and utilities Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
/**
|
|
* Personality API Client
|
|
* Handles personality-related API requests
|
|
*/
|
|
|
|
import type { Personality, FormalityLevel } from "@mosaic/shared";
|
|
import { apiGet, apiPost, apiPatch, apiDelete, type ApiResponse } from "./client";
|
|
|
|
/**
|
|
* Create personality DTO
|
|
*/
|
|
export interface CreatePersonalityDto {
|
|
name: string;
|
|
description?: string;
|
|
tone: string;
|
|
formalityLevel: FormalityLevel;
|
|
systemPromptTemplate: string;
|
|
isDefault?: boolean;
|
|
isActive?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Update personality DTO
|
|
*/
|
|
export interface UpdatePersonalityDto {
|
|
name?: string;
|
|
description?: string;
|
|
tone?: string;
|
|
formalityLevel?: FormalityLevel;
|
|
systemPromptTemplate?: string;
|
|
isDefault?: boolean;
|
|
isActive?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Fetch all personalities
|
|
*/
|
|
export async function fetchPersonalities(isActive = true): Promise<ApiResponse<Personality[]>> {
|
|
const endpoint = `/api/personalities?isActive=${isActive.toString()}`;
|
|
return apiGet<ApiResponse<Personality[]>>(endpoint);
|
|
}
|
|
|
|
/**
|
|
* Fetch the default personality
|
|
*/
|
|
export async function fetchDefaultPersonality(): Promise<Personality> {
|
|
return apiGet<Personality>("/api/personalities/default");
|
|
}
|
|
|
|
/**
|
|
* Fetch a single personality by ID
|
|
*/
|
|
export async function fetchPersonality(id: string): Promise<Personality> {
|
|
return apiGet<Personality>(`/api/personalities/${id}`);
|
|
}
|
|
|
|
/**
|
|
* Create a new personality
|
|
*/
|
|
export async function createPersonality(data: CreatePersonalityDto): Promise<Personality> {
|
|
return apiPost<Personality>("/api/personalities", data);
|
|
}
|
|
|
|
/**
|
|
* Update a personality
|
|
*/
|
|
export async function updatePersonality(
|
|
id: string,
|
|
data: UpdatePersonalityDto
|
|
): Promise<Personality> {
|
|
return apiPatch<Personality>(`/api/personalities/${id}`, data);
|
|
}
|
|
|
|
/**
|
|
* Delete a personality
|
|
*/
|
|
export async function deletePersonality(id: string): Promise<Record<string, never>> {
|
|
return apiDelete<Record<string, never>>(`/api/personalities/${id}`);
|
|
}
|