mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-20 04:28:09 -05:00
fix lint errors
This commit is contained in:
@@ -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 && (
|
||||
|
||||
@@ -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)}`
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
|
||||
@@ -747,6 +747,9 @@ export default function useAgentGraph(
|
||||
api,
|
||||
nodes,
|
||||
edges,
|
||||
pathname,
|
||||
router,
|
||||
searchParams,
|
||||
savedAgent,
|
||||
agentName,
|
||||
agentDescription,
|
||||
|
||||
Reference in New Issue
Block a user