Skip to content

Commit

Permalink
Fix FTRs
Browse files Browse the repository at this point in the history
  • Loading branch information
sphilipse committed Sep 17, 2024
1 parent d6599c9 commit 0d44e5b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const mockService: ObservabilityAIAssistantService = {
predefinedConversation$: new Observable(),
},
navigate: async () => of(),
scope: 'all',
};

function createSetupContract(): ObservabilityAIAssistantPublicSetup {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ export const createStorybookService = (): ObservabilityAIAssistantService => ({
predefinedConversation$: new Observable(),
},
navigate: async () => of(),
scope: 'observability',
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const chatCompleteBaseRt = t.type({
messages: t.array(messageRt),
connectorId: t.string,
persist: toBooleanRt,
scope: assistantScopeType,
}),
t.partial({
conversationId: t.string,
Expand Down Expand Up @@ -62,6 +61,7 @@ const chatCompleteInternalRt = t.intersection([
t.type({
body: t.type({
screenContexts: t.array(screenContextRt),
scope: assistantScopeType,
}),
}),
]);
Expand Down Expand Up @@ -310,6 +310,7 @@ const publicChatCompleteRoute = createObservabilityAIAssistantServerRoute({
params: {
body: {
...restOfBody,
scope: 'observability',
screenContexts: [
{
actions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
connectorId,
persist: true,
screenContexts: params.screenContexts || [],
scope: 'all',
})
.then((response) => resolve(response))
.catch((err) => reject(err));
Expand Down Expand Up @@ -136,6 +137,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
connectorId,
persist: false,
screenContexts: [],
scope: 'all',
})
.pipe(passThrough);

Expand Down Expand Up @@ -402,6 +404,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
connectorId,
persist: true,
screenContexts: [],
scope: 'observability',
},
},
})
Expand Down Expand Up @@ -444,6 +447,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
persist: true,
screenContexts: [],
conversationId,
scope: 'observability',
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
StreamingChatResponseEvent,
} from '@kbn/observability-ai-assistant-plugin/common';
import { Readable } from 'stream';
import { AssistantScope } from '@kbn/observability-ai-assistant-plugin/common/types';
import { CreateTest } from '../../../common/config';

function decodeEvents(body: Readable | string) {
Expand All @@ -32,12 +33,14 @@ export async function invokeChatCompleteWithFunctionRequest({
connectorId,
observabilityAIAssistantAPIClient,
functionCall,
scope,
}: {
connectorId: string;
observabilityAIAssistantAPIClient: Awaited<
ReturnType<CreateTest['services']['observabilityAIAssistantAPIClient']>
>;
functionCall: Message['message']['function_call'];
scope?: AssistantScope;
}) {
const { body } = await observabilityAIAssistantAPIClient
.editorUser({
Expand All @@ -57,6 +60,7 @@ export async function invokeChatCompleteWithFunctionRequest({
connectorId,
persist: false,
screenContexts: [],
scope: scope || 'observability',
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
connectorId,
persist: true,
screenContexts: [],
scope: 'observability',
},
},
}).expect(200);
Expand Down

0 comments on commit 0d44e5b

Please sign in to comment.