Skip to content

Commit 4dbd00e

Browse files
committed
minor
1 parent e262cbb commit 4dbd00e

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

frontend/app/aipanel/aipanel.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { checkKeyPressed, keydownWrapper } from "@/util/keyutil";
88
import { cn } from "@/util/util";
99
import { useChat } from "@ai-sdk/react";
1010
import { DefaultChatTransport } from "ai";
11-
import { useAtomValue } from "jotai";
1211
import { memo, useEffect, useRef, useState } from "react";
1312
import { createDataUrl, isAcceptableFile, normalizeMimeType } from "./ai-utils";
1413
import { AIDroppedFiles } from "./aidroppedfiles";
@@ -27,7 +26,6 @@ const AIPanelComponent = memo(({ className, onClose }: AIPanelProps) => {
2726
const [isDragOver, setIsDragOver] = useState(false);
2827
const modelRef = useRef(new WaveAIModel());
2928
const model = modelRef.current;
30-
const chatId = useAtomValue(model.chatId);
3129
const realMessageRef = useRef<AIMessage>(null);
3230
const inputRef = useRef<AIPanelInputRef>(null);
3331

frontend/app/workspace/workspace-layout-model.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import { isDev } from "@/store/global";
55
import { ImperativePanelGroupHandle, ImperativePanelHandle } from "react-resizable-panels";
66

7-
const AI_PANEL_DEFAULT_WIDTH = 300;
8-
const AI_PANEL_MIN_WIDTH = 250;
7+
const AIPANEL_DEFAULTWIDTH = 300;
8+
const AIPANEL_MINWIDTH = 250;
9+
const AIPANEL_MAXWIDTHRATIO = 0.5;
910

1011
class WorkspaceLayoutModel {
1112
aiPanelVisible: boolean;
@@ -18,7 +19,7 @@ class WorkspaceLayoutModel {
1819
this.aiPanelVisible = isDev();
1920
this.aiPanelRef = null;
2021
this.panelGroupRef = null;
21-
this.aiPanelWidth = AI_PANEL_DEFAULT_WIDTH;
22+
this.aiPanelWidth = AIPANEL_DEFAULTWIDTH;
2223
this.inResize = false;
2324
}
2425

@@ -50,15 +51,15 @@ class WorkspaceLayoutModel {
5051
}
5152

5253
getMaxAIPanelWidth(windowWidth: number): number {
53-
return Math.floor(windowWidth * 0.5);
54+
return Math.floor(windowWidth * AIPANEL_MAXWIDTHRATIO);
5455
}
5556

5657
getClampedAIPanelWidth(width: number, windowWidth: number): number {
5758
const maxWidth = this.getMaxAIPanelWidth(windowWidth);
58-
if (AI_PANEL_MIN_WIDTH > maxWidth) {
59-
return AI_PANEL_MIN_WIDTH;
59+
if (AIPANEL_MINWIDTH > maxWidth) {
60+
return AIPANEL_MINWIDTH;
6061
}
61-
return Math.max(AI_PANEL_MIN_WIDTH, Math.min(width, maxWidth));
62+
return Math.max(AIPANEL_MINWIDTH, Math.min(width, maxWidth));
6263
}
6364

6465
getAIPanelVisible(): boolean {
@@ -115,4 +116,4 @@ class WorkspaceLayoutModel {
115116

116117
const workspaceLayoutModel = new WorkspaceLayoutModel();
117118

118-
export { AI_PANEL_DEFAULT_WIDTH, AI_PANEL_MIN_WIDTH, workspaceLayoutModel, WorkspaceLayoutModel };
119+
export { workspaceLayoutModel, WorkspaceLayoutModel };

0 commit comments

Comments
 (0)