Fix ESLint warnings and and enable max warnings 0 to fail builds (#2101)

This commit is contained in:
Zane
2025-04-09 15:13:53 -07:00
committed by GitHub
parent 0daff53110
commit 8451fb1c89
69 changed files with 968 additions and 685 deletions
+30 -24
View File
@@ -4,7 +4,7 @@ import BottomMenu from './BottomMenu';
import FlappyGoose from './FlappyGoose';
import GooseMessage from './GooseMessage';
import Input from './Input';
import { type View } from '../App';
import { type View, ViewOptions } from '../App';
import LoadingGoose from './LoadingGoose';
import MoreMenuLayout from './more_menu/MoreMenuLayout';
import { Card } from './ui/card';
@@ -22,11 +22,9 @@ import {
ToolCall,
ToolCallResult,
ToolRequestMessageContent,
ToolResponse,
ToolResponseMessageContent,
ToolConfirmationRequestMessageContent,
getTextContent,
createAssistantMessage,
} from '../types/message';
export interface ChatType {
@@ -38,6 +36,26 @@ export interface ChatType {
messages: Message[];
}
interface GeneratedBotConfig {
id: string;
name: string;
description: string;
instructions: string;
activities: string[];
}
// Helper function to determine if a message is a user message
const isUserMessage = (message: Message): boolean => {
if (message.role === 'assistant') {
return false;
}
if (message.content.every((c) => c.type === 'toolConfirmationRequest')) {
return false;
}
return true;
};
export default function ChatView({
chat,
setChat,
@@ -46,16 +64,17 @@ export default function ChatView({
}: {
chat: ChatType;
setChat: (chat: ChatType) => void;
setView: (view: View, viewOptions?: Record<any, any>) => void;
setView: (view: View, viewOptions?: ViewOptions) => void;
setIsGoosehintsModalOpen: (isOpen: boolean) => void;
}) {
const [messageMetadata, setMessageMetadata] = useState<Record<string, string[]>>({});
// Disabled askAi calls to save costs
// const [messageMetadata, setMessageMetadata] = useState<Record<string, string[]>>({});
const [hasMessages, setHasMessages] = useState(false);
const [lastInteractionTime, setLastInteractionTime] = useState<number>(Date.now());
const [showGame, setShowGame] = useState(false);
const [waitingForAgentResponse, setWaitingForAgentResponse] = useState(false);
const [showShareableBotModal, setshowShareableBotModal] = useState(false);
const [generatedBotConfig, setGeneratedBotConfig] = useState<any>(null);
const [generatedBotConfig, setGeneratedBotConfig] = useState<GeneratedBotConfig | null>(null);
const scrollRef = useRef<ScrollAreaHandle>(null);
// Get botConfig directly from appConfig
@@ -76,7 +95,7 @@ export default function ChatView({
api: getApiUrl('/reply'),
initialMessages: chat.messages,
body: { session_id: chat.id, session_working_dir: window.appConfig.get('GOOSE_WORKING_DIR') },
onFinish: async (message, _reason) => {
onFinish: async (_message, _reason) => {
window.electron.stopPowerSaveBlocker();
// Disabled askAi calls to save costs
@@ -94,7 +113,7 @@ export default function ChatView({
});
}
},
onToolCall: (toolCall) => {
onToolCall: (toolCall: string) => {
// Handle tool calls if needed
console.log('Tool call received:', toolCall);
// Implement tool call handling logic here
@@ -213,7 +232,7 @@ export default function ChatView({
const updatedChat = { ...prevChat, messages };
return updatedChat;
});
}, [messages]);
}, [messages, setChat]);
useEffect(() => {
if (messages.length > 0) {
@@ -304,8 +323,6 @@ export default function ChatView({
content: [],
};
// get the last tool's name or just "tool"
const lastToolName = toolRequests.at(-1)?.[1].value?.name ?? 'tool';
const notification = 'Interrupted by the user to make a correction';
// generate a response saying it was interrupted for each tool request
@@ -349,17 +366,6 @@ export default function ChatView({
return true;
});
const isUserMessage = (message: Message) => {
if (message.role === 'assistant') {
return false;
}
if (message.content.every((c) => c.type === 'toolConfirmationRequest')) {
return false;
}
return true;
};
const commandHistory = useMemo(() => {
return filteredMessages
.reduce<string[]>((history, message) => {
@@ -372,7 +378,7 @@ export default function ChatView({
return history;
}, [])
.reverse();
}, [filteredMessages, isUserMessage]);
}, [filteredMessages]);
return (
<div className="flex flex-col w-full h-screen items-center justify-center">
@@ -398,7 +404,7 @@ export default function ChatView({
messageHistoryIndex={chat?.messageHistoryIndex}
message={message}
messages={messages}
metadata={messageMetadata[message.id || '']}
// metadata={messageMetadata[message.id || '']}
append={(text) => append(createUserMessage(text))}
appendMessage={(newMessage) => {
const updatedMessages = [...messages, newMessage];