Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kdid committed Jul 1, 2024
1 parent 348af5a commit 3392747
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
25 changes: 14 additions & 11 deletions node/src/handlers/post-chat-feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,27 @@ const feedbackSchema = {
type: "array",
items: { type: "string" },
},
required: ["ref", "question", "answer", "source_documents"],
},
feedback: {
type: "object",
properties: {
options: { type: "array", items: { type: "string" } },
text: { type: "string" },
email: { type: "string" },
},
required: ["options", "text"],
required: ["ref", "question", "answer", "source_documents"],
additionalProperties: false,
},
feedback: {
type: "object",
properties: {
options: { type: "array", items: { type: "string" } },
text: { type: "string" },
email: { type: "string" },
},
required: ["options", "text", "email"],
additionalProperties: false,
},
required: ["sentiment", "context", "feedback"],
},
required: ["sentiment", "context", "feedback"],
additionalProperties: false,
};

const handler = wrap(async (event, context) => {
if (!event.userToken.isLoggedIn()) {
if (!event.userToken.isLoggedIn() && !event.userToken.isSuperUser()) {
return {
statusCode: 401,
headers: { "Content-Type": "text/plain" },
Expand Down
4 changes: 2 additions & 2 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ Resources:
Type: HttpApi
Properties:
ApiId: !Ref dcApi
Path: /chat-endpoint
Path: /chat/endpoint
Method: GET
chatFeedback:
Type: AWS::Serverless::Function
Expand Down Expand Up @@ -725,7 +725,7 @@ Resources:
Type: HttpApi
Properties:
ApiId: !Ref dcApi
Path: /chat-feedback
Path: /chat/feedback
Method: POST
chatFeedbackBucket:
Type: 'AWS::S3::Bucket'
Expand Down

0 comments on commit 3392747

Please sign in to comment.