-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Developer #11
base: main
Are you sure you want to change the base?
Developer #11
Changes from all commits
47d5805
83e71fc
363a96f
4fdce85
64f7ea8
64aba22
6376391
c6eb9c4
b322b2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
image: node:20.17.0 | ||
container_name: apigpt | ||
working_dir: /usr/src/app | ||
volumes: | ||
- .:/usr/src/app | ||
ports: | ||
- "${EXPRESS_PORT}:${EXPRESS_PORT}" | ||
command: npm run dev | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The command |
||
env_file: | ||
- .env | ||
|
||
# mongo: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing the commented-out section for the |
||
# image: mongo:latest | ||
# container_name: mongo | ||
# ports: | ||
# - "27017:27017" | ||
# volumes: | ||
# - mongo_data:/data/db | ||
|
||
# volumes: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the previous comment, if the |
||
# mongo_data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ const aiRepositoryTool = { | |
query: { | ||
type: 'object', | ||
description: | ||
'The query parameters used for the operation. Structure depends on the transaction type, Required for update operations. Include subpropeties query.filter and query.update', | ||
'The query parameters used for the operation. Structure depends on the transaction type.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description for the query parameters is incomplete. It should mention that it is required for update operations and include details about the subproperties |
||
properties: { | ||
filter: { | ||
type: 'object', | ||
|
@@ -23,8 +23,7 @@ const aiRepositoryTool = { | |
}, | ||
update: { | ||
type: 'object', | ||
description: | ||
'Data to update. Required for update operations. Include subpropeties query.filter and query.update', | ||
description: 'Data to update (required for update transactions).', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description should be more specific about the required subproperties for the update operation. Consider including details about |
||
}, | ||
}, | ||
required: ['filter'], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,52 @@ | ||
export default { | ||
'/ai': { | ||
post: { | ||
summary: 'Processa a requisição AI', | ||
description: 'Envia uma requisição para o serviço AI.', | ||
summary: 'Interact with AI for API Commands', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The summary and description have been changed to English, which is good for consistency, but the previous summary was more concise. Consider revising the summary to be more succinct. |
||
description: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new description is quite lengthy. It might be beneficial to condense the information to focus on the most critical aspects of the endpoint. |
||
'This endpoint allows users to send natural language commands to the API. You can use this to perform various actions such as creating users, fetching products, or retrieving information. Here are some examples of how to structure your commands:\n' + | ||
'- "Create a user named John Doe with email john.doe@example.com."\n' + | ||
'- "Find all products under $50."\n' + | ||
'- "Show me details of the user named Jane Smith."\n' + | ||
'- "List all users."', | ||
tags: ['AI Command Interface'], | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
body: { | ||
type: 'object', | ||
}, | ||
header: { | ||
type: 'object', | ||
prompt: { | ||
type: 'string', | ||
example: | ||
'Create a product named Sample Product with description "This is a sample product." and price 19.99.', | ||
}, | ||
}, | ||
required: ['prompt'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
}, | ||
}, | ||
}, | ||
}, | ||
responses: { | ||
200: { | ||
description: 'Resposta bem-sucedida', | ||
description: 'Response from the API based on the provided command', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
response: { | ||
type: 'string', | ||
description: | ||
'The result of the command interpreted and executed by the API.', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
400: { | ||
description: 'Invalid command, please check your input.', | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description for the 400 response should be more informative. Consider specifying what kind of input might lead to an invalid command. |
||
}, | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
export default { | ||
'/products': { | ||
get: { | ||
summary: 'Fetch All Products', | ||
description: | ||
'Retrieves a list of all products with optional filtering and pagination.', | ||
tags: ['JSON'], // Tag para agrupar na seção JSON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment in this line is in Portuguese. It would be better to keep comments in English for consistency. |
||
parameters: [ | ||
{ | ||
name: 'priceMin', | ||
in: 'query', | ||
description: 'Minimum price to filter products', | ||
required: false, | ||
schema: { | ||
type: 'number', | ||
}, | ||
}, | ||
{ | ||
name: 'priceMax', | ||
in: 'query', | ||
description: 'Maximum price to filter products', | ||
required: false, | ||
schema: { | ||
type: 'number', | ||
}, | ||
}, | ||
{ | ||
name: 'page', | ||
in: 'query', | ||
description: 'Page number for pagination', | ||
required: false, | ||
schema: { | ||
type: 'integer', | ||
example: 1, | ||
}, | ||
}, | ||
{ | ||
name: 'limit', | ||
in: 'query', | ||
description: 'Number of products per page', | ||
required: false, | ||
schema: { | ||
type: 'integer', | ||
example: 10, | ||
}, | ||
}, | ||
], | ||
responses: { | ||
200: { | ||
description: 'List of products retrieved successfully', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
total: { | ||
type: 'integer', | ||
description: 'Total number of products available', | ||
}, | ||
products: { | ||
type: 'array', | ||
items: { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
}, | ||
description: { | ||
type: 'string', | ||
}, | ||
price: { | ||
type: 'number', | ||
}, | ||
stock: { | ||
type: 'number', | ||
}, | ||
category: { | ||
type: 'string', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
'/product/name/{name}': { | ||
get: { | ||
summary: 'Fetch Specific Product by Name', | ||
description: 'Retrieves details of a specific product by its name.', | ||
tags: ['JSON'], // Tag para agrupar na seção JSON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to line 7, this comment is also in Portuguese. Please ensure all comments are in English. |
||
parameters: [ | ||
{ | ||
name: 'name', | ||
in: 'path', | ||
required: true, | ||
description: 'Name of the product to retrieve', | ||
schema: { | ||
type: 'string', | ||
}, | ||
}, | ||
], | ||
responses: { | ||
200: { | ||
description: 'Product details retrieved successfully', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
}, | ||
description: { | ||
type: 'string', | ||
}, | ||
price: { | ||
type: 'number', | ||
}, | ||
stock: { | ||
type: 'number', | ||
}, | ||
category: { | ||
type: 'string', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
'/product': { | ||
post: { | ||
summary: 'Create Product', | ||
description: | ||
'Creates a new product by sending product details in JSON format.', | ||
tags: ['JSON'], // Tag para agrupar na seção JSON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this comment is in Portuguese. Consistency in language is important, so please translate it to English. |
||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
example: 'Sample Product', | ||
}, | ||
description: { | ||
type: 'string', | ||
example: 'This is a sample product description.', | ||
}, | ||
price: { | ||
type: 'number', | ||
example: 29.99, | ||
}, | ||
stock: { | ||
type: 'number', | ||
example: 100, | ||
}, | ||
category: { | ||
type: 'string', | ||
example: 'Electronics', | ||
}, | ||
}, | ||
required: ['name', 'description', 'price', 'category'], | ||
}, | ||
}, | ||
}, | ||
}, | ||
responses: { | ||
201: { | ||
description: 'Product created successfully', | ||
}, | ||
400: { | ||
description: 'Invalid input', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the
${EXPRESS_PORT}
environment variable is defined in your.env
file to avoid runtime errors.