Skip to content

Commit

Permalink
Merge pull request #380 from aws-samples/hubin-daily-aics
Browse files Browse the repository at this point in the history
refactor: update intention api
  • Loading branch information
530051970 committed Sep 5, 2024
2 parents 82ea194 + abc108d commit 13f1df3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
35 changes: 31 additions & 4 deletions source/infrastructure/lib/api/api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,19 @@ export class ApiConstruct extends Construct {
apiResourceCheckChatbot.addMethod("POST", lambdaChatbotIntegration, this.genMethodOption(api, auth, null))
const apiResourceChatbots = apiResourceChatbotManagement.addResource("chatbots");
apiResourceChatbots.addMethod("POST", lambdaChatbotIntegration, {
...this.genMethodOption(api, auth, null),
...this.genMethodOption(api, auth, {
chatbotId: {type: JsonSchemaType.STRING},
groupName: {type: JsonSchemaType.STRING},
indexIds: {
type: JsonSchemaType.OBJECT,
properties: {
qq: { type: JsonSchemaType.STRING },
qd: { type: JsonSchemaType.STRING },
intention: { type: JsonSchemaType.STRING }
}
},
Message: {type: JsonSchemaType.STRING},
}),
requestModels: this.genRequestModel(api, {
"chatbotId": { "type": JsonSchemaType.STRING },
"index": {type: JsonSchemaType.OBJECT,
Expand Down Expand Up @@ -535,12 +547,13 @@ export class ApiConstruct extends Construct {
type: JsonSchemaType.STRING,
}
}
}),
})
,
requestParameters: {
'method.request.querystring.max_items': false,
'method.request.querystring.page_size': false
}
});
})



Expand Down Expand Up @@ -602,7 +615,21 @@ export class ApiConstruct extends Construct {
apiResourceDownload.addMethod("GET", lambdaIntentionIntegration, this.genMethodOption(api, auth, null));
const apiResourceExecutionManagement = apiResourceIntentionManagement.addResource("executions");
apiResourceExecutionManagement.addMethod("POST", lambdaIntentionIntegration, {
...this.genMethodOption(api, auth, null),
...this.genMethodOption(api, auth, {
execution_id: { type: JsonSchemaType.STRING },
input_payload: {
type: JsonSchemaType.OBJECT,
properties: {
tableItemId: { type: JsonSchemaType.STRING },
chatbotId: { type: JsonSchemaType.STRING },
groupName: { type: JsonSchemaType.STRING },
index: { type: JsonSchemaType.STRING },
model: { type: JsonSchemaType.STRING },
fieldName: { type: JsonSchemaType.STRING }
}
},
result: { type: JsonSchemaType.STRING }
}),
requestModels: this.genRequestModel(api, {
"chatbotId": { "type": JsonSchemaType.STRING },
"index": { "type": JsonSchemaType.STRING },
Expand Down
8 changes: 1 addition & 7 deletions source/lambda/intention/intention.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,9 @@ def __create_execution(event, context, email, group_name):
__save_2_aos(input_body.get("model"), execution_detail["index"], qaList)

return {
"statusCode": 200,
"headers": resp_header,
"body": json.dumps(
{
"execution_id": execution_detail["tableItemId"],
"input_payload": json.dumps(execution_detail),
"input_payload": execution_detail,
"result": "success"
}
),
}

def __save_2_aos(modelId: str, index: str, qaList:list):
Expand Down

0 comments on commit 13f1df3

Please sign in to comment.