fix lint errors

This commit is contained in:
Zamil Majdy
2024-09-30 10:41:31 +02:00
parent bb24883651
commit 4e3df63dcd
4 changed files with 24 additions and 17 deletions

View File

@@ -1,21 +1,23 @@
"use client";
import { useState, useEffect } from "react";
import { useState, useEffect, useCallback } from "react";
import { Button } from "@/components/ui/button";
import { IconRefresh, IconCoin } from "@/components/ui/icons";
import { IconRefresh } from "@/components/ui/icons";
import AutoGPTServerAPI from "@/lib/autogpt-server-api";
const api = new AutoGPTServerAPI();
export default function CreditButton() {
const [credit, setCredit] = useState<number | null>(null);
const api = new AutoGPTServerAPI();
const fetchCredit = async () => {
const fetchCredit = useCallback(async () => {
const response = await api.getUserCredit();
setCredit(response.credits);
};
}, []);
useEffect(() => {
fetchCredit();
}, [api]);
}, [fetchCredit]);
return (
credit !== null && (

View File

@@ -312,7 +312,7 @@ const NodeCredentialsInput: FC<{
);
};
const getInputRef = (value: any): React.RefObject<HTMLInputElement> => {
const InputRef = (value: any): React.RefObject<HTMLInputElement> => {
const inputRef = React.useRef<HTMLInputElement>(null);
if (inputRef.current && value && inputRef.current.value !== value) {
inputRef.current.value = value;
@@ -423,7 +423,7 @@ const NodeKeyValueInput: FC<{
<Input
type="text"
placeholder="Value"
ref={getInputRef(value ?? "")}
ref={InputRef(value ?? "")}
onBlur={(e) =>
updateKeyValuePairs(
keyValuePairs.toSpliced(index, 1, {
@@ -607,7 +607,7 @@ const NodeStringInput: FC<{
<Input
type="text"
id={selfKey}
ref={getInputRef(
ref={InputRef(
schema.secret && value ? "*".repeat(value.length) : value,
)}
readOnly={schema.secret}
@@ -704,7 +704,7 @@ const NodeNumberInput: FC<{
<Input
type="number"
id={selfKey}
ref={getInputRef(value)}
ref={InputRef(value)}
onBlur={(e) => handleInputChange(selfKey, parseFloat(e.target.value))}
placeholder={
schema.placeholder || `Enter ${beautifyString(displayName)}`

View File

@@ -45,13 +45,15 @@ const VideoRenderer: React.FC<{ videoUrl: string }> = ({ videoUrl }) => {
const ImageRenderer: React.FC<{ imageUrl: string }> = ({ imageUrl }) => (
<div className="w-full p-2">
<img
src={imageUrl}
alt="Image"
className="h-auto max-w-full"
width="100%"
height="auto"
/>
<picture>
<img
src={imageUrl}
alt="Image"
className="h-auto max-w-full"
width="100%"
height="auto"
/>
</picture>
</div>
);

View File

@@ -747,6 +747,9 @@ export default function useAgentGraph(
api,
nodes,
edges,
pathname,
router,
searchParams,
savedAgent,
agentName,
agentDescription,