完善文件替换规则
This commit is contained in:
@@ -75,6 +75,12 @@ const RelayStationManager: React.FC<RelayStationManagerProps> = ({ onBack }) =>
|
||||
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
|
||||
const [stationToDelete, setStationToDelete] = useState<RelayStation | null>(null);
|
||||
const [togglingEnable, setTogglingEnable] = useState<Record<string, boolean>>({});
|
||||
|
||||
// 处理选中中转站的逻辑(用于切换时恢复自定义JSON)
|
||||
const handleSelectStation = (station: RelayStation) => {
|
||||
setSelectedStation(station);
|
||||
setShowEditDialog(true);
|
||||
};
|
||||
const [currentConfig, setCurrentConfig] = useState<Record<string, string | null>>({});
|
||||
const [loadingConfig, setLoadingConfig] = useState(false);
|
||||
const [jsonConfigView, setJsonConfigView] = useState(false);
|
||||
@@ -757,7 +763,7 @@ const RelayStationManager: React.FC<RelayStationManagerProps> = ({ onBack }) =>
|
||||
station={station}
|
||||
getStatusBadge={getStatusBadge}
|
||||
getAdapterDisplayName={getAdapterDisplayName}
|
||||
setSelectedStation={setSelectedStation}
|
||||
setSelectedStation={handleSelectStation}
|
||||
setShowEditDialog={setShowEditDialog}
|
||||
openDeleteDialog={openDeleteDialog}
|
||||
quotaData={quotaData}
|
||||
@@ -1766,6 +1772,20 @@ const EditStationDialog: React.FC<{
|
||||
return '';
|
||||
});
|
||||
|
||||
// 监听station变化,更新自定义JSON
|
||||
useEffect(() => {
|
||||
if (station.adapter_config) {
|
||||
const { service_type, ...customFields } = station.adapter_config as any;
|
||||
if (Object.keys(customFields).length > 0) {
|
||||
setCustomJson(JSON.stringify(customFields, null, 2));
|
||||
} else {
|
||||
setCustomJson('');
|
||||
}
|
||||
} else {
|
||||
setCustomJson('');
|
||||
}
|
||||
}, [station.id]); // 只监听station.id变化,避免循环更新
|
||||
|
||||
const [showSpeedTestModal, setShowSpeedTestModal] = useState(false);
|
||||
const [speedTestResults, setSpeedTestResults] = useState<{ url: string; name: string; responseTime: number | null; status: 'testing' | 'success' | 'failed' }[]>([]);
|
||||
const [speedTestInProgress, setSpeedTestInProgress] = useState(false);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useTabState } from '@/hooks/useTabState';
|
||||
import { useScreenTracking } from '@/hooks/useAnalytics';
|
||||
import { Tab } from '@/contexts/TabContext';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { api, type Project, type Session, type ClaudeMdFile } from '@/lib/api';
|
||||
import { api, type Project, type Session } from '@/lib/api';
|
||||
import { ProjectList } from '@/components/ProjectList';
|
||||
import { SessionList } from '@/components/SessionList';
|
||||
import { RunningClaudeSessions } from '@/components/RunningClaudeSessions';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { motion, AnimatePresence, Reorder } from 'framer-motion';
|
||||
import { X, Plus, MessageSquare, Bot, AlertCircle, Loader2, Folder, BarChart, Server, Settings, FileText } from 'lucide-react';
|
||||
import { X, Plus, MessageSquare, Bot, AlertCircle, Loader2, Folder, BarChart, Server, Settings } from 'lucide-react';
|
||||
import { useTabState } from '@/hooks/useTabState';
|
||||
import { Tab, useTabContext } from '@/contexts/TabContext';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
Reference in New Issue
Block a user