mirror of
https://github.com/StanGirard/quivr.git
synced 2024-09-17 16:07:35 +03:00
Merge branch 'main' into addBrainOnSearchingPage
This commit is contained in:
commit
112706402e
@ -1,105 +1,100 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr:160",
|
||||
"containerDefinitions": [
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr:160",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:bada136312ad3497664c3562a36b263d43c89c53",
|
||||
"cpu": "2048",
|
||||
"memory": "4096",
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:bada136312ad3497664c3562a36b263d43c89c53",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr-5050-tcp",
|
||||
"containerPort": 5050,
|
||||
"hostPort": 5050,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"essential": true,
|
||||
"command": [
|
||||
"uvicorn",
|
||||
"main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050",
|
||||
"--workers",
|
||||
"6"
|
||||
],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/production.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
"name": "quivr-5050-tcp",
|
||||
"containerPort": 5050,
|
||||
"hostPort": 5050,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"family": "quivr",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 160,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
],
|
||||
"essential": true,
|
||||
"command": [
|
||||
"uvicorn",
|
||||
"main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050",
|
||||
"--workers",
|
||||
"6"
|
||||
],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
"value": "arn:aws:s3:::quivr-env-variables/production.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": [
|
||||
"EC2",
|
||||
"FARGATE"
|
||||
],
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "quivr",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 160,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
"registeredAt": "2023-07-27T13:27:07.192Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": ["EC2", "FARGATE"],
|
||||
"requiresCompatibilities": ["FARGATE"],
|
||||
"cpu": "2048",
|
||||
"memory": "4096",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
},
|
||||
"registeredAt": "2023-07-27T13:27:07.192Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
|
@ -1,106 +1,101 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-preview:4",
|
||||
"containerDefinitions": [
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-preview:4",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:c0ff0301002fe6d043270b26dabcfda797437afc",
|
||||
"cpu": "2048",
|
||||
"memory": "4096",
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:c0ff0301002fe6d043270b26dabcfda797437afc",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr-5050-tcp",
|
||||
"containerPort": 5050,
|
||||
"hostPort": 5050,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"command": [
|
||||
"uvicorn",
|
||||
"main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050",
|
||||
"--workers",
|
||||
"6"
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/preview.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"ulimits": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-preview",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
"name": "quivr-5050-tcp",
|
||||
"containerPort": 5050,
|
||||
"hostPort": 5050,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"family": "quivr-preview",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 4,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
],
|
||||
"command": [
|
||||
"uvicorn",
|
||||
"main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050",
|
||||
"--workers",
|
||||
"6"
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
"value": "arn:aws:s3:::quivr-env-variables/preview.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": [
|
||||
"EC2",
|
||||
"FARGATE"
|
||||
],
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"ulimits": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-preview",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "quivr-preview",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 4,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
"registeredAt": "2023-06-29T07:33:39.537Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": ["EC2", "FARGATE"],
|
||||
"requiresCompatibilities": ["FARGATE"],
|
||||
"cpu": "2048",
|
||||
"memory": "4096",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
},
|
||||
"registeredAt": "2023-06-29T07:33:39.537Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
|
@ -1,94 +1,82 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-preview-chat:1",
|
||||
"containerDefinitions": [
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-preview-chat:1",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:600ff1ede02741c66853cc3e4e7f5001aaba3bc2",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"essential": true,
|
||||
"command": ["celery", "-A", "celery_worker", "worker", "-l", "info"],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:600ff1ede02741c66853cc3e4e7f5001aaba3bc2",
|
||||
"cpu": "256",
|
||||
"memory": "1024",
|
||||
"essential": true,
|
||||
"command": [
|
||||
"celery",
|
||||
"-A",
|
||||
"celery_worker",
|
||||
"worker",
|
||||
"-l",
|
||||
"info"
|
||||
],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/preview.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-preview-chat",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
"value": "arn:aws:s3:::quivr-env-variables/preview.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"family": "quivr-preview-chat",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 1,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-preview-chat",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": [
|
||||
"EC2",
|
||||
"FARGATE"
|
||||
],
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "256",
|
||||
"memory": "1024",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "quivr-preview-chat",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 1,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
"registeredAt": "2023-08-18T09:01:56.187Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": ["EC2", "FARGATE"],
|
||||
"requiresCompatibilities": ["FARGATE"],
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
},
|
||||
"registeredAt": "2023-08-18T09:01:56.187Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
|
@ -1,100 +1,88 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-prod-chat:71",
|
||||
"containerDefinitions": [
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-prod-chat:71",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:35bd4727c67790d295a474dd81dfbef8469365e8",
|
||||
"cpu": 2048,
|
||||
"memory": 4096,
|
||||
"memoryReservation": 4096,
|
||||
"portMappings": [],
|
||||
"essential": true,
|
||||
"command": ["celery", "-A", "celery_worker", "worker", "-l", "info"],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:35bd4727c67790d295a474dd81dfbef8469365e8",
|
||||
"cpu": 1024,
|
||||
"memory": 2048,
|
||||
"memoryReservation": 2048,
|
||||
"portMappings": [],
|
||||
"essential": true,
|
||||
"command": [
|
||||
"celery",
|
||||
"-A",
|
||||
"celery_worker",
|
||||
"worker",
|
||||
"-l",
|
||||
"info"
|
||||
],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/production.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-production-chat",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
},
|
||||
"secretOptions": []
|
||||
}
|
||||
"value": "arn:aws:s3:::quivr-env-variables/production.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"family": "quivr-prod-chat",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 71,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-production-chat",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": [
|
||||
"EC2",
|
||||
"FARGATE"
|
||||
],
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
"secretOptions": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "quivr-prod-chat",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 71,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
"registeredAt": "2023-12-03T15:54:51.921Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": ["EC2", "FARGATE"],
|
||||
"requiresCompatibilities": ["FARGATE"],
|
||||
"cpu": "2048",
|
||||
"memory": "4096",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
},
|
||||
"registeredAt": "2023-12-03T15:54:51.921Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
|
@ -1,97 +1,92 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/Strapi:1",
|
||||
"containerDefinitions": [
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/Strapi:1",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "strapi",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr-strapi",
|
||||
"cpu": 1024,
|
||||
"memory": 2048,
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "strapi",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr-strapi",
|
||||
"cpu": 512,
|
||||
"memory": 2048,
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "strapi-1337-tcp",
|
||||
"containerPort": 1337,
|
||||
"hostPort": 1337,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/strapi.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"ulimits": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/Strapi",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
},
|
||||
"secretOptions": []
|
||||
}
|
||||
"name": "strapi-1337-tcp",
|
||||
"containerPort": 1337,
|
||||
"hostPort": 1337,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"family": "Strapi",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 1,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
"value": "arn:aws:s3:::quivr-env-variables/strapi.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": [
|
||||
"EC2",
|
||||
"FARGATE"
|
||||
],
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"ulimits": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/Strapi",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
},
|
||||
"secretOptions": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "Strapi",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 1,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
"registeredAt": "2023-09-21T07:48:32.167Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": ["EC2", "FARGATE"],
|
||||
"requiresCompatibilities": ["FARGATE"],
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
},
|
||||
"registeredAt": "2023-09-21T07:48:32.167Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
||||
|
42
CHANGELOG.md
42
CHANGELOG.md
@ -1,5 +1,47 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.179 (2024-01-22)
|
||||
|
||||
**Full Changelog**: https://github.com/StanGirard/quivr/compare/v0.0.178...v0.0.179
|
||||
|
||||
## 0.0.178 (2024-01-22)
|
||||
|
||||
## What's Changed
|
||||
* fix(frontend): use mention brain on search bar by @Zewed in https://github.com/StanGirard/quivr/pull/2060
|
||||
* feat: 🎸 cpu by @StanGirard in https://github.com/StanGirard/quivr/pull/2065
|
||||
|
||||
|
||||
**Full Changelog**: https://github.com/StanGirard/quivr/compare/v0.0.177...v0.0.178
|
||||
|
||||
## 0.0.177 (2024-01-22)
|
||||
|
||||
## What's Changed
|
||||
* fix: 🐛 usage by @StanGirard in https://github.com/StanGirard/quivr/pull/2062
|
||||
|
||||
|
||||
**Full Changelog**: https://github.com/StanGirard/quivr/compare/v0.0.176...v0.0.177
|
||||
|
||||
## 0.0.176 (2024-01-22)
|
||||
|
||||
**Full Changelog**: https://github.com/StanGirard/quivr/compare/v0.0.175...v0.0.176
|
||||
|
||||
## 0.0.175 (2024-01-22)
|
||||
|
||||
## What's Changed
|
||||
* fix: 🐛 limits by @StanGirard in https://github.com/StanGirard/quivr/pull/2058
|
||||
|
||||
|
||||
**Full Changelog**: https://github.com/StanGirard/quivr/compare/v0.0.174...v0.0.175
|
||||
|
||||
## 0.0.174 (2024-01-22)
|
||||
|
||||
## What's Changed
|
||||
* fix(frontend): remove actions modal by @Zewed in https://github.com/StanGirard/quivr/pull/2054
|
||||
* feat: 🎸 usage by @StanGirard in https://github.com/StanGirard/quivr/pull/2057
|
||||
|
||||
|
||||
**Full Changelog**: https://github.com/StanGirard/quivr/compare/v0.0.173...v0.0.174
|
||||
|
||||
## 0.0.173 (2024-01-22)
|
||||
|
||||
## What's Changed
|
||||
|
@ -13,7 +13,7 @@ class Repository(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_requests_count_for_day(self, user_id: UUID, date: datetime):
|
||||
def get_user_requests_count_for_month(self, user_id: UUID, date: datetime):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from uuid import UUID
|
||||
|
||||
from logger import get_logger
|
||||
@ -122,7 +122,7 @@ class UserUsage(Repository):
|
||||
{
|
||||
"max_brains": product_settings["max_brains"],
|
||||
"max_brain_size": product_settings["max_brain_size"],
|
||||
"daily_chat_credit": product_settings["daily_chat_credit"],
|
||||
"monthly_chat_credit": product_settings["monthly_chat_credit"],
|
||||
"api_access": product_settings["api_access"],
|
||||
"models": product_settings["models"],
|
||||
}
|
||||
@ -245,15 +245,32 @@ class UserUsage(Repository):
|
||||
return response[0]["daily_requests_count"]
|
||||
return 0
|
||||
|
||||
def increment_user_request_count(
|
||||
self, user_id, date, current_requests_count: int, number: int = 1
|
||||
):
|
||||
def get_user_requests_count_for_month(self, user_id, date):
|
||||
"""
|
||||
Fetch the user request count from the database
|
||||
"""
|
||||
date_30_days_ago = (datetime.now() - timedelta(days=30)).strftime("%Y%m%d")
|
||||
|
||||
response = (
|
||||
self.db.from_("user_daily_usage")
|
||||
.select("daily_requests_count")
|
||||
.filter("user_id", "eq", user_id)
|
||||
.filter("date", "gte", date_30_days_ago)
|
||||
.execute()
|
||||
).data
|
||||
|
||||
if response and len(response) > 0:
|
||||
return sum(row["daily_requests_count"] for row in response)
|
||||
return 0
|
||||
|
||||
def increment_user_request_count(self, user_id, date, number: int = 1):
|
||||
"""
|
||||
Increment the user's requests count for a specific day
|
||||
"""
|
||||
current = self.get_user_requests_count_for_day(user_id, date)
|
||||
|
||||
self.update_user_request_count(
|
||||
user_id, daily_requests_count=current_requests_count + number, date=date
|
||||
user_id, daily_requests_count=current + number, date=date
|
||||
)
|
||||
|
||||
def update_user_request_count(self, user_id, daily_requests_count, date):
|
||||
|
@ -52,14 +52,14 @@ class UserUsage(UserIdentity):
|
||||
|
||||
return request
|
||||
|
||||
def get_user_daily_usage(self, date):
|
||||
def get_user_monthly_usage(self, date):
|
||||
"""
|
||||
Fetch the user daily usage from the database
|
||||
"""
|
||||
posthog = PostHogSettings()
|
||||
request = self.supabase_db.get_user_requests_count_for_day(self.id, date)
|
||||
request = self.supabase_db.get_user_requests_count_for_month(self.id, date)
|
||||
posthog.set_user_properties(
|
||||
self.id, "DAILY_USAGE", {"daily_chat_usage": request}
|
||||
self.id, "MONTHLY_USAGE", {"monthly_chat_usage": request}
|
||||
)
|
||||
|
||||
return request
|
||||
@ -68,11 +68,12 @@ class UserUsage(UserIdentity):
|
||||
"""
|
||||
Increment the user request count in the database
|
||||
"""
|
||||
current_requests_count = self.supabase_db.get_user_requests_count_for_day(
|
||||
current_requests_count = self.supabase_db.get_user_requests_count_for_month(
|
||||
self.id, date
|
||||
)
|
||||
|
||||
logger.info(current_requests_count)
|
||||
if current_requests_count == 0:
|
||||
logger.info("Request count is 0, creating new record")
|
||||
if self.email is None:
|
||||
raise ValueError("User Email should be defined for daily usage table")
|
||||
self.supabase_db.create_user_daily_usage(
|
||||
@ -84,7 +85,6 @@ class UserUsage(UserIdentity):
|
||||
self.supabase_db.increment_user_request_count(
|
||||
user_id=self.id,
|
||||
date=date,
|
||||
current_requests_count=current_requests_count,
|
||||
number=number,
|
||||
)
|
||||
|
||||
|
@ -72,11 +72,18 @@ class BrainfulChat(ChatInterface):
|
||||
history = chat_service.get_chat_history(chat_id)
|
||||
if history:
|
||||
question = history[0].user_message
|
||||
list_brains = vector_store.find_brain_closest_query(user_id, question)
|
||||
if list_brains:
|
||||
brain_id_to_use = list_brains[0]["id"]
|
||||
brain_id_to_use = history[0].brain_id
|
||||
|
||||
list_brains = []
|
||||
if history:
|
||||
list_brains = vector_store.find_brain_closest_query(user_id, question)
|
||||
metadata["close_brains"] = list_brains
|
||||
else:
|
||||
brain_id_to_use = None
|
||||
list_brains = vector_store.find_brain_closest_query(user_id, question)
|
||||
if list_brains:
|
||||
brain_id_to_use = list_brains[0]["id"]
|
||||
else:
|
||||
brain_id_to_use = None
|
||||
# Add to metadata close_brains and close_brains_similarity
|
||||
metadata["close_brains"] = list_brains
|
||||
|
||||
|
@ -2,9 +2,12 @@ import time
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import HTTPException
|
||||
from logger import get_logger
|
||||
from models import UserUsage
|
||||
from modules.user.entity.user_identity import UserIdentity
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
class NullableUUID(UUID):
|
||||
@classmethod
|
||||
@ -28,8 +31,8 @@ def check_user_requests_limit(user: UserIdentity, model: str):
|
||||
|
||||
date = time.strftime("%Y%m%d")
|
||||
|
||||
daily_chat_credit = userSettings.get("daily_chat_credit", 0)
|
||||
daily_user_count = userDailyUsage.get_user_daily_usage(date)
|
||||
monthly_chat_credit = userSettings.get("monthly_chat_credit", 0)
|
||||
daily_user_count = userDailyUsage.get_user_monthly_usage(date)
|
||||
models_price = userDailyUsage.get_model_settings()
|
||||
user_choosen_model_price = 1000
|
||||
|
||||
@ -37,10 +40,10 @@ def check_user_requests_limit(user: UserIdentity, model: str):
|
||||
if model_setting["name"] == model:
|
||||
user_choosen_model_price = model_setting["price"]
|
||||
|
||||
if int(daily_user_count + user_choosen_model_price) > int(daily_chat_credit):
|
||||
if int(daily_user_count + user_choosen_model_price) > int(monthly_chat_credit):
|
||||
raise HTTPException(
|
||||
status_code=429, # pyright: ignore reportPrivateUsage=none
|
||||
detail=f"You have reached your daily chat limit of {daily_chat_credit} requests per day. Please upgrade your plan to increase your daily chat limit.",
|
||||
detail=f"You have reached your monthly chat limit of {monthly_chat_credit} requests per months. Please upgrade your plan to increase your daily chat limit.",
|
||||
)
|
||||
else:
|
||||
userDailyUsage.handle_increment_user_request_count(
|
||||
|
@ -38,7 +38,7 @@ async def get_user_endpoint(
|
||||
max_brain_size = user_settings.get("max_brain_size", 1000000000)
|
||||
|
||||
date = time.strftime("%Y%m%d")
|
||||
daily_chat_credit = user_settings.get("daily_chat_credit", 10)
|
||||
monthly_chat_credit = user_settings.get("monthly_chat_credit", 10)
|
||||
|
||||
user_daily_usage = UserUsage(id=current_user.id)
|
||||
requests_stats = user_daily_usage.get_user_usage()
|
||||
@ -53,7 +53,7 @@ async def get_user_endpoint(
|
||||
"email": current_user.email,
|
||||
"max_brain_size": max_brain_size,
|
||||
"current_brain_size": defaul_brain_size,
|
||||
"daily_chat_credit": daily_chat_credit,
|
||||
"monthly_chat_credit": monthly_chat_credit,
|
||||
"requests_stats": requests_stats,
|
||||
"models": user_settings.get("models", []),
|
||||
"date": date,
|
||||
|
@ -11,7 +11,6 @@ def list_files_from_storage(path):
|
||||
|
||||
try:
|
||||
response = supabase_client.storage.from_("quivr").list(path)
|
||||
logger.info("RESPONSE", response)
|
||||
return response
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
@ -37,7 +37,6 @@ class CustomSupabaseVectorStore(SupabaseVectorStore):
|
||||
) -> [dict]:
|
||||
vectors = self._embedding.embed_documents([query])
|
||||
query_embedding = vectors[0]
|
||||
logger.info("🤯🤯")
|
||||
|
||||
res = self._client.rpc(
|
||||
table,
|
||||
|
@ -1,48 +0,0 @@
|
||||
import { PopoverAnchor } from "@radix-ui/react-popover";
|
||||
import { useState } from "react";
|
||||
import { LuPlusCircle, LuXCircle } from "react-icons/lu";
|
||||
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/lib/components/ui/Popover";
|
||||
|
||||
import { ChatHistoryButton } from "./components/ChatHistoryButton/ChatHistoryButton";
|
||||
import { ConfigModal } from "./components/ConfigModal";
|
||||
import { FeedCardTrigger } from "./components/FeedCardTrigger";
|
||||
import { SelectedBrainTag } from "./components/SelectedBrainTag";
|
||||
|
||||
export const ActionsModal = (): JSX.Element => {
|
||||
const [isActionsModalOpened, setIsActionsModalOpened] = useState(false);
|
||||
|
||||
const Icon = isActionsModalOpened ? LuXCircle : LuPlusCircle;
|
||||
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
<Popover
|
||||
open={isActionsModalOpened}
|
||||
onOpenChange={(isOpened) => setIsActionsModalOpened(isOpened)}
|
||||
>
|
||||
<PopoverTrigger>
|
||||
<PopoverAnchor asChild>
|
||||
<Button variant="tertiary" type="button" className="p-0">
|
||||
<Icon className="text-accent font-bold" size={30} />
|
||||
</Button>
|
||||
</PopoverAnchor>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
align="end"
|
||||
sideOffset={15}
|
||||
className="min-h-[200px] w-[250px]"
|
||||
>
|
||||
<SelectedBrainTag />
|
||||
<FeedCardTrigger />
|
||||
<ChatHistoryButton />
|
||||
<ConfigModal />
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</div>
|
||||
);
|
||||
};
|
@ -1,34 +0,0 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuChevronRight, LuHistory } from "react-icons/lu";
|
||||
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/lib/components/ui/Popover";
|
||||
|
||||
import { ChatsList } from "./components/ChatsList";
|
||||
import { Button } from "../Button";
|
||||
|
||||
export const ChatHistoryButton = (): JSX.Element => {
|
||||
const { t } = useTranslation("chat");
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger className="w-full">
|
||||
<Button
|
||||
label={t("history")}
|
||||
className="w-full"
|
||||
startIcon={<LuHistory size={18} />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
/>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
align="center"
|
||||
className="min-h-[200px] w-[250px] max-h-[500px] overflow-auto"
|
||||
>
|
||||
<ChatsList />
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
};
|
@ -1,123 +0,0 @@
|
||||
/* eslint-disable max-lines */
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
BrainContextMock,
|
||||
BrainProviderMock,
|
||||
} from "@/lib/context/BrainProvider/mocks/BrainProviderMock";
|
||||
import {
|
||||
ChatContextMock,
|
||||
ChatProviderMock,
|
||||
} from "@/lib/context/ChatProvider/mocks/ChatProviderMock";
|
||||
import { KnowledgeToFeedProvider } from "@/lib/context/KnowledgeToFeedProvider";
|
||||
import { MenuProvider } from "@/lib/context/MenuProvider/Menu-provider";
|
||||
import { SupabaseContextMock } from "@/lib/context/SupabaseProvider/mocks/SupabaseProviderMock";
|
||||
|
||||
vi.mock("@/lib/context/SupabaseProvider/supabase-provider", () => ({
|
||||
SupabaseContext: SupabaseContextMock,
|
||||
}));
|
||||
|
||||
import { ChatsList } from "../index";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
vi.mock("next/navigation", async () => {
|
||||
const actual = await vi.importActual<typeof import("next/navigation")>(
|
||||
"next/navigation"
|
||||
);
|
||||
|
||||
return { ...actual, useRouter: () => ({ replace: vi.fn() }) };
|
||||
});
|
||||
|
||||
vi.mock("@/lib/context/ChatsProvider/hooks/useChatsContext", () => ({
|
||||
useChatsContext: () => ({
|
||||
allChats: [
|
||||
{
|
||||
chat_id: 1,
|
||||
name: "Chat 1",
|
||||
creation_time: new Date().toISOString(),
|
||||
},
|
||||
{
|
||||
chat_id: 2,
|
||||
name: "Chat 2",
|
||||
creation_time: new Date().toISOString(),
|
||||
},
|
||||
],
|
||||
|
||||
deleteChat: vi.fn(),
|
||||
setAllChats: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/hooks", async () => {
|
||||
const actual = await vi.importActual<typeof import("@/lib/hooks")>(
|
||||
"@/lib/hooks"
|
||||
);
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useAxios: () => ({
|
||||
axiosInstance: vi.fn(),
|
||||
}),
|
||||
};
|
||||
});
|
||||
vi.mock("@/lib/context/ChatProvider/ChatProvider", () => ({
|
||||
ChatContext: ChatContextMock,
|
||||
}));
|
||||
vi.mock("@/lib/context/BrainProvider/brain-provider", () => ({
|
||||
BrainContext: BrainContextMock,
|
||||
}));
|
||||
|
||||
const mockUseSupabase = vi.fn(() => ({
|
||||
session: {
|
||||
user: { email: "email@domain.com" },
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/context/SupabaseProvider", () => ({
|
||||
useSupabase: () => mockUseSupabase(),
|
||||
}));
|
||||
|
||||
describe("ChatsList", () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("should render correctly", () => {
|
||||
const { getByTestId } = render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<KnowledgeToFeedProvider>
|
||||
<ChatProviderMock>
|
||||
<BrainProviderMock>
|
||||
<MenuProvider>
|
||||
<ChatsList />
|
||||
</MenuProvider>
|
||||
</BrainProviderMock>
|
||||
</ChatProviderMock>
|
||||
</KnowledgeToFeedProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
const chatsList = getByTestId("chats-list");
|
||||
expect(chatsList).toBeDefined();
|
||||
});
|
||||
|
||||
it("renders the chats list with correct number of items", () => {
|
||||
render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<KnowledgeToFeedProvider>
|
||||
<ChatProviderMock>
|
||||
<BrainProviderMock>
|
||||
<MenuProvider>
|
||||
<ChatsList />
|
||||
</MenuProvider>
|
||||
</BrainProviderMock>
|
||||
</ChatProviderMock>
|
||||
</KnowledgeToFeedProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
const chatItems = screen.getAllByTestId("chats-list-item");
|
||||
expect(chatItems).toHaveLength(2);
|
||||
});
|
||||
});
|
@ -1,19 +0,0 @@
|
||||
import { ChatsListItem } from "@/lib/components/ChatsListItem";
|
||||
import { useOnboardingTracker } from "@/lib/hooks/useOnboardingTracker";
|
||||
|
||||
import { useWelcomeChat } from "./hooks/useWelcomeChat";
|
||||
|
||||
export const WelcomeChat = (): JSX.Element => {
|
||||
const { chat, handleWelcomeChatDelete } = useWelcomeChat();
|
||||
const { trackOnboardingEvent } = useOnboardingTracker();
|
||||
|
||||
return (
|
||||
<div onClick={() => trackOnboardingEvent("WELCOME_CHAT_CLICKED")}>
|
||||
<ChatsListItem
|
||||
onDelete={() => void handleWelcomeChatDelete()}
|
||||
editable={false}
|
||||
chat={chat}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
@ -1,28 +0,0 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { ChatEntity } from "@/app/chat/[chatId]/types";
|
||||
import { useOnboarding } from "@/lib/hooks/useOnboarding";
|
||||
import { useOnboardingTracker } from "@/lib/hooks/useOnboardingTracker";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export const useWelcomeChat = () => {
|
||||
const { t } = useTranslation("chat");
|
||||
const { updateOnboarding } = useOnboarding();
|
||||
const { trackOnboardingEvent } = useOnboardingTracker();
|
||||
|
||||
const chat: ChatEntity = {
|
||||
chat_name: t("welcome"),
|
||||
// @ts-expect-error because we don't need to pass all the props
|
||||
chat_id: "",
|
||||
};
|
||||
|
||||
const handleWelcomeChatDelete = () => {
|
||||
trackOnboardingEvent("WELCOME_CHAT_DELETED");
|
||||
void updateOnboarding({ onboarding_a: false });
|
||||
};
|
||||
|
||||
return {
|
||||
chat,
|
||||
handleWelcomeChatDelete,
|
||||
};
|
||||
};
|
@ -1 +0,0 @@
|
||||
export * from "./WelcomeChat";
|
@ -1,21 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { ChatHistory } from "@/lib/components/ChatHistory/ChatHistory";
|
||||
import { useOnboarding } from "@/lib/hooks/useOnboarding";
|
||||
|
||||
import { WelcomeChat } from "./components/WelcomeChat";
|
||||
|
||||
export const ChatsList = (): JSX.Element => {
|
||||
const { shouldDisplayWelcomeChat } = useOnboarding();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col flex-1 h-full" data-testid="chats-list">
|
||||
{shouldDisplayWelcomeChat && (
|
||||
<div className="pt-2">
|
||||
<WelcomeChat />
|
||||
</div>
|
||||
)}
|
||||
<ChatHistory />
|
||||
</div>
|
||||
);
|
||||
};
|
@ -1,83 +0,0 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuChevronRight, LuSettings } from "react-icons/lu";
|
||||
import { MdCheck } from "react-icons/md";
|
||||
|
||||
import { Modal } from "@/lib/components/ui/Modal";
|
||||
import { defineMaxTokens } from "@/lib/helpers/defineMaxTokens";
|
||||
|
||||
import { useConfigModal } from "./hooks/useConfigModal";
|
||||
import { Button } from "../Button";
|
||||
|
||||
export const ConfigModal = (): JSX.Element => {
|
||||
const {
|
||||
handleSubmit,
|
||||
isConfigModalOpen,
|
||||
setIsConfigModalOpen,
|
||||
register,
|
||||
maxTokens,
|
||||
model,
|
||||
accessibleModels,
|
||||
} = useConfigModal();
|
||||
const { t } = useTranslation(["config", "chat"]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
Trigger={
|
||||
<Button
|
||||
label={t("chat:parameters")}
|
||||
startIcon={<LuSettings size={18} />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
className="w-full"
|
||||
/>
|
||||
}
|
||||
title="Chat configuration"
|
||||
desc="Adjust your chat settings"
|
||||
isOpen={isConfigModalOpen}
|
||||
setOpen={setIsConfigModalOpen}
|
||||
CloseTrigger={<div />}
|
||||
>
|
||||
<form className="mt-10 flex flex-col items-center gap-2">
|
||||
<fieldset className="w-full flex flex-col">
|
||||
<label className="flex-1 text-sm" htmlFor="model">
|
||||
{t("modelLabel")}
|
||||
</label>
|
||||
<select
|
||||
{...register("model")}
|
||||
className="px-5 py-2 dark:bg-gray-700 bg-gray-200 rounded-md"
|
||||
>
|
||||
<option value="">{t("modelLabel")}</option>
|
||||
{accessibleModels.map((availableModel) => (
|
||||
<option value={availableModel} key={availableModel}>
|
||||
{availableModel}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset className="w-full flex mt-4">
|
||||
<label className="flex-1" htmlFor="tokens">
|
||||
Max tokens: {maxTokens}
|
||||
</label>
|
||||
<input
|
||||
type="range"
|
||||
min="10"
|
||||
max={defineMaxTokens(model)}
|
||||
value={maxTokens}
|
||||
{...register("maxTokens")}
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<Button
|
||||
className="mt-12 self-end text-white"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
handleSubmit();
|
||||
setIsConfigModalOpen(false);
|
||||
}}
|
||||
variant={"primary"}
|
||||
label="Save"
|
||||
endIcon={<MdCheck className="text-xl" />}
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
};
|
@ -1,78 +0,0 @@
|
||||
/* eslint-disable max-lines */
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import { useLocalStorageChatConfig } from "@/app/chat/[chatId]/hooks/useLocalStorageChatConfig";
|
||||
import { saveChatsConfigInLocalStorage } from "@/lib/api/chat/chat.local";
|
||||
import { ChatConfig } from "@/lib/context/ChatProvider/types";
|
||||
import { getAccessibleModels } from "@/lib/helpers/getAccessibleModels";
|
||||
import { useToast } from "@/lib/hooks";
|
||||
import { useUserData } from "@/lib/hooks/useUserData";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export const useConfigModal = () => {
|
||||
const { publish } = useToast();
|
||||
const [isConfigModalOpen, setIsConfigModalOpen] = useState(false);
|
||||
const { chatConfig } = useLocalStorageChatConfig();
|
||||
const { userData } = useUserData();
|
||||
|
||||
const { register, watch, setValue } = useForm<ChatConfig>({
|
||||
defaultValues: {
|
||||
model: chatConfig.model,
|
||||
temperature: chatConfig.temperature ?? 0,
|
||||
maxTokens: chatConfig.maxTokens ?? 3000,
|
||||
},
|
||||
});
|
||||
|
||||
const model = watch("model");
|
||||
|
||||
const temperature = watch("temperature");
|
||||
const maxTokens = watch("maxTokens");
|
||||
|
||||
const accessibleModels = getAccessibleModels({
|
||||
userData,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (chatConfig.model !== undefined) {
|
||||
setValue("model", chatConfig.model);
|
||||
}
|
||||
if (chatConfig.temperature !== undefined) {
|
||||
setValue("temperature", chatConfig.temperature);
|
||||
}
|
||||
if (chatConfig.maxTokens !== undefined) {
|
||||
setValue("maxTokens", chatConfig.maxTokens);
|
||||
}
|
||||
}, [chatConfig.maxTokens, chatConfig.model, chatConfig.temperature]);
|
||||
|
||||
const handleSubmit = useCallback(() => {
|
||||
try {
|
||||
saveChatsConfigInLocalStorage({
|
||||
maxTokens,
|
||||
model: model.length > 0 ? model : undefined,
|
||||
temperature,
|
||||
});
|
||||
|
||||
publish({
|
||||
variant: "success",
|
||||
text: "Chat config successfully updated",
|
||||
});
|
||||
} catch (err) {
|
||||
publish({
|
||||
variant: "danger",
|
||||
text: "An error occurred while updating chat config",
|
||||
});
|
||||
}
|
||||
}, [maxTokens, model, publish, temperature]);
|
||||
|
||||
return {
|
||||
isConfigModalOpen,
|
||||
setIsConfigModalOpen,
|
||||
handleSubmit,
|
||||
register,
|
||||
model,
|
||||
temperature,
|
||||
maxTokens,
|
||||
accessibleModels,
|
||||
};
|
||||
};
|
@ -1 +0,0 @@
|
||||
export * from "./ConfigModal";
|
@ -1,21 +0,0 @@
|
||||
import { LuChevronRight } from "react-icons/lu";
|
||||
|
||||
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
||||
|
||||
import { useFeedCardTrigger } from "./hooks/useFeedCardTrigger";
|
||||
import { Button } from "../Button";
|
||||
|
||||
export const FeedCardTrigger = (): JSX.Element => {
|
||||
const { setShouldDisplayFeedCard } = useKnowledgeToFeedContext();
|
||||
const { label, Icon } = useFeedCardTrigger();
|
||||
|
||||
return (
|
||||
<Button
|
||||
label={label}
|
||||
startIcon={<Icon size={18} />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
className="w-full"
|
||||
onClick={() => setShouldDisplayFeedCard(true)}
|
||||
/>
|
||||
);
|
||||
};
|
@ -1,27 +0,0 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuFilePlus } from "react-icons/lu";
|
||||
|
||||
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
||||
|
||||
import { useFeedCardTriggerUtils } from "./useFeedCardTriggerUtils";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export const useFeedCardTrigger = () => {
|
||||
const { t } = useTranslation(["chat", "brain"]);
|
||||
|
||||
const feedCardButtonDefaultLabel = t("chat:add_document");
|
||||
const feedCardButtonDefaultIcon = LuFilePlus;
|
||||
const { brainTypeToIcon, brainTypeToLabel } = useFeedCardTriggerUtils();
|
||||
const { currentBrain } = useBrainContext();
|
||||
|
||||
const isBrainTypeDefined = currentBrain?.brain_type !== undefined;
|
||||
|
||||
return {
|
||||
label: isBrainTypeDefined
|
||||
? brainTypeToLabel[currentBrain.brain_type]
|
||||
: feedCardButtonDefaultLabel,
|
||||
Icon: isBrainTypeDefined
|
||||
? brainTypeToIcon[currentBrain.brain_type]
|
||||
: feedCardButtonDefaultIcon,
|
||||
};
|
||||
};
|
@ -1,27 +0,0 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { IconType } from "react-icons/lib";
|
||||
import { LuBot, LuFilePlus, LuUnlock } from "react-icons/lu";
|
||||
|
||||
import { BrainType } from "@/lib/types/BrainConfig";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export const useFeedCardTriggerUtils = () => {
|
||||
const { t } = useTranslation(["chat", "brain"]);
|
||||
|
||||
const brainTypeToLabel: Record<BrainType, string> = {
|
||||
doc: t("chat:add_document"),
|
||||
api: t("brain:update_secrets_button"),
|
||||
composite: t("brain:manage_brain"),
|
||||
};
|
||||
|
||||
const brainTypeToIcon: Record<BrainType, IconType> = {
|
||||
doc: LuFilePlus,
|
||||
api: LuUnlock,
|
||||
composite: LuBot,
|
||||
};
|
||||
|
||||
return {
|
||||
brainTypeToIcon,
|
||||
brainTypeToLabel,
|
||||
};
|
||||
};
|
@ -1 +0,0 @@
|
||||
export * from "./FeedCardTrigger";
|
@ -1,18 +0,0 @@
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
||||
|
||||
export const SelectedBrainTag = (): JSX.Element => {
|
||||
const { currentBrain } = useBrainContext();
|
||||
if (currentBrain === undefined) {
|
||||
return <Fragment />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mb-4 flex items-center justify-center w-full">
|
||||
<div className="px-3 py-1 w-content bg-accent-hover rounded-full flex items-center justify-center text-white">
|
||||
#{currentBrain.name}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
|
||||
import { OnboardingQuestions } from "./components";
|
||||
import { ActionsModal } from "./components/ActionsModal/ActionsModal";
|
||||
import { ChatEditor } from "./components/ChatEditor/ChatEditor";
|
||||
import { useChatInput } from "./hooks/useChatInput";
|
||||
|
||||
@ -26,7 +25,6 @@ export const ChatInput = (): JSX.Element => {
|
||||
}}
|
||||
className="sticky bottom-0 bg-white dark:bg-black w-full flex items-center gap-2 z-20 p-2"
|
||||
>
|
||||
|
||||
<div className="flex flex-1">
|
||||
<ChatEditor
|
||||
message={message}
|
||||
@ -46,7 +44,6 @@ export const ChatInput = (): JSX.Element => {
|
||||
? t("thinking", { ns: "chat" })
|
||||
: t("chat", { ns: "chat" })}
|
||||
</Button>
|
||||
<ActionsModal />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@ import { usePathname } from "next/navigation";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuBrain, LuChevronRight } from "react-icons/lu";
|
||||
|
||||
import { Button } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button";
|
||||
import { MenuButton } from "@/lib/components/Menu/components/MenuButton";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const BrainsManagementButton = (): JSX.Element => {
|
||||
@ -14,7 +14,7 @@ export const BrainsManagementButton = (): JSX.Element => {
|
||||
|
||||
return (
|
||||
<Link href={`/brains-management`}>
|
||||
<Button
|
||||
<MenuButton
|
||||
label={t("brains")}
|
||||
startIcon={<LuBrain />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
|
@ -3,7 +3,7 @@ import { usePathname } from "next/navigation";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuChevronRight, LuSearch } from "react-icons/lu";
|
||||
|
||||
import { Button } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button";
|
||||
import { MenuButton } from "@/lib/components/Menu/components/MenuButton";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const DiscussionButton = (): JSX.Element => {
|
||||
@ -13,7 +13,7 @@ export const DiscussionButton = (): JSX.Element => {
|
||||
|
||||
return (
|
||||
<Link href="/search">
|
||||
<Button
|
||||
<MenuButton
|
||||
label={t("search")}
|
||||
startIcon={<LuSearch />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
|
@ -3,7 +3,7 @@ import { usePathname } from "next/navigation";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuChevronRight, LuGlobe } from "react-icons/lu";
|
||||
|
||||
import { Button } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button";
|
||||
import { MenuButton } from "@/lib/components/Menu/components/MenuButton";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const ExplorerButton = (): JSX.Element => {
|
||||
@ -13,7 +13,7 @@ export const ExplorerButton = (): JSX.Element => {
|
||||
|
||||
return (
|
||||
<Link href={`/brains-management/library`}>
|
||||
<Button
|
||||
<MenuButton
|
||||
label={t("brain_library_button_label")}
|
||||
startIcon={<LuGlobe />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
|
@ -13,7 +13,7 @@ type ButtonProps = CoreButtonProps & {
|
||||
endIcon?: JSX.Element;
|
||||
};
|
||||
|
||||
export const Button = forwardRef(
|
||||
export const MenuButton = forwardRef(
|
||||
(
|
||||
{ onClick, className, label, startIcon, endIcon, ...props }: ButtonProps,
|
||||
forwardedRef
|
||||
@ -39,4 +39,4 @@ export const Button = forwardRef(
|
||||
}
|
||||
);
|
||||
|
||||
Button.displayName = CoreButton.displayName;
|
||||
MenuButton.displayName = CoreButton.displayName;
|
@ -3,7 +3,7 @@ import { usePathname } from "next/navigation";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuChevronRight, LuSettings } from "react-icons/lu";
|
||||
|
||||
import { Button } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button";
|
||||
import { MenuButton } from "@/lib/components/Menu/components/MenuButton";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const ParametersButton = (): JSX.Element => {
|
||||
@ -13,7 +13,7 @@ export const ParametersButton = (): JSX.Element => {
|
||||
|
||||
return (
|
||||
<Link href="/user">
|
||||
<Button
|
||||
<MenuButton
|
||||
label={t("parameters")}
|
||||
startIcon={<LuSettings />}
|
||||
endIcon={<LuChevronRight size={18} />}
|
||||
|
@ -1,12 +1,12 @@
|
||||
import Link from "next/link";
|
||||
import { LuChevronRight, LuUser } from "react-icons/lu";
|
||||
|
||||
import { Button } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button";
|
||||
import { MenuButton } from "@/lib/components/Menu/components/MenuButton";
|
||||
|
||||
export const ProfileButton = (): JSX.Element => {
|
||||
return (
|
||||
<Link href="/user">
|
||||
<Button
|
||||
<MenuButton
|
||||
label="Profile"
|
||||
startIcon={
|
||||
<div className="p-3 bg-secondary text-primary rounded-full">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LuStar } from "react-icons/lu";
|
||||
|
||||
import { Button } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button";
|
||||
import { MenuButton } from "@/lib/components/Menu/components/MenuButton";
|
||||
import { StripePricingModal } from "@/lib/components/Stripe";
|
||||
import { useUserData } from "@/lib/hooks/useUserData";
|
||||
|
||||
@ -17,7 +17,7 @@ export const UpgradeToPlus = (): JSX.Element => {
|
||||
return (
|
||||
<StripePricingModal
|
||||
Trigger={
|
||||
<Button
|
||||
<MenuButton
|
||||
startIcon={<LuStar size={24} />}
|
||||
label={t("upgrade")}
|
||||
endIcon={
|
||||
|
@ -10,7 +10,7 @@ export const StripePricingTable = (): JSX.Element => {
|
||||
<ul className="list-none space-y-2">
|
||||
<li className="text-lg font-medium text-gray-800">🧠 3 brains</li>
|
||||
<li className="text-lg font-medium text-gray-800">
|
||||
🙋♂️ 20 question credits per day
|
||||
🙋♂️ 100 questions per month
|
||||
</li>
|
||||
<li className="text-lg font-medium text-gray-800">
|
||||
💾 Up to 30Mb of storage
|
||||
|
@ -20,7 +20,7 @@ export const SearchBar = (): JSX.Element => {
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentBrainId(null);
|
||||
});
|
||||
}, [setCurrentBrainId]);
|
||||
|
||||
const submit = async (): Promise<void> => {
|
||||
setSearching(true);
|
||||
|
@ -8,7 +8,7 @@ export interface UserStats {
|
||||
email: string;
|
||||
max_brain_size: number;
|
||||
current_brain_size: number;
|
||||
daily_chat_credit: number;
|
||||
monthly_chat_credit: number;
|
||||
requests_stats: RequestStat[];
|
||||
date: string;
|
||||
models: string[];
|
||||
|
9
supabase/migrations/20240122194117_monthly-credit.sql
Normal file
9
supabase/migrations/20240122194117_monthly-credit.sql
Normal file
@ -0,0 +1,9 @@
|
||||
alter table "public"."product_to_features" drop column "daily_chat_credit";
|
||||
|
||||
alter table "public"."product_to_features" add column "monthly_chat_credit" integer not null default 20;
|
||||
|
||||
alter table "public"."user_settings" drop column "daily_chat_credit";
|
||||
|
||||
alter table "public"."user_settings" add column "monthly_chat_credit" integer default 100;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user