diff --git a/backend/ai/src/index.ts b/backend/ai/src/index.ts
index be44a2e..351d34b 100644
--- a/backend/ai/src/index.ts
+++ b/backend/ai/src/index.ts
@@ -19,7 +19,7 @@ export default {
{
role: "system",
content:
- "You are an expert coding assistant. You read code from a file, and you suggest new code to add to the file. You may be given instructions on what to generate, which you should follow. You should generate code that is correct, efficient, and follows best practices. You should also generate code that is clear and easy to read. When you generate code, you should only return the code, and nothing else. You should not include backticks in the code you generate.",
+ "You are an expert coding assistant. You read code from a file, and you suggest new code to add to the file. You may be given instructions on what to generate, which you should follow. You should generate code that is CORRECT, efficient, and follows best practices. You may generate multiple lines of code if necessary. When you generate code, you should ONLY return the code, and nothing else. You MUST NOT include backticks in the code you generate.",
},
{
role: "user",
diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts
index 8485889..24df452 100644
--- a/backend/server/src/index.ts
+++ b/backend/server/src/index.ts
@@ -17,8 +17,6 @@ import {
getSandboxFiles,
renameFile,
saveFile,
- stopServer,
- testDescribe,
} from "./utils";
import { IDisposable, IPty, spawn } from "node-pty";
import {
@@ -453,24 +451,22 @@ io.on("connection", async (socket) => {
);
}
- const sockets = await io.fetchSockets();
- if (inactivityTimeout) {
- clearTimeout(inactivityTimeout);
- }
- if (sockets.length === 0) {
- console.log("STARTING TIMER");
- inactivityTimeout = setTimeout(() => {
- io.fetchSockets().then(async (sockets) => {
- if (sockets.length === 0) {
- console.log("Closing server due to inactivity.");
- const res = await stopServer(data.sandboxId);
- console.log("Server stopped", res);
- }
- });
- }, 20000);
- } else {
- console.log("number of sockets", sockets.length);
- }
+ // const sockets = await io.fetchSockets();
+ // if (inactivityTimeout) {
+ // clearTimeout(inactivityTimeout);
+ // }
+ // if (sockets.length === 0) {
+ // console.log("STARTING TIMER");
+ // inactivityTimeout = setTimeout(() => {
+ // io.fetchSockets().then(async (sockets) => {
+ // if (sockets.length === 0) {
+ // console.log("Server stopped", res);
+ // }
+ // });
+ // }, 20000);
+ // } else {
+ // console.log("number of sockets", sockets.length);
+ // }
});
});
diff --git a/frontend/app/(app)/code/[id]/page.tsx b/frontend/app/(app)/code/[id]/page.tsx
index f9e2a30..41d51b7 100644
--- a/frontend/app/(app)/code/[id]/page.tsx
+++ b/frontend/app/(app)/code/[id]/page.tsx
@@ -67,8 +67,6 @@ export default async function CodePage({ params }: { params: { id: string } }) {
return notFound()
}
- console.log("sandboxes: ", sandboxData)
-
return (
diff --git a/frontend/app/globals.css b/frontend/app/globals.css
index e641278..762a30d 100644
--- a/frontend/app/globals.css
+++ b/frontend/app/globals.css
@@ -102,10 +102,6 @@
.inline-decoration::before {
content: "Generate";
color: #525252;
- /* border: 1px solid #525252; */
- /* padding: 2px 4px; */
- /* border-radius: 4px; */
- margin-left: 36px;
}
.inline-decoration::after {
content: "⌘G";
diff --git a/frontend/components/editor/index.tsx b/frontend/components/editor/index.tsx
index 01b13a0..0e4be9d 100644
--- a/frontend/components/editor/index.tsx
+++ b/frontend/components/editor/index.tsx
@@ -11,7 +11,7 @@ import * as Y from "yjs"
import LiveblocksProvider from "@liveblocks/yjs"
import { MonacoBinding } from "y-monaco"
import { Awareness } from "y-protocols/awareness"
-import { TypedLiveblocksProvider, useRoom } from "@/liveblocks.config"
+import { TypedLiveblocksProvider, useRoom, useSelf } from "@/liveblocks.config"
import {
ResizableHandle,
@@ -94,6 +94,7 @@ export default function CodeEditor({
// Liveblocks hooks
const room = useRoom()
const [provider, setProvider] = useState()
+ const userInfo = useSelf((me) => me.info)
// Refs for libraries / features
const editorContainerRef = useRef(null)
@@ -263,6 +264,14 @@ export default function CodeEditor({
if (!ai) return
+ const model = editorRef?.getModel()
+ const line = model?.getLineContent(cursorLine)
+
+ if (line === undefined || line.trim() !== "") {
+ decorations.instance?.clear()
+ return
+ }
+
if (decorations.instance) {
decorations.instance.set(decorations.options)
} else {
@@ -663,7 +672,9 @@ export default function CodeEditor({
) : // Note clerk.loaded is required here due to a bug: https://github.com/clerk/javascript/issues/1643
clerk.loaded ? (
<>
- {provider ? : null}
+ {provider && userInfo ? (
+
+ ) : null}
me.info)
-
- if (!userInfo) return null
const [awarenessUsers, setAwarenessUsers] = useState([])
diff --git a/frontend/components/editor/loading/index.tsx b/frontend/components/editor/loading/index.tsx
index 9d13cd5..2de37be 100644
--- a/frontend/components/editor/loading/index.tsx
+++ b/frontend/components/editor/loading/index.tsx
@@ -1,15 +1,17 @@
-import Image from "next/image";
-import Logo from "@/assets/logo.svg";
-import { Skeleton } from "@/components/ui/skeleton";
-import { Loader2, X } from "lucide-react";
+"use client"
+
+import Image from "next/image"
+import Logo from "@/assets/logo.svg"
+import { Skeleton } from "@/components/ui/skeleton"
+import { Loader2, X } from "lucide-react"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
-} from "@/components/ui/dialog";
-import { useEffect, useState } from "react";
+} from "@/components/ui/dialog"
+import { useEffect, useState } from "react"
export default function Loading({
didFail = false,
@@ -17,18 +19,18 @@ export default function Loading({
text = "",
description = "",
}: {
- didFail?: boolean;
- withNav?: boolean;
- text?: string;
- description?: string;
+ didFail?: boolean
+ withNav?: boolean
+ text?: string
+ description?: string
}) {
- const [open, setOpen] = useState(false);
+ const [open, setOpen] = useState(false)
useEffect(() => {
if (text) {
- setOpen(true);
+ setOpen(true)
}
- }, [text]);
+ }, [text])
return (
@@ -98,5 +100,5 @@ export default function Loading({
- );
+ )
}