Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Oct 30, 2024
1 parent 7c8025a commit b11e196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ export class AIAssistantKnowledgeBaseDataClient extends AIAssistantDataClient {
stats.deployment_stats?.allocation_status.state === 'fully_allocated';

const isReadyServerless = (stats: MlTrainedModelStats) =>
(stats.deployment_stats?.nodes as unknown as MlTrainedModelDeploymentNodesStats[]).some(
(stats.deployment_stats?.nodes as unknown as MlTrainedModelDeploymentNodesStats[])?.some(
(node) => node.routing_state.routing_state === 'started'
);

return getResponse.trained_model_stats.some(
return getResponse.trained_model_stats?.some(
(stats) => isReadyESS(stats) || isReadyServerless(stats)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ export const getKnowledgeBaseStatusRoute = (router: ElasticAssistantPluginRouter
pipeline_exists: pipelineExists,
};

if (v2KnowledgeBaseEnabled && indexExists && isModelDeployed) {
const securityLabsExists = await kbDataClient.isSecurityLabsDocsLoaded();
if (indexExists && isModelDeployed) {
const securityLabsExists = v2KnowledgeBaseEnabled
? await kbDataClient.isSecurityLabsDocsLoaded()
: true;
const userDataExists = v2KnowledgeBaseEnabled
? await kbDataClient.isUserDataExists()
: true;

return response.ok({
body: {
...body,
security_labs_exists: securityLabsExists,
user_data_exists: await kbDataClient.isUserDataExists(),
user_data_exists: userDataExists,
},
});
}
Expand Down

0 comments on commit b11e196

Please sign in to comment.