eslint fix

This commit is contained in:
Edwin Jose 2025-09-08 10:35:33 -04:00
parent 8c142f89b7
commit 5172cf9069
7 changed files with 58 additions and 44 deletions

View file

@ -127,7 +127,6 @@ function ChatPage() {
const [dropdownDismissed, setDropdownDismissed] = useState(false);
const [isUserInteracting, setIsUserInteracting] = useState(false);
const [isForkingInProgress, setIsForkingInProgress] = useState(false);
const [lastForkTimestamp, setLastForkTimestamp] = useState<number>(0);
const dragCounterRef = useRef(0);
const messagesEndRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLTextAreaElement>(null);
@ -454,8 +453,15 @@ function ChatPage() {
content: string;
timestamp?: string;
response_id?: string;
chunks?: any[];
response_data?: any;
chunks?: Array<{
item?: { type?: string; tool_name?: string; id?: string; inputs?: unknown; results?: unknown; status?: string };
delta?: { tool_calls?: Array<{ id?: string; function?: { name?: string; arguments?: string }; type?: string }> };
type?: string;
result?: unknown;
output?: unknown;
response?: unknown;
}>;
response_data?: unknown;
}) => {
const message: Message = {
role: msg.role as "user" | "assistant",
@ -480,12 +486,12 @@ function ChatPage() {
const toolCall = chunk.item;
console.log("Found Langflow tool call:", toolCall);
functionCalls.push({
id: toolCall.id,
name: toolCall.tool_name,
arguments: toolCall.inputs || {},
id: toolCall.id || "",
name: toolCall.tool_name || "unknown",
arguments: (toolCall.inputs as Record<string, unknown>) || {},
argumentsString: JSON.stringify(toolCall.inputs || {}),
result: toolCall.results,
status: toolCall.status || "completed",
result: toolCall.results as Record<string, unknown> | ToolCallResult[],
status: (toolCall.status as "pending" | "completed" | "error") || "completed",
type: "tool_call",
});
}
@ -494,10 +500,10 @@ function ChatPage() {
for (const toolCall of chunk.delta.tool_calls) {
if (toolCall.function) {
functionCalls.push({
id: toolCall.id,
name: toolCall.function.name,
id: toolCall.id || "",
name: toolCall.function.name || "unknown",
arguments: toolCall.function.arguments ? JSON.parse(toolCall.function.arguments) : {},
argumentsString: toolCall.function.arguments,
argumentsString: toolCall.function.arguments || "",
status: "completed",
type: toolCall.type || "function",
});
@ -508,7 +514,7 @@ function ChatPage() {
if (chunk.type === "response.tool_call.result" || chunk.type === "tool_call_result") {
const lastCall = functionCalls[functionCalls.length - 1];
if (lastCall) {
lastCall.result = chunk.result || chunk;
lastCall.result = (chunk.result as Record<string, unknown> | ToolCallResult[]) || (chunk as Record<string, unknown>);
lastCall.status = "completed";
}
}
@ -562,6 +568,7 @@ function ChatPage() {
conversationData,
isUserInteracting,
isForkingInProgress,
setPreviousResponseIds,
]);
// Handle new conversation creation - only reset messages when placeholderConversation is set
@ -1536,10 +1543,8 @@ function ChatPage() {
}
// Set interaction state to prevent auto-scroll interference
const forkTimestamp = Date.now();
setIsUserInteracting(true);
setIsForkingInProgress(true);
setLastForkTimestamp(forkTimestamp);
console.log("Fork conversation called for message index:", messageIndex);
@ -1552,7 +1557,6 @@ function ChatPage() {
console.error("Fork button should only be on assistant messages");
setIsUserInteracting(false);
setIsForkingInProgress(false);
setLastForkTimestamp(0);
return;
}

View file

@ -16,7 +16,14 @@ export default function ConnectorsPage() {
const { addTask } = useTask()
const [selectedFiles, setSelectedFiles] = useState<GoogleDriveFile[]>([]);
const [isSyncing, setIsSyncing] = useState<boolean>(false);
const [syncResult, setSyncResult] = useState<any>(null);
const [syncResult, setSyncResult] = useState<{
processed?: number;
total?: number;
status?: string;
error?: string;
added?: number;
errors?: number;
} | null>(null);
const handleFileSelection = (files: GoogleDriveFile[]) => {
setSelectedFiles(files);

View file

@ -29,7 +29,7 @@ interface OneDriveFile {
webUrl?: string
driveItem?: {
file?: { mimeType: string }
folder?: any
folder?: unknown
}
}

View file

@ -24,7 +24,7 @@ interface OneDriveFile {
webUrl?: string
driveItem?: {
file?: { mimeType: string }
folder?: object
folder?: unknown
}
}
@ -157,6 +157,14 @@ export default function UploadProviderPage() {
// You can add additional handling here like triggering sync, etc.
}
const handleGoogleDriveFileSelected = (files: GoogleDriveFile[]) => {
handleFileSelected(files)
}
const handleOneDriveFileSelected = (files: OneDriveFile[]) => {
handleFileSelected(files)
}
const handleSync = async (connector: CloudConnector) => {
if (!connector.connectionId || selectedFiles.length === 0) return
@ -323,7 +331,7 @@ export default function UploadProviderPage() {
<div className="max-w-3xl mx-auto">
{connector.type === "google_drive" && (
<GoogleDrivePicker
onFileSelected={handleFileSelected}
onFileSelected={handleGoogleDriveFileSelected}
selectedFiles={selectedFiles as GoogleDriveFile[]}
isAuthenticated={true}
accessToken={accessToken || undefined}
@ -332,7 +340,7 @@ export default function UploadProviderPage() {
{(connector.type === "onedrive" || connector.type === "sharepoint") && (
<OneDrivePicker
onFileSelected={handleFileSelected}
onFileSelected={handleOneDriveFileSelected}
selectedFiles={selectedFiles as OneDriveFile[]}
isAuthenticated={true}
accessToken={accessToken || undefined}

View file

@ -2,7 +2,6 @@
import { useState, useEffect, useCallback } from "react"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
import {
Dialog,
DialogContent,
@ -29,7 +28,7 @@ interface OneDriveFile {
webUrl?: string
driveItem?: {
file?: { mimeType: string }
folder?: any
folder?: unknown
}
}
@ -61,7 +60,6 @@ export function CloudConnectorsDialog({
const [selectedFiles, setSelectedFiles] = useState<{[connectorId: string]: GoogleDriveFile[] | OneDriveFile[]}>({})
const [connectorAccessTokens, setConnectorAccessTokens] = useState<{[connectorType: string]: string}>({})
const [activePickerType, setActivePickerType] = useState<string | null>(null)
const [isGooglePickerOpen, setIsGooglePickerOpen] = useState(false)
const getConnectorIcon = (iconName: string) => {
const iconMap: { [key: string]: React.ReactElement } = {
@ -129,7 +127,7 @@ export function CloudConnectorsDialog({
if (response.ok) {
const data = await response.json()
const connections = data.connections || []
const activeConnection = connections.find((conn: any) => conn.is_active)
const activeConnection = connections.find((conn: { connection_id: string; is_active: boolean }) => conn.is_active)
const isConnected = activeConnection !== undefined
let hasAccessToken = false
@ -152,7 +150,7 @@ export function CloudConnectorsDialog({
const errorData = await tokenResponse.json().catch(() => ({ error: 'Token unavailable' }))
accessTokenError = errorData.error || 'Access token unavailable'
}
} catch (e) {
} catch {
accessTokenError = 'Failed to fetch access token'
}
}
@ -260,12 +258,11 @@ export function CloudConnectorsDialog({
onFileSelected={(files) => {
handleFileSelection(connector.id, files)
setActivePickerType(null)
setIsGooglePickerOpen(false)
}}
selectedFiles={selectedFiles[connector.id] as GoogleDriveFile[] || []}
isAuthenticated={connector.status === "connected"}
accessToken={connectorAccessTokens[connector.type]}
onPickerStateChange={setIsGooglePickerOpen}
onPickerStateChange={() => {}}
/>
</div>
)

View file

@ -26,7 +26,7 @@ interface OneDriveFile {
webUrl?: string
driveItem?: {
file?: { mimeType: string }
folder?: any
folder?: unknown
}
}

View file

@ -21,7 +21,7 @@ interface OneDriveFile {
webUrl?: string
driveItem?: {
file?: { mimeType: string }
folder?: any
folder?: unknown
}
}
@ -32,8 +32,8 @@ interface GraphResponse {
declare global {
interface Window {
mgt?: {
Providers: {
globalProvider: any
Providers?: {
globalProvider?: unknown
}
}
}
@ -58,21 +58,19 @@ export function OneDrivePicker({
])
useEffect(() => {
const loadMGT = async () => {
if (typeof window !== 'undefined' && !window.mgt) {
try {
const mgtModule = await import('@microsoft/mgt-components')
const mgtProvider = await import('@microsoft/mgt-msal2-provider')
// Initialize provider if needed
if (!window.mgt?.Providers?.globalProvider && accessToken) {
// For simplicity, we'll use direct Graph API calls instead of MGT components
}
} catch (error) {
console.warn('MGT not available, falling back to direct API calls')
}
const loadMGT = async () => {
if (typeof window !== 'undefined' && !window.mgt) {
try {
await import('@microsoft/mgt-components')
await import('@microsoft/mgt-msal2-provider')
// For simplicity, we'll use direct Graph API calls instead of MGT components
// MGT provider initialization would go here if needed
} catch {
console.warn('MGT not available, falling back to direct API calls')
}
}
}
loadMGT()
}, [accessToken])