forked from WordPress/ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
114 lines (103 loc) · 2.2 KB
/
Copy pathtypes.ts
File metadata and controls
114 lines (103 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* Internal dependencies
*/
import type { ProviderMetadataMap } from '../types/providers';
export type SummaryPeriod =
| 'minute'
| 'hour'
| 'day'
| 'week'
| 'month'
| 'all';
export interface LogEntrySource {
type?: string;
slug?: string;
name?: string;
file?: string;
}
export interface LogEntryContext extends Record< string, unknown > {
input_preview?: string;
output_preview?: string;
request_kind?: string;
image_urls?: unknown[];
image_base64_samples?: unknown[];
source?: LogEntrySource | Record< string, unknown >;
}
export interface LogEntry {
id: string;
timestamp: string;
type: 'ai_client' | 'mcp_tool' | 'ability';
operation: string;
provider: string | null;
model: string | null;
duration_ms: number | null;
tokens_input: number | null;
tokens_output: number | null;
tokens_total: number | null;
tokens_per_second: number | null;
status: 'success' | 'error' | 'timeout';
error_message: string | null;
user_id: number | null;
context: LogEntryContext | null;
}
export interface LogSummary {
total_requests: number;
total_tokens: number;
avg_duration_ms: number;
success_rate: number;
by_type: Record< string, number >;
by_provider: Record< string, number >;
by_status: Record< string, number >;
}
export interface UserFilterOption {
value: string;
label: string;
}
export interface FilterOptions {
types: string[];
providers: string[];
statuses: string[];
operations: string[];
users: UserFilterOption[];
}
export interface LogsQuery {
page: number;
perPage: number;
search: string;
type: string;
status: string;
provider: string;
operation: string[];
tokensFilter: string;
userId: string;
orderby: string;
order: 'asc' | 'desc';
}
export interface ConnectorApprovalNotice {
count: number;
reviewUrl: string;
dismissUrl: string;
}
export interface LocalizedSettings {
rest: {
nonce: string;
root: string;
routes: {
logs: string;
summary: string;
filters: string;
};
};
initialState: {
summary: LogSummary;
filters: FilterOptions;
};
connectorsUrl: string;
providerMetadata: ProviderMetadataMap;
connectorApprovalNotice: ConnectorApprovalNotice | null;
}
declare global {
interface Window {
aiRequestLogsSettings?: LocalizedSettings;
}
}