Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 4.13 KB

File metadata and controls

65 lines (45 loc) · 4.13 KB

Dev Documentation of QueryVerify

IMPORTANT

  • If you will move queue processor from db to redis, make sure that UserJobLimiter is also fixed

Frontend

  • Landing page uses blade, and other part uses Inertia Vue SPA.
  • in resources/js/store we have used Pinia Store Management
  • We use ready to use Laravel's 12 Vue js, Starter kit, that uses reka-ui. Global reusable components of reka-ui is located in js/components.
  • in js/components_project we have project componenets. It is like Services. First if we need new page, we create new file in js/pages, then we create in componets_project new components to isolate some logic to aquire SPR (single principle responsibility)

Feedback will be dark as standart because user can go from landing

Backend

  • We are using Controllers and Services

  • in AiCHat we have used Strategy Pattern for Responses. Registered in ServiceProvider In Factories we have strategy resolving logic

  • We have integration with N8N service in app/Services/N8N/ApiRequestsN8N.php.

  • in .env if you make true IS_FAKE_RESPONSES_ENABLED parameter, then you will get mock/test response from N8N, and test entire chat functionality.

  • We have free_prompts column in users table. And in every request it will be decremented. If you want to test locally you should increase manually from db this value for your test user.

  • For Tests we have used pest framework.

  • We use Mailpit for email local testing just call localhost:8025 and UI will be available.

  • Currently we will not use API key feature, instead we will use credit based and monhtly pricing system

  • Currently we have commented SQL file upload, we will implement this feature in next version.

DB

  1. chat_histories save user input in user_input column and all unneccessary columns are empty. It save ai response in all columns except user_input.

N8N

Response

  1. We get different type of responses from N8N, and according to it we have different strategies to handle it. But all of them will return threadId. 1.1 Success return array with "actualSolution","mockDataPreparation", "allTablesOfSession","executionResult", "detailsErrorLoop", "threadId" 1.2 Error return array with "message", "threadId" 1.3 WordsForUser return array with "message", "threadId" 1.4 MaxAutoErrorLimitReached return "actualSolution" and "detailsErrorLoop", "threadId" 1.5 SecurityProblem return "message", "threadId" 1.6 AskUserHowToHandleErrorResponse return "message" and "error", "threadId"

VERY IMPORTANT

  1. In N8N details are not the same with details in UI. details in N8N is used only for error loop details.

Feedbacks

  1. feedback is the same FeatureRequest. The same entity

Coolify deployment

  1. Select N8n+PostgreSQL+Worker in Coolify Services. You can change TZ in environment varaibles. Default currently is Europe/Berlin. Press Deploy
  2. Select PgSql in Coolify Services.
  3. Go to Servers, Select your Server, go to Destinations in sidebar, and click Scan For Destinations. You should see that new network is available, click to add. It is the network of N8N + Worker + Postgres + Redis
  4. https://coolify.io/docs/knowledge-base/docker/compose#connect-to-predefined-networks so go to https://coolify.io/docs/knowledge-base/docker/compose#connect-to-predefined-networks
  5. Go to the Terminal of your Server in Coolify. Because our containers are running we should add container to network with : docker network connect my-custom-network my-running-container
  6. Check the permission of Laravel folder. If it is root then chown to www-data
  7. Enable Healthcheck in Laravel app. Just change Path to /up. Other thing are good by default. Save and Enable Healthcheck. If you will get problems in future the debugging steps are clear in Coolify docs: https://coolify.io/docs/troubleshoot/applications/no-available-server . Healthcheck docs: https://coolify.io/docs/knowledge-base/health-checks
  8. In post-deployment commands in Laravel app paste this: php artisan optimize:clear && php artisan optimize && chown -R www-data:www-data * But Please ehceck by yourself always is folders was changed to www-data, because sometimes you should do it manually. Check what permission is for laravel.log