Verify analysis recovery in browser and refresh new job status

This commit is contained in:
2026-09-06 12:47:11 +03:00
parent bfef768974
commit fa28fb5f85
7 changed files with 49 additions and 19 deletions
+4 -2
View File
@@ -159,7 +159,7 @@ export const AppProvider = ({ children }) => {
// Giriş yapınca kullanıcı verisini SUNUCUDAN yükle (localStorage'ı ezer)
useEffect(() => {
aiRunRef.current=null;setAiAnalyzing(false);
aiRunRef.current=null;setAiAnalyzing(false);setAiJobStatus('');
setVeriSenkron(false); setPlan(null); setSaveError(null);
setFavoriteKurumlar([]); setTeamMembers([]); setSavedFilters([]); setCompetitorWatchlist([]);
setReminderSettings(defaultReminder()); setUserProfile(defaultProfile(authUser));
@@ -338,6 +338,7 @@ export const AppProvider = ({ children }) => {
// tetiklenebiliyor; modalın beklerken boş görünmemesi için ortak sinyal.
const [aiAnalyzing, setAiAnalyzing] = useState(false);
const aiRunRef=useRef(null);
const [aiJobStatus,setAiJobStatus]=useState('');
// Enterprise Module States
// Rakip izleme listesi — kullanıcı gerçek kazanan firma analizinden ekler (hesaba özel sunucu kaydı)
@@ -454,7 +455,7 @@ export const AppProvider = ({ children }) => {
setAiAnalysisResults(null);
try {
const { analyzeSpecText } = await import('../services/ai');
const data = await analyzeSpecText({ text, fileName, tender, chain: aiModelConfig.chain, mode, extraction, reviewedSource });
const data = await analyzeSpecText({ text, fileName, tender, chain: aiModelConfig.chain, mode, extraction, reviewedSource },{onProgress:job=>{if(getToken()===session && aiRunRef.current===run)setAiJobStatus(`${job.id}:${job.state}`);}});
const {analysisView}=await import('../services/ai');
const result=analysisView(data,{tender,mode,fileName});
if(getToken() !== session || aiRunRef.current!==run) throw new Error('Oturum değişti; analiz sonucu bu hesaba aktarılmadı.');
@@ -785,6 +786,7 @@ export const AppProvider = ({ children }) => {
openSavedAnalysis,
aiAnalysisResults,
aiAnalyzing,
aiJobStatus,
competitorWatchlist,
setCompetitorWatchlist,
vaultDocuments,