ui fix linting

This commit is contained in:
Ishaan Jaffer 2025-11-07 18:20:31 -08:00
parent 736b6b3e1e
commit 4dcbfbbb89
3 changed files with 17 additions and 14 deletions

View file

@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useCallback } from "react";
import { Button, Accordion, AccordionHeader, AccordionBody } from "@tremor/react";
import {
getCacheSettingsCall,
@ -24,14 +24,7 @@ const CacheSettings: React.FC<CacheSettingsProps> = ({ accessToken, userRole, us
const [isTesting, setIsTesting] = useState<boolean>(false);
const [isSaving, setIsSaving] = useState<boolean>(false);
useEffect(() => {
if (!accessToken) {
return;
}
loadCacheSettings();
}, [accessToken]);
const loadCacheSettings = async () => {
const loadCacheSettings = useCallback(async () => {
try {
const data = await getCacheSettingsCall(accessToken!);
console.log("cache settings from API", data);
@ -56,7 +49,14 @@ const CacheSettings: React.FC<CacheSettingsProps> = ({ accessToken, userRole, us
console.error("Failed to load cache settings:", error);
NotificationsManager.fromBackend("Failed to load cache settings");
}
};
}, [accessToken]);
useEffect(() => {
if (!accessToken) {
return;
}
loadCacheSettings();
}, [accessToken, loadCacheSettings]);
const handleTestConnection = async () => {
if (!accessToken) {

View file

@ -1,4 +1,5 @@
import React from "react";
import Image from "next/image";
import { MessageType } from "./types";
import { shouldShowChatAttachedImage } from "./ChatImageUtils";
import { FilePdfOutlined } from "@ant-design/icons";
@ -21,11 +22,13 @@ const ChatImageRenderer: React.FC<ChatImageRendererProps> = ({ message }) => {
<FilePdfOutlined style={{ fontSize: "48px", color: "#dc2626" }} />
</div>
) : (
<img
src={message.imagePreviewUrl}
<Image
src={message.imagePreviewUrl || ""}
alt="User uploaded image"
width={256}
height={200}
className="max-w-64 rounded-md border border-gray-200 shadow-sm"
style={{ maxHeight: "200px" }}
style={{ maxHeight: "200px", width: "auto", height: "auto" }}
/>
)}
</div>

View file

@ -1,4 +1,4 @@
import { fireEvent, getByText, render, screen, waitFor } from "@testing-library/react";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import ChatUI from "./ChatUI";
import * as fetchModelsModule from "./llm_calls/fetch_models";