Pi running inside the docker containers

This commit is contained in:
2026-02-22 22:21:47 +00:00
parent 99a27e5b13
commit 09cff3f763
15 changed files with 315 additions and 26 deletions
@@ -16,6 +16,7 @@ type EmbeddableChatProps = {
promptPrefix?: string;
className?: string;
cwd?: { root?: string; path: string };
sandboxed?: boolean;
autoSend?: boolean;
chat?: UsePiChatType;
};
@@ -17,12 +17,13 @@ type UseEmbeddableChatParams = {
defaultInput?: string;
promptPrefix?: string;
cwd?: { root?: string; path: string };
sandboxed?: boolean;
autoSend?: boolean;
chat?: UsePiChatType;
};
export function useEmbeddableChat(params: UseEmbeddableChatParams) {
const { initialMessage, defaultInput = '', promptPrefix, cwd, autoSend = false, chat: externalChat } = params;
const { initialMessage, defaultInput = '', promptPrefix, cwd, sandboxed, autoSend = false, chat: externalChat } = params;
const internalChat = usePiChat(params.sessionId, params.initialModel);
const chat = externalChat ?? internalChat;
@@ -79,6 +80,8 @@ export function useEmbeddableChat(params: UseEmbeddableChatParams) {
!sessionId && ids.length > 0 ? ids : undefined,
images.length > 0 ? images : undefined,
cwdForFirst,
undefined,
sandboxed,
);
attachmentManager.clearAttachments();
@@ -150,6 +153,8 @@ export function useEmbeddableChat(params: UseEmbeddableChatParams) {
initialMessage.attachmentIds,
initialMessage.images,
initialMessage.cwd,
undefined,
sandboxed,
);
}
}, [initialMessage, isConnected]);
@@ -133,6 +133,7 @@ function NewChat() {
const chat = usePiChat(undefined, locationState?.model);
const sandboxed = cwdMode === 'user';
const cwd = cwdMode === 'host' ? { path: getHostHome() } : locationState?.cwd;
const initialMessage = locationState?.initialMessage
@@ -160,6 +161,7 @@ function NewChat() {
initialMessage={initialMessage}
defaultInput={locationState?.prefillInput ?? ''}
cwd={cwd}
sandboxed={sandboxed}
className="flex-1 min-h-0"
/>
</div>
@@ -257,6 +257,7 @@ export function usePiChat(initialSessionId?: string, initialModel?: string | nul
images?: { filename: string; dataUrl: string }[],
cwdParam?: { root?: string; path: string },
groupSlug?: string | null,
sandboxed?: boolean,
) {
// Mark session as started on first message
if (!hasStarted) {
@@ -282,6 +283,7 @@ export function usePiChat(initialSessionId?: string, initialModel?: string | nul
sessionId: sessionIdRef.current,
...(selectedModel ? { model: selectedModel } : {}),
...(cwdParam?.path ? { cwd: cwdParam.path } : {}),
...(sandboxed !== undefined ? { sandboxed } : {}),
...(groupSlug !== undefined ? { groupSlug } : {}),
...(attachmentIds?.length ? { attachmentIds } : {}),
...(imageData?.length ? { images: imageData } : {}),