Skip to content

Commit 219ff3f

Browse files
Copilothotlong
andcommitted
refactor(console): improve typing in ConsoleFloatingChatbot, remove any casts
Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/e0efdafc-aeb8-4dcc-859c-f5d6d07a2879 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 2fd36d6 commit 219ff3f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

apps/console/src/components/ConsoleLayout.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99

1010
import React from 'react';
1111
import { AppShell } from '@object-ui/layout';
12-
import { FloatingChatbot, useObjectChat } from '@object-ui/plugin-chatbot';
12+
import { FloatingChatbot, useObjectChat, type ChatMessage } from '@object-ui/plugin-chatbot';
1313
import { AppSidebar } from './AppSidebar';
1414
import { AppHeader } from './AppHeader';
1515
import { useResponsiveSidebar } from '../hooks/useResponsiveSidebar';
1616
import { resolveI18nLabel } from '../utils';
1717
import type { ConnectionState } from '../dataSource';
1818

19+
/** Minimal object shape used by the chatbot context */
20+
interface ConsoleObject {
21+
name: string;
22+
label?: string;
23+
}
24+
1925
interface ConsoleLayoutProps {
2026
children: React.ReactNode;
2127
activeAppName: string;
@@ -32,8 +38,8 @@ function ConsoleLayoutInner({ children }: { children: React.ReactNode }) {
3238
}
3339

3440
/** Floating chatbot wired with useObjectChat for demo auto-response */
35-
function ConsoleFloatingChatbot({ appLabel, objects }: { appLabel: string; objects: any[] }) {
36-
const objectNames = objects.map((o: any) => o.label || o.name).join(', ');
41+
function ConsoleFloatingChatbot({ appLabel, objects }: { appLabel: string; objects: ConsoleObject[] }) {
42+
const objectNames = objects.map((o) => o.label || o.name).join(', ');
3743

3844
const {
3945
messages,
@@ -68,7 +74,7 @@ function ConsoleFloatingChatbot({ appLabel, objects }: { appLabel: string; objec
6874
title: `${appLabel} Assistant`,
6975
triggerSize: 56,
7076
}}
71-
messages={messages as any}
77+
messages={messages as ChatMessage[]}
7278
placeholder="Ask anything..."
7379
onSendMessage={(content: string) => sendMessage(content)}
7480
onClear={clear}

0 commit comments

Comments
 (0)