diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index daa7ace7..023e5ad4 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -2,26 +2,39 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "Capability for the main window", - "windows": ["main"], + "windows": ["main", "chat"], "permissions": [ + "core:default", + "core:event:allow-emit", "core:event:allow-listen", - "core:window:default", - "core:window:allow-start-dragging", "core:webview:allow-create-webview", - "core:window:allow-show", "core:webview:allow-create-webview-window", + "core:webview:allow-get-all-webviews", "core:webview:allow-webview-close", + "core:webview:allow-webview-hide", + "core:webview:allow-webview-show", + "core:webview:allow-webview-size", + "core:webview:allow-set-webview-size", + "core:webview:allow-set-webview-zoom", + "core:window:default", + "core:window:allow-center", "core:window:allow-close", "core:window:allow-hide", - "core:webview:allow-set-webview-size", + "core:window:allow-show", + "core:window:allow-create", + "core:window:allow-destroy", + "core:window:allow-start-dragging", "core:window:allow-set-size", - "core:default", + "core:window:allow-get-all-windows", "shell:allow-open", "http:default", "http:allow-fetch", "http:allow-fetch-cancel", "http:allow-fetch-read-body", "http:allow-fetch-send", + "websocket:default", + "websocket:allow-connect", + "websocket:allow-send", { "identifier": "http:default", "allow": [ @@ -30,9 +43,6 @@ } ], "deny": [] - }, - "websocket:default", - "websocket:allow-connect", - "websocket:allow-send" + } ] } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 5eb020c6..2fe5bc58 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -13,14 +13,46 @@ "macOSPrivateApi": true, "windows": [ { - "title": "Coco AI", - "width": 900, - "height": 800, - "maxHeight": 800, - "transparent": true, - "resizable": true, + "acceptFirstMouse": true, + "alwaysOnBottom": false, + "alwaysOnTop": false, + "center": false, + "closable": true, + "contentProtected": false, + "create": true, + "decorations": false, + "dragDropEnabled": true, + "focus": false, "fullscreen": false, - "decorations": false + "height": 90, + "maxHeight": 700, + "minHeight": 90, + "width": 680, + "maxWidth": 680, + "minWidth": 680, + "hiddenTitle": false, + "incognito": false, + "label": "main", + "maximizable": false, + "minimizable": true, + "maximized": false, + "proxyUrl": "http://localhost:2900", + "resizable": false, + "shadow": true, + "skipTaskbar": false, + "theme": "Light", + "title": "Coco AI", + "transparent": true, + "url": "/ui", + "visible": true, + "visibleOnAllWorkspaces": true, + "windowEffects": { + "effects": [], + "radius": 20 + }, + "x": null, + "y": null, + "zoomHotkeysEnabled": false } ], "security": { @@ -45,6 +77,7 @@ }, "plugins": { "window": {}, - "websocket": {} + "websocket": {}, + "shell": {} } -} \ No newline at end of file +} diff --git a/src/components/ChatAI/AutoResizeTextarea.tsx b/src/components/ChatAI/AutoResizeTextarea.tsx new file mode 100644 index 00000000..ce5e81f8 --- /dev/null +++ b/src/components/ChatAI/AutoResizeTextarea.tsx @@ -0,0 +1,43 @@ +import React, { useEffect, useRef } from "react"; + +interface AutoResizeTextareaProps { + input: string; + setInput: (value: string) => void; + handleKeyDown?: (e: React.KeyboardEvent) => void; +} + +const AutoResizeTextarea: React.FC = ({ + input, + setInput, + handleKeyDown, +}) => { + const textareaRef = useRef(null); + + useEffect(() => { + const textarea = textareaRef.current; + if (textarea) { + textarea.style.height = "auto"; // Reset height to recalculate + textarea.style.height = `${textarea.scrollHeight}px`; // Adjust based on content + } + }, [input]); + + return ( +