ai 분석 수정
This commit is contained in:
@@ -53,7 +53,7 @@ import StrategyEvaluationAiVerifyPanel from './strategyEvaluation/StrategyEvalua
|
||||
import {
|
||||
buildStrategyEvaluationAiVerifyContext,
|
||||
requestStrategyEvaluationAiVerify,
|
||||
summarizeVerifyContext,
|
||||
buildAiPanelSelectionSummary,
|
||||
} from '../utils/strategyEvaluationAiVerify';
|
||||
import type { StrategyEvaluationAiVerifyResponse } from '../utils/backendApi';
|
||||
|
||||
@@ -106,7 +106,6 @@ export default function StrategyEvaluationPage({ theme = 'dark' }: Props) {
|
||||
const [aiVerifyError, setAiVerifyError] = useState<string | null>(null);
|
||||
const [aiVerifyResult, setAiVerifyResult] = useState<StrategyEvaluationAiVerifyResponse | null>(null);
|
||||
const [aiVerifyContext, setAiVerifyContext] = useState<import('../utils/strategyEvaluationAiVerify').StrategyEvaluationAiVerifyContext | null>(null);
|
||||
const [aiVerifySummary, setAiVerifySummary] = useState<string | null>(null);
|
||||
const aiVerifyGenRef = useRef(0);
|
||||
const rightTabRef = useRef<RightTab>('signal');
|
||||
const aiVerifyPollAbortRef = useRef<AbortController | null>(null);
|
||||
@@ -298,6 +297,19 @@ export default function StrategyEvaluationPage({ theme = 'dark' }: Props) {
|
||||
[backtestSignals, selectedBarTimeSec, selectedBarIndex],
|
||||
);
|
||||
|
||||
const aiPanelSelectionSummary = useMemo(
|
||||
() => buildAiPanelSelectionSummary({
|
||||
market,
|
||||
timeframe: chartTimeframe,
|
||||
bars,
|
||||
selectedBarIndex,
|
||||
snapshot,
|
||||
barSignalHighlight,
|
||||
strategyName: selectedStrategy?.name ?? null,
|
||||
}),
|
||||
[market, chartTimeframe, bars, selectedBarIndex, snapshot, barSignalHighlight, selectedStrategy?.name],
|
||||
);
|
||||
|
||||
const handleSignalsChange = useCallback((signals: BacktestSignal[]) => {
|
||||
setBacktestSignals(signals);
|
||||
}, []);
|
||||
@@ -439,7 +451,6 @@ export default function StrategyEvaluationPage({ theme = 'dark' }: Props) {
|
||||
indicatorParams,
|
||||
evaluationBarCount: Math.min(BACKTEST_DISPLAY_BAR_COUNT, bars.length),
|
||||
});
|
||||
setAiVerifySummary(summarizeVerifyContext(context));
|
||||
setAiVerifyContext(context);
|
||||
|
||||
const result = await requestStrategyEvaluationAiVerify(context, {
|
||||
@@ -863,7 +874,7 @@ export default function StrategyEvaluationPage({ theme = 'dark' }: Props) {
|
||||
<StrategyEvaluationAiVerifyPanel
|
||||
loading={aiVerifyRunning}
|
||||
error={aiVerifyError}
|
||||
contextSummary={aiVerifySummary}
|
||||
selectionSummary={aiPanelSelectionSummary}
|
||||
verifyContext={aiVerifyContext}
|
||||
result={aiVerifyResult}
|
||||
runDisabled={aiVerifyDisabled}
|
||||
|
||||
@@ -207,7 +207,8 @@ const FixPointsPanel: React.FC<{ bundle: AiVerifyFixPointsBundle }> = ({ bundle
|
||||
export interface StrategyEvaluationAiVerifyPanelProps {
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
contextSummary: string | null;
|
||||
/** 차트 선택 봉·평가 요약 (실시간) */
|
||||
selectionSummary: string | null;
|
||||
verifyContext: StrategyEvaluationAiVerifyContext | null;
|
||||
result: StrategyEvaluationAiVerifyResponse | null;
|
||||
runDisabled?: boolean;
|
||||
@@ -217,7 +218,7 @@ export interface StrategyEvaluationAiVerifyPanelProps {
|
||||
const StrategyEvaluationAiVerifyPanel: React.FC<StrategyEvaluationAiVerifyPanelProps> = ({
|
||||
loading,
|
||||
error,
|
||||
contextSummary,
|
||||
selectionSummary,
|
||||
verifyContext,
|
||||
result,
|
||||
runDisabled = false,
|
||||
@@ -238,18 +239,15 @@ const StrategyEvaluationAiVerifyPanel: React.FC<StrategyEvaluationAiVerifyPanelP
|
||||
}
|
||||
}, [result?.analysis]);
|
||||
|
||||
const hasContent = loading || error || result;
|
||||
|
||||
return (
|
||||
<div className="seval-ai-verify-panel">
|
||||
<header className="seval-ai-verify-panel-head">
|
||||
<div className="seval-ai-verify-panel-head-main">
|
||||
{contextSummary && (
|
||||
<p className="seval-ai-verify-summary">{contextSummary}</p>
|
||||
)}
|
||||
{!contextSummary && !hasContent && (
|
||||
{selectionSummary ? (
|
||||
<pre className="seval-ai-verify-panel-selection">{selectionSummary}</pre>
|
||||
) : (
|
||||
<p className="seval-ai-verify-panel-empty-hint">
|
||||
차트 툴바의 AI 검증 버튼 또는 아래 실행으로 선택 봉 기준 LLM 분석을 시작합니다.
|
||||
차트에서 봉을 선택하면 해당 캔들 정보가 표시됩니다.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -265,7 +263,7 @@ const StrategyEvaluationAiVerifyPanel: React.FC<StrategyEvaluationAiVerifyPanelP
|
||||
분석 중…
|
||||
</>
|
||||
) : (
|
||||
result ? '다시 분석' : '분석 실행'
|
||||
'AI 분석'
|
||||
)}
|
||||
</button>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user