



















@@ -2324,8 +2324,7 @@ export function renderApp(state: AppViewState) {
23242324}
23252325})();
23262326}
2327-const openChatWorkspaceFile = (filePath: string) => {
2328-const itemId = `file:${filePath}`;
2327+const startChatWorkspaceFileOpenRequest = (itemId: string) => {
23292328chatWorkspaceFiles.activeId = itemId;
23302329const previousRequest = chatWorkspaceFileOpenRequests.get(state);
23312330const openRequest = {
@@ -2347,6 +2346,11 @@ export function renderApp(state: AppViewState) {
23472346currentFiles?.activeId === itemId
23482347);
23492348};
2349+return { isCurrentOpenRequest, openRequest };
2350+};
2351+const openChatWorkspaceFile = (filePath: string) => {
2352+const itemId = `file:${filePath}`;
2353+const { isCurrentOpenRequest, openRequest } = startChatWorkspaceFileOpenRequest(itemId);
23502354void (async () => {
23512355if (!state.client || !state.connected) {
23522356return;
@@ -2390,27 +2394,7 @@ export function renderApp(state: AppViewState) {
23902394};
23912395const openChatWorkspaceArtifact = (artifactId: string) => {
23922396const itemId = `artifact:${artifactId}`;
2393-chatWorkspaceFiles.activeId = itemId;
2394-const previousRequest = chatWorkspaceFileOpenRequests.get(state);
2395-const openRequest = {
2396-agentId: chatWorkspaceFiles.agentId,
2397-id: (previousRequest?.id ?? 0) + 1,
2398- itemId,
2399-sessionKey: currentSessionWorkspaceKey(),
2400-};
2401-chatWorkspaceFileOpenRequests.set(state, openRequest);
2402-const isCurrentOpenRequest = () => {
2403-const currentRequest = chatWorkspaceFileOpenRequests.get(state);
2404-const currentFiles = currentChatWorkspaceFilesState();
2405-return (
2406-currentRequest?.id === openRequest.id &&
2407-currentRequest.agentId === resolveChatWorkspaceAgentId() &&
2408-currentRequest.itemId === itemId &&
2409-currentRequest.sessionKey === currentSessionWorkspaceKey() &&
2410-currentFiles?.agentId === openRequest.agentId &&
2411-currentFiles?.activeId === itemId
2412-);
2413-};
2397+const { isCurrentOpenRequest, openRequest } = startChatWorkspaceFileOpenRequest(itemId);
24142398void (async () => {
24152399if (!state.client || !state.connected) {
24162400return;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。