Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hide python execution
Browse files Browse the repository at this point in the history
paulclindo committed Dec 12, 2024
1 parent 411e195 commit 8670734
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -228,6 +228,7 @@ function PlaygroundToolEditor({
disabledRetryAndEdit={true}
fetchPreviousPage={fetchPreviousPage}
hasPreviousPage={hasPreviousPage}
hidePythonExecution={true}
isFetchingPreviousPage={isFetchingPreviousPage}
isLoading={isChatConversationLoading}
isSuccess={isChatConversationSuccess}
3 changes: 3 additions & 0 deletions libs/shinkai-ui/src/components/chat/message-list.tsx
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ export const MessageList = ({
setArtifact,
artifacts,
artifact,
hidePythonExecution,
}: {
noMoreMessageLabel: string;
isSuccess: boolean;
@@ -91,6 +92,7 @@ export const MessageList = ({
artifacts?: Artifact[];
setArtifact?: (artifact: Artifact | null) => void;
artifact?: Artifact;
hidePythonExecution?: boolean;
}) => {
const chatContainerRef = useRef<HTMLDivElement>(null);
const previousChatHeightRef = useRef<number>(0);
@@ -311,6 +313,7 @@ export const MessageList = ({
? handleFirstMessageRetry
: handleRetryMessage
}
hidePythonExecution={hidePythonExecution}
key={`${message.messageId}::${messageIndex}`}
message={message}
messageId={message.messageId}
8 changes: 6 additions & 2 deletions libs/shinkai-ui/src/components/chat/message.tsx
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import { Artifact } from '@shinkai_network/shinkai-node-state/v2/queries/getChat
import { FormattedMessage } from '@shinkai_network/shinkai-node-state/v2/queries/getChatConversation/types';
import { format } from 'date-fns';
import { AnimatePresence, motion } from 'framer-motion';
import { Code, Edit3, Loader2, RotateCcw, XCircle } from 'lucide-react';
import { Edit3, Loader2, RotateCcw, XCircle } from 'lucide-react';
import { InfoCircleIcon } from 'primereact/icons/infocircle';
import React, { Fragment, memo, useEffect, useMemo, useState } from 'react';
import { useForm } from 'react-hook-form';
@@ -75,6 +75,7 @@ type MessageProps = {
setArtifactPanel?: (open: boolean) => void;
artifacts?: Artifact[];
artifact?: Artifact;
hidePythonExecution?: boolean;
};

const actionBar = {
@@ -162,6 +163,7 @@ const MessageBase = ({
setArtifact,
artifacts,
artifact,
hidePythonExecution,
}: MessageProps) => {
const { t } = useTranslation();

@@ -365,7 +367,9 @@ const MessageBase = ({
<DotsLoader />
</div>
)}
{pythonCode && <PythonCodeRunner code={pythonCode} />}
{pythonCode && hidePythonExecution && (
<PythonCodeRunner code={pythonCode} />
)}
{message.role === 'user' && !!message.attachments.length && (
<FileList
className="mt-2 min-w-[200px] max-w-[70vw]"

0 comments on commit 8670734

Please sign in to comment.