mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
feat: add useApiSettings hook for managing API settings, including providers, endpoints, cache, and model pools
- Implemented hooks for CRUD operations on providers and endpoints. - Added cache management hooks for cache stats and settings. - Introduced model pool management hooks for high availability and load balancing. - Created localization files for English and Chinese translations of API settings.
This commit is contained in:
@@ -77,6 +77,7 @@ interface CliStreamState extends BlockCacheState {
|
||||
outputs: Record<string, CliOutputLine[]>;
|
||||
executions: Record<string, CliExecutionState>;
|
||||
currentExecutionId: string | null;
|
||||
userClosedExecutions: Set<string>; // Track executions closed by user
|
||||
|
||||
// Legacy methods
|
||||
addOutput: (executionId: string, line: CliOutputLine) => void;
|
||||
@@ -87,6 +88,9 @@ interface CliStreamState extends BlockCacheState {
|
||||
getAllExecutions: () => CliExecutionState[];
|
||||
upsertExecution: (executionId: string, exec: Partial<CliExecutionState> & { tool?: string; mode?: string }) => void;
|
||||
removeExecution: (executionId: string) => void;
|
||||
markExecutionClosedByUser: (executionId: string) => void;
|
||||
isExecutionClosedByUser: (executionId: string) => boolean;
|
||||
cleanupUserClosedExecutions: (serverIds: Set<string>) => void;
|
||||
setCurrentExecution: (executionId: string | null) => void;
|
||||
|
||||
// Block cache methods
|
||||
@@ -320,6 +324,7 @@ export const useCliStreamStore = create<CliStreamState>()(
|
||||
outputs: {},
|
||||
executions: {},
|
||||
currentExecutionId: null,
|
||||
userClosedExecutions: new Set<string>(),
|
||||
|
||||
// Block cache state
|
||||
blocks: {},
|
||||
@@ -426,6 +431,35 @@ export const useCliStreamStore = create<CliStreamState>()(
|
||||
}, false, 'cliStream/removeExecution');
|
||||
},
|
||||
|
||||
markExecutionClosedByUser: (executionId: string) => {
|
||||
set((state) => {
|
||||
const newUserClosedExecutions = new Set(state.userClosedExecutions);
|
||||
newUserClosedExecutions.add(executionId);
|
||||
return {
|
||||
userClosedExecutions: newUserClosedExecutions,
|
||||
};
|
||||
}, false, 'cliStream/markExecutionClosedByUser');
|
||||
},
|
||||
|
||||
isExecutionClosedByUser: (executionId: string) => {
|
||||
return get().userClosedExecutions.has(executionId);
|
||||
},
|
||||
|
||||
cleanupUserClosedExecutions: (serverIds: Set<string>) => {
|
||||
set((state) => {
|
||||
const newUserClosedExecutions = new Set<string>();
|
||||
for (const executionId of state.userClosedExecutions) {
|
||||
// Only keep if still on server (user might want to keep it closed)
|
||||
if (serverIds.has(executionId)) {
|
||||
newUserClosedExecutions.add(executionId);
|
||||
}
|
||||
}
|
||||
return {
|
||||
userClosedExecutions: newUserClosedExecutions,
|
||||
};
|
||||
}, false, 'cliStream/cleanupUserClosedExecutions');
|
||||
},
|
||||
|
||||
setCurrentExecution: (executionId: string | null) => {
|
||||
set({ currentExecutionId: executionId }, false, 'cliStream/setCurrentExecution');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user