code-review-fix task 9.8: replace any types with proper interfaces
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1b637dc45e
commit
ba20d9e5ab
3 changed files with 25 additions and 20 deletions
|
|
@ -13,8 +13,9 @@ import { ThemeToggle } from '@/components/ThemeToggle';
|
|||
import KeyboardShortcutsModal from '@/components/KeyboardShortcutsModal';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Settings, Tag, Layers } from 'lucide-react';
|
||||
import type { PredictionState, PredictionSpan, ModelInfoResponse, Disagreement, DisagreementType, PredictionSummary } from '@/types/predictions';
|
||||
import type { SpanAnnotation, SpanLabelType } from '@/types';
|
||||
import type { PredictionState, PredictionSpan, PerCandlePrediction, ModelInfoResponse, Disagreement, DisagreementType, PredictionSummary } from '@/types/predictions';
|
||||
import type { Candle, SpanAnnotation, SpanLabelType } from '@/types';
|
||||
import type { Geometry } from '@/types/annotations';
|
||||
|
||||
/**
|
||||
* Calculate overlap between two time ranges
|
||||
|
|
@ -136,7 +137,7 @@ interface Annotation {
|
|||
timestamp: number;
|
||||
label_type: string;
|
||||
color: string | null;
|
||||
geometry: any;
|
||||
geometry: Geometry | null;
|
||||
created_at: number;
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +175,7 @@ export default function Home() {
|
|||
// Prediction cache: Map<cacheKey, { spans, predictions, modelVersion }>
|
||||
const predictionCacheRef = useRef<Map<string, {
|
||||
spans: PredictionSpan[];
|
||||
predictions: any[];
|
||||
predictions: PerCandlePrediction[];
|
||||
modelVersion: string;
|
||||
}>>(new Map());
|
||||
|
||||
|
|
@ -483,7 +484,7 @@ export default function Home() {
|
|||
}, []);
|
||||
|
||||
// Fetch predictions for visible candles
|
||||
const fetchPredictions = useCallback(async (candles: any[]) => {
|
||||
const fetchPredictions = useCallback(async (candles: Candle[]) => {
|
||||
if (!activeChartId || candles.length === 0) return;
|
||||
|
||||
const currentModelInfo = modelInfoRef.current;
|
||||
|
|
@ -528,7 +529,8 @@ export default function Home() {
|
|||
if (cacheKey) {
|
||||
const cache = predictionCacheRef.current;
|
||||
if (cache.size >= 100) {
|
||||
cache.delete(cache.keys().next().value);
|
||||
const firstKey = cache.keys().next().value;
|
||||
if (firstKey !== undefined) cache.delete(firstKey);
|
||||
}
|
||||
cache.set(cacheKey, {
|
||||
spans: data.spans,
|
||||
|
|
@ -654,7 +656,8 @@ export default function Home() {
|
|||
if (cacheKey) {
|
||||
const cache = predictionCacheRef.current;
|
||||
if (cache.size >= 100) {
|
||||
cache.delete(cache.keys().next().value);
|
||||
const firstKey = cache.keys().next().value;
|
||||
if (firstKey !== undefined) cache.delete(firstKey);
|
||||
}
|
||||
cache.set(cacheKey, {
|
||||
spans: data.spans,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue