feat(core): Update opengrammar/extension/src/types.ts (Commit #22)
Swadhin Biswas committed 7 months ago
5e3786a
1 parent 9292900
commit 5e3786a
1 file changed
+72 -0
Showing 1 changed file+72-0
▼opengrammar/extension/src/types.ts
+72-0
| @@ -24,6 +24,17 @@ export interface Issue { | ||
24 | 24 | length: number; |
25 | 25 | id?: string; |
26 | 26 | ignored?: boolean; |
27 | + confidence?: number; | |
28 | + priority?: number; | |
29 | + source?: 'rule' | 'llm' | 'context'; | |
30 | +} | |
31 | + | |
32 | +export interface IgnoredIssue { | |
33 | + id: string; | |
34 | + type: Issue['type']; | |
35 | + original: string; | |
36 | + suggestion: string; | |
37 | + ignoredAt: number; | |
27 | 38 | } |
28 | 39 | |
29 | 40 | export interface AnalyzeRequest { |
| @@ -33,6 +44,17 @@ export interface AnalyzeRequest { | ||
33 | 44 | provider?: LLMProvider; |
34 | 45 | baseUrl?: string; |
35 | 46 | ignoredIssues?: string[]; |
47 | + dictionary?: string[]; | |
48 | + context?: AnalysisContext; | |
49 | +} | |
50 | + | |
51 | +export interface AnalysisContext { | |
52 | + domain?: string; | |
53 | + editorType?: string; | |
54 | + activeSentence?: string; | |
55 | + previousText?: string; | |
56 | + nextText?: string; | |
57 | + fullTextExcerpt?: string; | |
36 | 58 | } |
37 | 59 | |
38 | 60 | export interface AnalyzeResponse { |
| @@ -41,6 +63,7 @@ export interface AnalyzeResponse { | ||
41 | 63 | textLength: number; |
42 | 64 | issuesCount: number; |
43 | 65 | processingTimeMs: number; |
66 | + contextUsed?: boolean; | |
44 | 67 | model?: string; |
45 | 68 | provider?: string; |
46 | 69 | }; |
| @@ -69,3 +92,52 @@ export interface RewriteResponse { | ||
69 | 92 | tone: string; |
70 | 93 | error?: string; |
71 | 94 | } |
95 | + | |
96 | +export interface AutocompleteRequest { | |
97 | + text: string; | |
98 | + cursor: number; | |
99 | + apiKey?: string; | |
100 | + model?: string; | |
101 | + provider?: LLMProvider; | |
102 | + baseUrl?: string; | |
103 | + context?: AnalysisContext; | |
104 | +} | |
105 | + | |
106 | +export interface AutocompleteResponse { | |
107 | + suggestion: string; | |
108 | + confidence: number; | |
109 | + replaceStart: number; | |
110 | + replaceEnd: number; | |
111 | + source: 'heuristic' | 'llm'; | |
112 | + error?: string; | |
113 | +} | |
114 | + | |
115 | +export interface EditorContext { | |
116 | + text: string; | |
117 | + issues: Issue[]; | |
118 | + sourceTabId?: number; | |
119 | + capturedAt: number; | |
120 | +} | |
121 | + | |
122 | +export interface RewriteContext { | |
123 | + selectedText: string; | |
124 | + sourceTabId?: number; | |
125 | + capturedAt: number; | |
126 | +} | |
127 | + | |
128 | +export type AnalyticsEventType = | |
129 | + | 'analysis_runs' | |
130 | + | 'issues_found' | |
131 | + | 'suggestions_applied' | |
132 | + | 'suggestions_ignored' | |
133 | + | 'autocomplete_shown' | |
134 | + | 'autocomplete_accepted' | |
135 | + | 'rewrite_opened' | |
136 | + | 'rewrite_applied'; | |
137 | + | |
138 | +export interface AnalyticsSummary { | |
139 | + totals: Record<AnalyticsEventType, number>; | |
140 | + domains: Record<string, number>; | |
141 | + providers: Record<string, number>; | |
142 | + lastUpdatedAt?: number; | |
143 | +} | |
72 | 144 | |