Skip to content

Commit

Permalink
Fix more types
Browse files Browse the repository at this point in the history
  • Loading branch information
sphilipse committed Sep 16, 2024
1 parent 6a0d288 commit d6599c9
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ export function createService({
},
predefinedConversation$: predefinedConversation$.asObservable(),
},
scope,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export interface ObservabilityAIAssistantChatService {
name: string,
args: string | undefined,
response: { data?: string; content?: string },
onActionClick: ChatActionClickHandler
onActionClick: ChatActionClickHandler,
scope?: AssistantScope
) => React.ReactNode;
}

Expand All @@ -101,6 +102,7 @@ export interface ObservabilityAIAssistantService {
getScreenContexts: () => ObservabilityAIAssistantScreenContext[];
conversations: ObservabilityAIAssistantConversationService;
navigate: (callback: () => void) => Promise<Observable<MessageAddEvent>>;
scope: AssistantScope;
}

export type RenderFunction<TArguments, TResponse extends FunctionResponse> = (options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export function ChatBody({
showLinkToConversationsApp,
onConversationUpdate,
onToggleFlyoutPositionMode,
scope,
}: {
connectors: ReturnType<typeof useGenAIConnectors>;
currentUser?: Pick<AuthenticatedUser, 'full_name' | 'username'>;
Expand All @@ -122,7 +121,6 @@ export function ChatBody({
showLinkToConversationsApp: boolean;
onConversationUpdate: (conversation: { conversation: Conversation['conversation'] }) => void;
onToggleFlyoutPositionMode?: (flyoutPositionMode: FlyoutPositionMode) => void;
scope: AssistantScope;
}) {
const license = useLicense();
const hasCorrectLicense = license?.hasAtLeast('enterprise');
Expand All @@ -140,7 +138,6 @@ export function ChatBody({
chatService,
connectorId: connectors.selectedConnector,
onConversationUpdate,
scope,
});

const timelineContainerRef = useRef<HTMLDivElement | null>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export function ChatFlyout({
conversationList.conversations.refresh();
}}
onToggleFlyoutPositionMode={handleToggleFlyoutPositionMode}
scope={scope}
/>
</EuiFlexItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const mockService: MockedService = {
predefinedConversation$: new Observable(),
},
navigate: jest.fn().mockReturnValue(of()),
scope: 'all',
};

const mockChatService = createMockChatService();
Expand Down Expand Up @@ -107,7 +108,6 @@ describe('useConversation', () => {
},
],
initialConversationId: 'foo',
scope: 'all',
},
wrapper,
});
Expand All @@ -125,7 +125,6 @@ describe('useConversation', () => {
connectorId: 'my-connector',
},
wrapper,
scope: 'all',
});
});

Expand Down Expand Up @@ -165,7 +164,6 @@ describe('useConversation', () => {
},
},
],
scope: 'all',
},
wrapper,
});
Expand Down Expand Up @@ -220,7 +218,6 @@ describe('useConversation', () => {
chatService: mockChatService,
connectorId: 'my-connector',
initialConversationId: 'my-conversation-id',
scope: 'all',
},
wrapper,
});
Expand Down Expand Up @@ -285,7 +282,6 @@ describe('useConversation', () => {
chatService: mockChatService,
connectorId: 'my-connector',
initialConversationId: 'my-conversation-id',
scope: 'all',
},
wrapper,
});
Expand Down Expand Up @@ -378,7 +374,6 @@ describe('useConversation', () => {
},
],
onConversationUpdate,
scope: 'all',
},
wrapper,
});
Expand Down Expand Up @@ -458,7 +453,6 @@ describe('useConversation', () => {
initialConversationId: 'foo',
},
wrapper,
scope: 'all',
});
});

Expand Down Expand Up @@ -497,7 +491,6 @@ describe('useConversation', () => {
chatService: mockChatService,
connectorId: 'my-connector',
initialConversationId: 'my-conversation-id',
scope: 'all',
},
wrapper,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export interface UseConversationProps {
chatService: ObservabilityAIAssistantChatService;
connectorId: string | undefined;
onConversationUpdate?: (conversation: { conversation: Conversation['conversation'] }) => void;
scope: AssistantScope;
}

export type UseConversationResult = {
Expand All @@ -62,9 +61,9 @@ export function useConversation({
chatService,
connectorId,
onConversationUpdate,
scope,
}: UseConversationProps): UseConversationResult {
const service = useObservabilityAIAssistantAppService();
const { scope } = service;

const {
services: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export function ConversationView() {
knowledgeBase={knowledgeBase}
showLinkToConversationsApp={false}
onConversationUpdate={handleConversationUpdate}
scope={scope}
/>

<div className={sidebarContainerClass}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function runEvaluations() {
evaluationConnectorId: evaluationConnector.id!,
persist: argv.persist,
suite: mocha.suite,
scope: 'all',
});

const header: string[][] = [
Expand Down

0 comments on commit d6599c9

Please sign in to comment.