Skip to content

Commit e193e27

Browse files
committed
feat: integrate evaluation view into plugin
Add EVALUATION ViewType to pluginTypes. Add Evaluation navigation link to PluginHeader. Wire up evaluation view routing in BrainDriveChatWithDocs, passing collections prop. Add handleNavigateToEvaluation to PluginService.
1 parent 9d1a089 commit e193e27

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

src/BrainDriveChatWithDocs.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Loader2, AlertCircle } from 'lucide-react';
44
// import { ChatMessagesProvider } from './collection-chat-view/context/chat-messages-provider';
55
import { CollectionViewShell } from './collection-view/CollectionViewShell';
66
import { CollectionChatViewShell } from './collection-chat-view/CollectionChatViewShell';
7+
import { EvaluationViewShell } from './evaluation-view/EvaluationViewShell';
78
import {
89
ErrorAlert,
910
ServiceWarningBanner,
@@ -186,6 +187,13 @@ class BrainDriveChatWithDocs extends React.Component<ChatCollectionsPluginProps,
186187
{currentView === ViewType.SETTINGS && (
187188
<ChatCollectionsSettings services={services} />
188189
)}
190+
{currentView === ViewType.EVALUATION && (
191+
<EvaluationViewShell
192+
services={services}
193+
setError={this.pluginService.setError}
194+
collections={this.state.collections}
195+
/>
196+
)}
189197
</div>
190198
</ContentOverlay>
191199
</div>

src/braindrive-plugin/PluginHeader.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { ArrowLeft, Settings } from 'lucide-react';
2+
import { ArrowLeft, Settings, FlaskConical } from 'lucide-react';
33

44
import { type PluginHeaderProps, ViewType } from './pluginTypes';
55
import { ServiceStatusIndicator } from '../components';
@@ -43,6 +43,7 @@ export const PluginHeader: React.FC<PluginHeaderProps> = ({
4343
{currentView === ViewType.DOCUMENTS && `Documents - ${collectionName}`}
4444
{currentView === ViewType.CHAT && `Chat with ${collectionName} collection`}
4545
{currentView === ViewType.SETTINGS && 'Plugin Settings'}
46+
{currentView === ViewType.EVALUATION && 'Chat with Docs System Evaluation'}
4647
</h1>
4748
</div>
4849

@@ -55,6 +56,16 @@ export const PluginHeader: React.FC<PluginHeaderProps> = ({
5556
onRefresh={checkAllServices}
5657
/>
5758

59+
{currentView !== ViewType.EVALUATION && (
60+
<button
61+
onClick={() => handleViewChange(ViewType.EVALUATION)}
62+
className="p-2 rounded-full hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800"
63+
title="Evaluation"
64+
disabled={!areServicesReady}
65+
>
66+
<FlaskConical className="w-5 h-5" />
67+
</button>
68+
)}
5869
{currentView !== ViewType.SETTINGS && (
5970
<button
6071
onClick={() => handleViewChange(ViewType.SETTINGS)}

src/braindrive-plugin/PluginService.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ export class PluginService implements IPluginService {
237237
// --- Public View Controllers (Event Handlers) ---
238238

239239
public handleViewChange = (view: ViewType): void => {
240+
console.log("handleViewChange: ", view);
240241
this.updateState({ currentView: view, error: null });
241242
}
242243

@@ -261,15 +262,17 @@ export class PluginService implements IPluginService {
261262
public handleBack = (): void => {
262263
const { currentView } = this.state;
263264
let newState: Partial<PluginState> = {};
264-
265+
265266
if (currentView === ViewType.CHAT) {
266267
newState = { currentView: ViewType.COLLECTIONS, selectedChatSession: null, chatMessages: [] };
267268
} else if (currentView === ViewType.DOCUMENTS) {
268269
newState = { currentView: ViewType.COLLECTIONS, selectedCollection: null, documents: [], chatSessions: [] };
269270
} else if (currentView === ViewType.SETTINGS) {
270271
newState = { currentView: ViewType.COLLECTIONS };
272+
} else if (currentView === ViewType.EVALUATION) {
273+
newState = { currentView: ViewType.COLLECTIONS };
271274
}
272-
275+
273276
this.updateState(newState);
274277
}
275278

src/braindrive-plugin/pluginTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export enum ViewType {
1313
COLLECTIONS = 'collections',
1414
DOCUMENTS = 'documents',
1515
CHAT = 'chat',
16-
SETTINGS = 'settings'
16+
SETTINGS = 'settings',
17+
EVALUATION = 'evaluation'
1718
}
1819

1920
export interface Collection {

0 commit comments

Comments
 (0)