feat: add Chinese localization and new assets for CCW documentation

- Created LICENSE.txt for JavaScript assets including NProgress and React libraries.
- Added runtime JavaScript file for main functionality.
- Introduced new favicon and logo SVG assets for branding.
- Added comprehensive FAQ section in Chinese, covering CCW features, installation, workflows, AI model support, and troubleshooting.
This commit is contained in:
catlog22
2026-02-06 22:39:35 +08:00
parent 6a5c17e42e
commit 0c0e442fe6
10 changed files with 1561 additions and 351 deletions

View File

@@ -0,0 +1,84 @@
// ========================================
// useNativeSession Hook
// ========================================
// TanStack Query hook for native CLI session content
import { useQuery } from '@tanstack/react-query';
import {
fetchNativeSession,
type NativeSession,
} from '../lib/api';
import { useWorkflowStore, selectProjectPath } from '@/stores/workflowStore';
// ========== Query Keys ==========
export const nativeSessionKeys = {
all: ['nativeSession'] as const,
details: () => [...nativeSessionKeys.all, 'detail'] as const,
detail: (id: string | null) => [...nativeSessionKeys.details(), id] as const,
};
// ========== Constants ==========
const STALE_TIME = 5 * 60 * 1000;
const GC_TIME = 10 * 60 * 1000;
// ========== Types ==========
export interface UseNativeSessionOptions {
staleTime?: number;
gcTime?: number;
enabled?: boolean;
}
export interface UseNativeSessionReturn {
data: NativeSession | undefined;
isLoading: boolean;
isFetching: boolean;
error: Error | null;
refetch: () => Promise<void>;
}
// ========== Hook ==========
/**
* Hook for fetching native CLI session content
*
* @param executionId - The CCW execution ID to fetch native session for
* @param options - Query options
*/
export function useNativeSession(
executionId: string | null,
options: UseNativeSessionOptions = {}
): UseNativeSessionReturn {
const { staleTime = STALE_TIME, gcTime = GC_TIME, enabled = true } = options;
const projectPath = useWorkflowStore(selectProjectPath);
const query = useQuery<NativeSession>({
queryKey: nativeSessionKeys.detail(executionId),
queryFn: () => {
if (!executionId) throw new Error('executionId is required');
return fetchNativeSession(executionId, projectPath);
},
enabled: !!executionId && enabled,
staleTime,
gcTime,
refetchOnWindowFocus: false,
refetchOnMount: false,
refetchOnReconnect: false,
retry: 2,
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000),
});
const refetch = async () => {
await query.refetch();
};
return {
data: query.data,
isLoading: query.isLoading,
isFetching: query.isFetching,
error: query.error,
refetch,
};
}