Skip to content

Commit 75c93e7

Browse files
authored
🤖 fix: unify chat input and commands flow (#704)
Refactors chat command handling to unify behavior between workspace chat and creation flow. Supports global commands like /providers in creation mode. Reduces LoC by consolidating utility functions.
1 parent 037785f commit 75c93e7

File tree

7 files changed

+516
-328
lines changed

7 files changed

+516
-328
lines changed

src/browser/App.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { buildCoreSources, type BuildSourcesParams } from "./utils/commands/sour
2828

2929
import type { ThinkingLevel } from "@/common/types/thinking";
3030
import { CUSTOM_EVENTS } from "@/common/constants/events";
31-
import { isWorkspaceForkSwitchEvent } from "./utils/workspaceFork";
31+
import { isWorkspaceForkSwitchEvent } from "./utils/workspaceEvents";
3232
import { getThinkingLevelKey } from "@/common/constants/storage";
3333
import type { BranchListResult } from "@/common/types/ipc";
3434
import { useTelemetry } from "./hooks/useTelemetry";
@@ -517,6 +517,16 @@ function AppInner() {
517517
);
518518
}, [projects, setSelectedWorkspace, setWorkspaceMetadata]);
519519

520+
const handleProviderConfig = useCallback(
521+
async (provider: string, keyPath: string[], value: string) => {
522+
const result = await window.api.providers.setProviderConfig(provider, keyPath, value);
523+
if (!result.success) {
524+
throw new Error(result.error);
525+
}
526+
},
527+
[]
528+
);
529+
520530
return (
521531
<>
522532
<div className="bg-bg-dark mobile-layout flex h-screen overflow-hidden">
@@ -561,6 +571,7 @@ function AppInner() {
561571
variant="creation"
562572
projectPath={projectPath}
563573
projectName={projectName}
574+
onProviderConfig={handleProviderConfig}
564575
onReady={handleCreationChatReady}
565576
onWorkspaceCreated={(metadata) => {
566577
// Add to workspace metadata map

0 commit comments

Comments
 (0)