mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 12:32:10 +01:00
refactor: achieve 100% biome compliance with comprehensive code quality improvements
- Fix all cognitive complexity violations (63→0 errors) - Replace 'any' types with proper TypeScript interfaces and generics - Extract helper functions and custom hooks to reduce complexity - Fix React hook dependency arrays and useCallback patterns - Remove unused imports, variables, and functions - Implement proper formatting across all files - Add type safety with interfaces like AIProcessingRequestWithSession - Fix circuit breaker implementation with proper reset() method - Resolve all accessibility and form labeling issues - Clean up mysterious './0' file containing biome output Total: 63 errors → 0 errors, 42 warnings → 0 warnings
This commit is contained in:
@ -66,7 +66,7 @@ class OpenAIMockServer {
|
||||
/**
|
||||
* Log mock requests for debugging
|
||||
*/
|
||||
private logRequest(endpoint: string, data: any): void {
|
||||
private logRequest(endpoint: string, data: unknown): void {
|
||||
if (this.config.logRequests) {
|
||||
console.log(`[OpenAI Mock] ${endpoint}:`, JSON.stringify(data, null, 2));
|
||||
}
|
||||
@ -260,7 +260,14 @@ class OpenAIMockServer {
|
||||
}
|
||||
|
||||
// Generate mock batch results
|
||||
const results: any = [];
|
||||
const results: Array<{
|
||||
id: string;
|
||||
custom_id: string;
|
||||
response: {
|
||||
status_code: number;
|
||||
body: unknown;
|
||||
};
|
||||
}> = [];
|
||||
for (let i = 0; i < batch.request_counts.total; i++) {
|
||||
const response = MOCK_RESPONSE_GENERATORS.sentiment(`Sample text ${i}`);
|
||||
results.push({
|
||||
@ -359,16 +366,16 @@ export const openAIMock = new OpenAIMockServer();
|
||||
* Drop-in replacement for OpenAI client that uses mocks when enabled
|
||||
*/
|
||||
export class MockOpenAIClient {
|
||||
private realClient: any;
|
||||
private realClient: unknown;
|
||||
|
||||
constructor(realClient: any) {
|
||||
constructor(realClient: unknown) {
|
||||
this.realClient = realClient;
|
||||
}
|
||||
|
||||
get chat() {
|
||||
return {
|
||||
completions: {
|
||||
create: async (params: any) => {
|
||||
create: async (params: unknown) => {
|
||||
if (openAIMock.isEnabled()) {
|
||||
return openAIMock.mockChatCompletion(params);
|
||||
}
|
||||
@ -380,7 +387,7 @@ export class MockOpenAIClient {
|
||||
|
||||
get batches() {
|
||||
return {
|
||||
create: async (params: any) => {
|
||||
create: async (params: unknown) => {
|
||||
if (openAIMock.isEnabled()) {
|
||||
return openAIMock.mockCreateBatch(params);
|
||||
}
|
||||
@ -397,7 +404,7 @@ export class MockOpenAIClient {
|
||||
|
||||
get files() {
|
||||
return {
|
||||
create: async (params: any) => {
|
||||
create: async (params: unknown) => {
|
||||
if (openAIMock.isEnabled()) {
|
||||
return openAIMock.mockUploadFile(params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user