Skip to content

Commit 36e9ae6

Browse files
committed
add it back in
1 parent d2cb00f commit 36e9ae6

File tree

1 file changed

+74
-75
lines changed

1 file changed

+74
-75
lines changed

packages/cdk/stacks/EpsAssistMeStack.ts

Lines changed: 74 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unused-vars */
21
import {
32
App,
43
Stack,
@@ -90,84 +89,84 @@ export class EpsAssistMeStack extends Stack {
9089
region
9190
})
9291

93-
// const vectorIndex = new VectorIndex(this, "VectorIndex", {
94-
// stackName: props.stackName,
95-
// collection: openSearchResources.collection
96-
// })
92+
const vectorIndex = new VectorIndex(this, "VectorIndex", {
93+
stackName: props.stackName,
94+
collection: openSearchResources.collection
95+
})
9796

9897
// Create VectorKnowledgeBase construct with Bedrock execution role
99-
// const vectorKB = new VectorKnowledgeBaseResources(this, "VectorKB", {
100-
// stackName: props.stackName,
101-
// docsBucket: storage.kbDocsBucket.bucket,
102-
// bedrockExecutionRole: bedrockExecutionRole.role,
103-
// collectionArn: openSearchResources.collection.collectionArn,
104-
// vectorIndexName: vectorIndex.indexName,
105-
// region,
106-
// account
107-
// })
108-
109-
// vectorKB.knowledgeBase.node.addDependency(vectorIndex.cfnIndex)
98+
const vectorKB = new VectorKnowledgeBaseResources(this, "VectorKB", {
99+
stackName: props.stackName,
100+
docsBucket: storage.kbDocsBucket.bucket,
101+
bedrockExecutionRole: bedrockExecutionRole.role,
102+
collectionArn: openSearchResources.collection.collectionArn,
103+
vectorIndexName: vectorIndex.indexName,
104+
region,
105+
account
106+
})
107+
108+
vectorKB.knowledgeBase.node.addDependency(vectorIndex.cfnIndex)
110109

111110
// Create runtime policies with resource dependencies
112-
// const runtimePolicies = new RuntimePolicies(this, "RuntimePolicies", {
113-
// region,
114-
// account,
115-
// slackBotTokenParameterName: secrets.slackBotTokenParameter.parameterName,
116-
// slackSigningSecretParameterName: secrets.slackSigningSecretParameter.parameterName,
117-
// slackBotStateTableArn: tables.slackBotStateTable.table.tableArn,
118-
// slackBotStateTableKmsKeyArn: tables.slackBotStateTable.kmsKey.keyArn,
119-
// knowledgeBaseArn: vectorKB.knowledgeBase.attrKnowledgeBaseArn,
120-
// guardrailArn: vectorKB.guardrail.guardrailArn,
121-
// dataSourceArn: vectorKB.dataSourceArn,
122-
// promptName: bedrockPromptResources.queryReformulationPrompt.promptName
123-
// })
111+
const runtimePolicies = new RuntimePolicies(this, "RuntimePolicies", {
112+
region,
113+
account,
114+
slackBotTokenParameterName: secrets.slackBotTokenParameter.parameterName,
115+
slackSigningSecretParameterName: secrets.slackSigningSecretParameter.parameterName,
116+
slackBotStateTableArn: tables.slackBotStateTable.table.tableArn,
117+
slackBotStateTableKmsKeyArn: tables.slackBotStateTable.kmsKey.keyArn,
118+
knowledgeBaseArn: vectorKB.knowledgeBase.attrKnowledgeBaseArn,
119+
guardrailArn: vectorKB.guardrail.guardrailArn,
120+
dataSourceArn: vectorKB.dataSourceArn,
121+
promptName: bedrockPromptResources.queryReformulationPrompt.promptName
122+
})
124123

125124
// Create Functions construct with actual values from VectorKB
126-
// const functions = new Functions(this, "Functions", {
127-
// stackName: props.stackName,
128-
// version: props.version,
129-
// commitId: props.commitId,
130-
// logRetentionInDays,
131-
// logLevel,
132-
// slackBotManagedPolicy: runtimePolicies.slackBotPolicy,
133-
// syncKnowledgeBaseManagedPolicy: runtimePolicies.syncKnowledgeBasePolicy,
134-
// slackBotTokenParameter: secrets.slackBotTokenParameter,
135-
// slackSigningSecretParameter: secrets.slackSigningSecretParameter,
136-
// guardrailId: vectorKB.guardrail.guardrailId,
137-
// guardrailVersion: vectorKB.guardrail.guardrailVersion,
138-
// collectionId: openSearchResources.collection.collectionId,
139-
// knowledgeBaseId: vectorKB.knowledgeBase.attrKnowledgeBaseId,
140-
// dataSourceId: vectorKB.dataSource.attrDataSourceId,
141-
// region,
142-
// account,
143-
// slackBotTokenSecret: secrets.slackBotTokenSecret,
144-
// slackBotSigningSecret: secrets.slackBotSigningSecret,
145-
// slackBotStateTable: tables.slackBotStateTable.table,
146-
// promptName: bedrockPromptResources.queryReformulationPrompt.promptName,
147-
// isPullRequest: isPullRequest,
148-
// mainSlackBotLambdaExecutionRoleArn: mainSlackBotLambdaExecutionRoleArn
149-
// })
125+
const functions = new Functions(this, "Functions", {
126+
stackName: props.stackName,
127+
version: props.version,
128+
commitId: props.commitId,
129+
logRetentionInDays,
130+
logLevel,
131+
slackBotManagedPolicy: runtimePolicies.slackBotPolicy,
132+
syncKnowledgeBaseManagedPolicy: runtimePolicies.syncKnowledgeBasePolicy,
133+
slackBotTokenParameter: secrets.slackBotTokenParameter,
134+
slackSigningSecretParameter: secrets.slackSigningSecretParameter,
135+
guardrailId: vectorKB.guardrail.guardrailId,
136+
guardrailVersion: vectorKB.guardrail.guardrailVersion,
137+
collectionId: openSearchResources.collection.collectionId,
138+
knowledgeBaseId: vectorKB.knowledgeBase.attrKnowledgeBaseId,
139+
dataSourceId: vectorKB.dataSource.attrDataSourceId,
140+
region,
141+
account,
142+
slackBotTokenSecret: secrets.slackBotTokenSecret,
143+
slackBotSigningSecret: secrets.slackBotSigningSecret,
144+
slackBotStateTable: tables.slackBotStateTable.table,
145+
promptName: bedrockPromptResources.queryReformulationPrompt.promptName,
146+
isPullRequest: isPullRequest,
147+
mainSlackBotLambdaExecutionRoleArn: mainSlackBotLambdaExecutionRoleArn
148+
})
150149

151150
// Add S3 notification to trigger sync Lambda function
152-
// new S3LambdaNotification(this, "S3LambdaNotification", {
153-
// bucket: storage.kbDocsBucket.bucket,
154-
// lambdaFunction: functions.syncKnowledgeBaseFunction.function
155-
// })
151+
new S3LambdaNotification(this, "S3LambdaNotification", {
152+
bucket: storage.kbDocsBucket.bucket,
153+
lambdaFunction: functions.syncKnowledgeBaseFunction.function
154+
})
156155

157156
// Create Apis and pass the Lambda function
158-
// const apis = new Apis(this, "Apis", {
159-
// stackName: props.stackName,
160-
// logRetentionInDays,
161-
// functions: {
162-
// slackBot: functions.slackBotLambda
163-
// }
164-
// })
157+
const apis = new Apis(this, "Apis", {
158+
stackName: props.stackName,
159+
logRetentionInDays,
160+
functions: {
161+
slackBot: functions.slackBotLambda
162+
}
163+
})
165164

166165
// Output: SlackBot Endpoint
167-
// new CfnOutput(this, "SlackBotEventsEndpoint", {
168-
// value: `https://${apis.apis["api"].api.domainName?.domainName}/slack/events`,
169-
// description: "Slack Events API endpoint for @mentions and direct messages"
170-
// })
166+
new CfnOutput(this, "SlackBotEventsEndpoint", {
167+
value: `https://${apis.apis["api"].api.domainName?.domainName}/slack/events`,
168+
description: "Slack Events API endpoint for @mentions and direct messages"
169+
})
171170

172171
// Output: Bedrock Prompt ARN
173172
new CfnOutput(this, "QueryReformulationPromptArn", {
@@ -184,15 +183,15 @@ export class EpsAssistMeStack extends Stack {
184183
exportName: `${props.stackName}:kbDocsBucket:Name`
185184
})
186185

187-
// new CfnOutput(this, "SlackBotLambdaRoleArn", {
188-
// value: functions.slackBotLambda.executionRole.roleArn,
189-
// exportName: `${props.stackName}:lambda:SlackBot:ExecutionRole:Arn`
190-
// })
186+
new CfnOutput(this, "SlackBotLambdaRoleArn", {
187+
value: functions.slackBotLambda.executionRole.roleArn,
188+
exportName: `${props.stackName}:lambda:SlackBot:ExecutionRole:Arn`
189+
})
191190

192-
// new CfnOutput(this, "SlackBotLambdaArn", {
193-
// value: functions.slackBotLambda.function.functionArn,
194-
// exportName: `${props.stackName}:lambda:SlackBot:Arn`
195-
// })
191+
new CfnOutput(this, "SlackBotLambdaArn", {
192+
value: functions.slackBotLambda.function.functionArn,
193+
exportName: `${props.stackName}:lambda:SlackBot:Arn`
194+
})
196195

197196
if (isPullRequest) {
198197
new CfnOutput(this, "VERSION_NUMBER", {

0 commit comments

Comments
 (0)