-
Notifications
You must be signed in to change notification settings - Fork 11
Workspace instruction modal for autogen and new workspace #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9397021
3023f16
f7db6af
dbaec37
5671895
f79d45c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| "use client"; | ||
|
|
||
| import { DevToolsModal } from "@assistant-ui/react-devtools"; | ||
| import { useAui } from "@assistant-ui/react"; | ||
| import { useAui, useAuiState } from "@assistant-ui/react"; | ||
| import { Thread } from "./thread"; | ||
| import { useWorkspaceState } from "@/hooks/workspace/use-workspace-state"; | ||
| import { useWorkspaceContextProvider } from "@/hooks/ai/use-workspace-context-provider"; | ||
|
|
@@ -22,6 +22,7 @@ interface AssistantPanelProps { | |
| onSingleSelect?: (text: string, range?: Range) => void | Promise<void>; | ||
| onMultiSelect?: (selections: Array<{ text: string; id: string; range?: Range }>) => void | Promise<void>; | ||
| onReady?: () => void; | ||
| onThreadRunningChange?: (isRunning: boolean) => void; | ||
| } | ||
|
|
||
| export function AssistantPanel({ | ||
|
|
@@ -31,7 +32,8 @@ export function AssistantPanel({ | |
| setIsChatMaximized, | ||
| onSingleSelect, | ||
| onMultiSelect, | ||
| onReady | ||
| onReady, | ||
| onThreadRunningChange, | ||
| }: AssistantPanelProps) { | ||
| // Don't render if no workspaceId | ||
| if (!workspaceId) { | ||
|
|
@@ -49,6 +51,7 @@ export function AssistantPanel({ | |
| onSingleSelect={onSingleSelect} | ||
| onMultiSelect={onMultiSelect} | ||
| onReady={onReady} | ||
| onThreadRunningChange={onThreadRunningChange} | ||
| /> | ||
| </> | ||
| ); | ||
|
|
@@ -61,7 +64,8 @@ function WorkspaceContextWrapper({ | |
| setIsChatMaximized, | ||
| onSingleSelect, | ||
| onMultiSelect, | ||
| onReady | ||
| onReady, | ||
| onThreadRunningChange, | ||
| }: { | ||
| workspaceId?: string | null; | ||
| setIsChatExpanded?: (expanded: boolean) => void; | ||
|
|
@@ -70,6 +74,7 @@ function WorkspaceContextWrapper({ | |
| onSingleSelect?: (text: string, range?: Range) => void | Promise<void>; | ||
| onMultiSelect?: (selections: Array<{ text: string; id: string; range?: Range }>) => void | Promise<void>; | ||
| onReady?: () => void; | ||
| onThreadRunningChange?: (isRunning: boolean) => void; | ||
| }) { | ||
| // Fetch current workspace state (includes loading state) | ||
| const { state, isLoading } = useWorkspaceState(workspaceId || null); | ||
|
|
@@ -96,6 +101,7 @@ function WorkspaceContextWrapper({ | |
| onReady={onReady} | ||
| state={state} | ||
| isLoading={isLoading} | ||
| onThreadRunningChange={onThreadRunningChange} | ||
| /> | ||
| </> | ||
| ); | ||
|
|
@@ -249,6 +255,7 @@ function WorkspaceContextWrapperContent({ | |
| onReady, | ||
| state, | ||
| isLoading, | ||
| onThreadRunningChange, | ||
| }: { | ||
| workspaceId?: string | null; | ||
| setIsChatExpanded?: (expanded: boolean) => void; | ||
|
|
@@ -259,6 +266,7 @@ function WorkspaceContextWrapperContent({ | |
| onReady?: () => void; | ||
| state: ReturnType<typeof useWorkspaceState>["state"]; | ||
| isLoading: boolean; | ||
| onThreadRunningChange?: (isRunning: boolean) => void; | ||
| }) { | ||
| // Notify parent when content is ready | ||
| useEffect(() => { | ||
|
|
@@ -308,6 +316,8 @@ function WorkspaceContextWrapperContent({ | |
| )} | ||
| data-tour="chat-panel" | ||
| > | ||
| <ThreadRunningObserver onRunningChange={onThreadRunningChange} /> | ||
|
|
||
| {/* Chat Header */} | ||
| <AppChatHeader | ||
| onCollapse={() => setIsChatExpanded?.(false)} | ||
|
|
@@ -329,3 +339,13 @@ function WorkspaceContextWrapperContent({ | |
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function ThreadRunningObserver({ onRunningChange }: { onRunningChange?: (isRunning: boolean) => void }) { | ||
| const isRunning = useAuiState(({ thread }) => (thread as any)?.isRunning ?? false); | ||
|
|
||
| useEffect(() => { | ||
| onRunningChange?.(isRunning); | ||
| }, [isRunning, onRunningChange]); | ||
|
|
||
| return null; | ||
| } | ||
|
Comment on lines
+343
to
+351
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's look at the actual file to understand the context
cat -n src/components/assistant-ui/AssistantPanel.tsx | head -360 | tail -30Repository: ThinkEx-OSS/thinkex Length of output: 1146 🏁 Script executed: # Check what's imported from `@assistant-ui/react` at the top of the file
head -30 src/components/assistant-ui/AssistantPanel.tsxRepository: ThinkEx-OSS/thinkex Length of output: 1478 🏁 Script executed: # Look for any type definitions or existing patterns in the codebase for accessing thread state
rg "useAuiState" --type tsx -A 2 -B 2Repository: ThinkEx-OSS/thinkex Length of output: 90 🌐 Web query:
💡 Result:
Thread state (what you can select)From
There are also convenience conditions you’ll commonly see in UI like Example selectors import { useAuiState } from "@assistant-ui/react";
const isRunning = useAuiState(({ thread }) => thread.isRunning);
const messageCount = useAuiState(({ thread }) => thread.messages.length);[1][3] Sources: Context API guide (covers Remove unnecessary The const isRunning = useAuiState(({ thread }) => thread.isRunning);If a fallback to const isRunning = useAuiState(({ thread }) => thread.isRunning ?? false);🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ThinkEx-OSS/thinkex
Length of output: 120
🏁 Script executed:
Repository: ThinkEx-OSS/thinkex
Length of output: 124
🏁 Script executed:
Repository: ThinkEx-OSS/thinkex
Length of output: 21193
Remove unused
useStaticFallbackandmediaSrcprops fromWorkspaceInstructionModal.Both props are declared in the interface (lines 18–19) but never destructured or referenced in the component body. Either remove them from the interface and call site, or implement their intended functionality.
🤖 Prompt for AI Agents