Connect Chat GPT to Yii2 and output the results through API in Yii2.
To the specified email, it is necessary to register an account in Chat GPT, save the access credentials appropriately in Redmine. Configure the operation of Chat GPT in such a way that when we call our API (implemented on Yii2), we can securely use the Chat GPT token and receive a response back in our API, which we will use on the front end. Also, for working with the API, we use Swagger, so it is very important that you have experience working with it from the backend side (without the ability to work with the API through Swagger, this work cannot be accepted).
Additionally, in our API, it is necessary to check whether a long string is not coming from the front end. We need to accept 1-2 words from the front end. (Most likely, during testing, we will be able to determine the appropriate string length and adjust it) to be agreed upon during the work process.
We need to use Chat GPT as a dictionary/wikipedia. On the front end, a person will click with the mouse on a specific word or phrase, we will send this to our API, then pass it to Chat GPT, and return the text to the front end.
The essence is to have a secure connection with Chat GPT, rather than connecting directly from the front end to it, as it is easy to seize the token from the front end.
If you have any clarifications - write, I would be very grateful, I will add them to the project. If you have similar experience in configuring chat for such a task - great.
It is very important: we work and best understand the process of time and materials evaluation, so to form an understanding of pricing, it is necessary to know the rate per hour and the estimated time for completing this task.
It will be necessary to interact with other team members. For task management, we use Redmine (understanding it is not mandatory, I will explain everything), for work correspondence Teams. Studios are requested not to disturb. I expect feedback more from middle or something in between middle and senior specialists for this project.
The Swagger is already installed and configured in the project, there is no need to install and configure from scratch. There is authorization, there are endpoints for user login, token refresh, and logout. It is also set up to work in 6 languages, 4 of which are already fully functional, while the others are waiting for translation by natives.
Сам Swagger вже встановлено та налаштовано на проекті, встановлювати та налаштовувати з 0 не потрібно. Є авторизація є endpoint`и на вхід користувача, оновлення токена та вихід. Також налаштована робота на 6 мов, 4 з яких уже повністю функціональні, інші чекають перекладу нейтівами.
> On the front end, a person will click on a specific word or phrase with the mouse, we will send this to our API, then pass it to Chat GPT, and return the text to the front end.
Important! This project is only about the backend; this project does not involve any work on the frontend. The frontend is handled by a separate team member. I quoted part of the description to draw attention to it. The mention of the frontend was made solely for the purpose of providing a holistic view of the use of this feature.
> На фронті, людина буде тицяти мишкою в конкретне слово чи словпосполучення, ми будемо надсилати це на наше апі, далі передавати на Chat GPT, і повертати на фронт текст.
Важливо! Цей проект тільки про backend, цим проектом роботи frontend`у ніяк не робляться. Фронтом займається окремий член команди. Процитував частину опису, щоб звернути на неї увагу. Про фронт було написано виключно із ціллю - цілічного бачення використання даної фічі.
Chat GPT, prompts: our service is a game for people studying Nutrition.
For example, there are "cards" with text:
- Did you know that… magnesium helps enzymes in the liver neutralize toxins and reduces inflammation?
- Antioxidants protect the liver from damage when processing toxins?
- With an excess of toxins and stress, the liver itself becomes a source of free radicals?
In the text above, the highlighted words:
- magnesium
- enzymeAM
- toxins
- inflammation
- antioxidants
- stressE
- freeRADICALS
These are the words that may be unclear to players who have just started to familiarize themselves with Nutrition, and for which explanations of their meanings in the context of the science of Nutrition are needed, in clear, accessible language.
Above, I highlighted the endings of words in uppercase to show that they are not always in the required form and will not always be in the required form for queries, for example, in Google (perhaps? this will also need to be adjusted additionally in the prompt)
Example:
What is a free radical? - this is one
What is freeRADICALS - this is already different...
Чат GPT, promt`и: наш сервіс - це гра для людей, що вивчають Нутріціологію.
Наприклад, є "картки", із текстом:
- А знали ли вы, что… магний помогает ферментам печени нейтрализовать токсины и снижает воспаление?
- Антиоксиданты защищают печень от повреждений при обработке токсинов?
- При избытке токсинов и стрессе печень сама становится источником свободных радикалов?
В тексті вище, виділені слова:
- магний
- ферментАМ
- токсины
- воспаление
- антиоксиданты
- стрессЕ
- свободнЫХ радикалОВ
Це ті слова, які можуть бути не зрозумілі гравцям, що тільки почали знайомитися із Нутріціологією, і за якими потрібно отримати пояснення їх значень в контексті науки Нутріціології, зрозумілою, доступною мовою.
Вище я капсом виділив закінчення слів, щоб показати, що вони не завжди є в потрібній формі і не завжди будуть у потрібній формі, для запросу наприклад в Google (можливо? це теж потрібно буде налаштовувати додатково в promt)
Приклад:
Что такое свободый радикал? - це одне
Что такое свободнЫХ радикалОВ - це вже інше...
Caching responses for identical words, to reduce requests to GPT
Initially, there are 3 options envisioned:
- Follow-up caching (I personally am not very in favor of this type, as we may run into Linux limitations)
- In the database: create an md5 hash from the word, store it in a table with id, md5, and GPT explanation (do not use full-text search, but look for exact matches by md5, to avoid overloading the database with requests)
- Attach INDEX and UNIQUE to the words and language tag and then use %LIKE%
- At this stage, "semantic caching" is not being considered
- Your option
In any case, I am ready to hear your thoughts on the best of the above options, or an alternative that would be better than the ones described above.
Кешування відповідей для однакових слів, для зменшення запросів до GPT
Попередньо є бачення 3 варіантів:
- Фалойве кешування (я особисто не дуже за цей тип, бо можемо впертися обмеження linux)
- В БД: із слова зробити md5 хеш, зберегти в таблицю id, md5, та пояснення GPT (не використовувати повнотекстовий пошук, а шукати чітке співпадіння по md5, щоб також не перенавантажувати запитами БД)
- На слова та тег мови провісити INDEX та UNIQUE і далі використовувати %LIKE%
- На даному етапі "симантичне кешування" не розглядаємо
- ваш варіант
В любому випадку, готовий почути вашу дуку за найкращий із вище вказаних варіантів, або альтернативний що буде краще ніж вище описані.
Data reception and transmission (Request, Responses) occurs in the form of JSON
Прийом та передача даних (Request, Responses) має відбувається у вигляді JSON
-
Ось чорновий варіант уже зробив. Залишається додати нюанси.

Помилки:

Запитання:
1. Написи для документації які
2. чи треба перевіряти символи (перевірку слів та довжину шкірного слова додано).
3. Є формат відповіді який треба обов'язково зробити (для відповіді та помилок)?
Якщо вам потрібний новий аккаунт на платформі чату жпт то треба емайл
Ну і для того щоб додати модуль потрібно буде доступ до проекту
Якщо є питання, пишіть.
-
ще:
Я не знаю де саме він буде використовуватися, якщо можна посилання дайте сайту, де буде працювати.
Завтра після 12-го буду вдома і можу доробити все. зараз 1:00 вийшло.
Також у майбутньому для скорочення витрат та безпеки можна ще:
1. додати кешування відповідей у внутрішню базу, або вбудований файловий кеш
2. Додати якийсь елемент безпеки щоб трохи ускладнити просес запитів від сторонніх ботів.
-
ще:
Я не знаю де саме він буде використовуватися, якщо можна посилання дайте сайту, де буде працювати.
Завтра після 12-го буду вдома і можу доробити все. зараз 1:00 вийшло.
Також у майбутньому для скорочення витрат та безпеки можна ще:
1. додати кешування відповідей у внутрішню базу, або вбудований файловий кеш
2. Додати якийсь елемент безпеки щоб трохи ускладнити просес запитів від сторонніх ботів.
-
Serhii Melnichuk Web сторона
> довжину шкірного слова додано
слово "шкірного" не зрозуміло
також на скрінах ви обрізали частину Swagger`у, не видно чи у вашому є авторизація, зазвичай є іконка замочку, бо в нас своя авторизація є
-
Serhii Melnichuk Web сторона
інше в особистих
-
також для вхіда у ігпу трнба спонсорска ссилка, чи ааторізація.
я подивився апи, там є авторізація, то є гарно . також бачу декілька язиків, то треба буде додавати ще функцвонал язмка, бо і під кожний язик треба свій промпт та свій префікс запросу.бо від промпта залежить язик відповіді.
також є ще момент - я додаю налаштування через конфіг файл .env но я також не знаю чи використовуєтьця це у вас. якщо що, я перенесу налашиування у файл - конфіг який буде в папці молуля .
також ви просите налаштування чата, но там немає особливих налаштувань, бо в апі ви тільки відкриваєте проєкт та створюєте особистий ключь. всі налаштування використовуються при запросах через промпт, тож треба мати на увазі бо промпт в вашому випадку буде відправлятися при кожному запросі. а то якщо 10 раз у день, то ще терпимо, але якщо у вас там двіж , то вже буде білш накладно , бо всі запроси рахуются токенами і сплачуються. тож ваш промпт буде кожен раз відправлен. можно промпт не робити великим, но від нього залежить відповідь. то вже треба буде оптімально підбирати , тому він винесен окремо у налаштування.
-
завтра я після 17 зможу вийти на зв'язок .
-
по авторизації у гру вже все гаразд.
-
хоча не все. я заходжу в аккаунт але там на мобілі нічого не працює 😔
-
Current freelance projects in the category PHP
Developer for CMS website project on Drupal 7 + PHP/MySQL.We are looking for a developer to assist with the setup of a CMS site on Drupal 7 + PHP/MySQL. Task:1. Create product cards for the entire range of products (currently, not all products on the site have product cards with descriptions and characteristics).2. Add correct… Content Management Systems, PHP ∙ 1 day back ∙ 38 proposals |
Looking for a Bitrix24 specialist / CRM integrator to set up automation.Our company works with CRM Bitrix24. We need a specialist who can set up automatic addition of phone numbers to leads/orders in two formats. Automation must be correctly configured for two countries: the Republic of Moldova and Romania. Task: When creating a lead or order in… PHP, Web Programming ∙ 1 day 22 hours back ∙ 24 proposals |
Website optimizationOptimization of the website jdgreta.co.uk on Shopify. SEO audit attached to the project. Main tasks - - Fix all meta data - Complete the technical specifications for the programmer (since this project combines tasks for both the programmer and SEO, if you are not a company -… HTML & CSS, PHP ∙ 2 days 18 hours back ∙ 32 proposals |
Horoshop SpecialistNeed a specialist who can correctly set up the product Feed. Problem: Currently, over 13,000 products are being uploaded with the same type value (e.g., "everything for manicure and pedicure"). Because of this, it is impossible to segment products in Google Ads and set different… PHP, Website Maintenance ∙ 3 days 21 hours back ∙ 21 proposals |
Make sure that order emails from the store do not go to spam.Currently, there is a store on OpenCart, and order emails are landing in spam. We need to ensure they go to Inbox (ukr.net gmail) and check it. The hosting provider wrote: Poor email delivery may be related to a low sender reputation - IP or domain. In this case, we can advise… PHP, Web Programming ∙ 4 days 22 hours back ∙ 47 proposals |