Skip to content

Commit

Permalink
feat: drag n drop files + refactor markdown (#550)
Browse files Browse the repository at this point in the history
* wip

* fix: markdown pre, code elements

* fixes

* fixes

* refactor

* remove uiw markdown dependency

* fixes

* fixes

* fixes

* feat: drag n drop files in textarea box

* fix: npm audit
  • Loading branch information
paulclindo authored Dec 11, 2024
1 parent 8f4bc32 commit 9d9954c
Show file tree
Hide file tree
Showing 12 changed files with 10,403 additions and 7,409 deletions.
2 changes: 1 addition & 1 deletion apps/shinkai-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "tsc && NODE_OPTIONS=\\\"--max-old-space-size=8192\\\" vite build ",
"preview": "vite preview",
"lint": "eslint --ext .js,.jsx,.ts,.tsx . --ignore-path .gitignore",
"tauri": "tauri",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { useTranslation } from '@shinkai_network/shinkai-i18n';
import {
Tooltip,
TooltipContent,
TooltipPortal,
TooltipTrigger,
} from '@shinkai_network/shinkai-ui';
import { cn } from '@shinkai_network/shinkai-ui/utils';
import { Paperclip } from 'lucide-react';
import * as React from 'react';

import { allowedFileExtensions } from '../../../lib/constants';
import { actionButtonClassnames } from '../conversation-footer';

type FileUploadInputProps = {
inputProps: React.InputHTMLAttributes<HTMLInputElement>;
onClick: () => void;
};

export function FileSelectionActionBar({
onClick,
inputProps,
}: FileUploadInputProps) {
const { t } = useTranslation();

return (
<>
<Tooltip>
<TooltipTrigger asChild>
<button
className={cn(actionButtonClassnames)}
onClick={onClick}
type="button"
>
<Paperclip className="h-full w-full" />
</button>
</TooltipTrigger>
<TooltipPortal>
<TooltipContent align="center" side="top">
{t('common.uploadFile')} <br />
{allowedFileExtensions.join(', ')}
</TooltipContent>
</TooltipPortal>
</Tooltip>
<input {...inputProps} />
</>
);
}
14 changes: 6 additions & 8 deletions apps/shinkai-desktop/src/components/chat/components/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
FileList,
Form,
FormField,
MarkdownPreview,
MarkdownText,
PythonCodeRunner,
Tooltip,
TooltipContent,
Expand Down Expand Up @@ -339,16 +339,14 @@ export const MessageBase = ({
</Accordion>
)}
{message.role === 'assistant' && (
<MarkdownPreview
className={cn(
message.content &&
message.status.type === 'running' &&
'md-running',
)}
source={extractErrorPropertyOrContent(
<MarkdownText
content={extractErrorPropertyOrContent(
message.content,
'error_message',
)}
isRunning={
!!message.content && message.status.type === 'running'
}
/>
)}
{message.role === 'assistant' &&
Expand Down
Loading

0 comments on commit 9d9954c

Please sign in to comment.