{"id":346799,"date":"2023-03-15T21:02:31","date_gmt":"2023-03-15T21:02:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346799"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346799","title":{"rendered":"<span>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u0439 \u0447\u0430\u0442 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u043d\u0430 Tawk + Notion + Telegram + chatGPT + GPT-Index<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u043d\u043b\u0430\u0439\u043d-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 &#8212; \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0431\u0438\u0437\u043d\u0435\u0441\u043e\u0432. \u041e\u043d\u043b\u0430\u0439\u043d-\u0447\u0430\u0442 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0438\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>\u042f \u0441\u043b\u0435\u0434\u0438\u043b \u0437\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0432\u0438\u0434\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f chatGPT \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0435\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0430. \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0434\u0430\u043b\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044f \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0443\u043c\u0430\u044e \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c.<\/p>\n<h3>\u0424\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p><strong>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d-\u0447\u0430\u0442\u0430 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u043b\u044e\u0431\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u0430\u0440\u0438\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f \u0443 chatGPT, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h3>\u0428\u0430\u0433 \u21161: \u0412\u044b\u0431\u043e\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043e\u043d\u043b\u0430\u0439\u043d-\u0447\u0430\u0442\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c.<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043b \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"http:\/\/Tawk.to\" rel=\"noopener noreferrer nofollow\">Tawk.to<\/a>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u044d\u0442\u0438 \u0434\u0432\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ddf\/698\/078\/ddf6980785a5b69755b693160ad26d9a.png\" width=\"876\" height=\"477\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ddf\/698\/078\/ddf6980785a5b69755b693160ad26d9a.png\"\/><\/figure>\n<h3>\u0428\u0430\u0433 \u21162: \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 chatGPT<\/h3>\n<p>\u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<p><strong>?\ufe0f\u00a0LlamaIndex\u00a0?\u00a0(GPT Index)<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/jerryjliu\/llama_index\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/jerryjliu\/llama_index<\/a><\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/p>\n<pre><code class=\"python\">!pip install llama-index  import os os.environ[\"OPENAI_API_KEY\"] = 'YOUR_OPENAI_API_KEY'  from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader documents = SimpleDirectoryReader('data').load_data() index = GPTSimpleVectorIndex(documents)  # save to disk index.save_to_disk('index.json') # load from disk index = GPTSimpleVectorIndex.load_from_disk('index.json')  index.query(\"&lt;question_text>?\")<\/code><\/pre>\n<p> \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"markdown\"># auras.txt  AURA Services  AURA Services, based in Tel Aviv, Israel, is a platform that mediates between local partner performers and clients and focused on short-term local services.  AURA do marketing and local advertisement to promote local partner performers.  The company acts as a broker and charges a commission from local partner performers for promotion of each service for clients.<\/code><\/pre>\n<h3>\u0428\u0430\u0433 \u21163: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0431\u0430\u0437\u044b \u0432 Notion<\/h3>\n<p>\u0412\u0441\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 Notion.<\/p>\n<p>\u0412\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<p><a href=\"https:\/\/candied-cactus-f66.notion.site\/9cc1b8d874244cc0bef06d6de762d8df\" rel=\"noopener noreferrer nofollow\">https:\/\/candied-cactus-f66.notion.site\/9cc1b8d874244cc0bef06d6de762d8df<\/a><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f77\/376\/84d\/f7737684d70d59bf7d7744075784e4e0.png\" width=\"976\" height=\"716\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f77\/376\/84d\/f7737684d70d59bf7d7744075784e4e0.png\"\/><\/figure>\n<p> \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:  <\/p>\n<p><a href=\"https:\/\/notionso.ru\/kb\/sozdanie-integratsiy-s-pomoschyu-api-notion\/\" rel=\"noopener noreferrer nofollow\">https:\/\/notionso.ru\/kb\/sozdanie-integratsiy-s-pomoschyu-api-notion\/<\/a><\/p>\n<p> \u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 Notion:  <\/p>\n<pre><code class=\"python\">def insertDatabase(databaseId, record, token):     headers = {         \"Accept\": \"application\/json\",         \"Authorization\": \"Bearer \" + token,         \"Content-Type\": \"application\/json\",         \"Notion-Version\": \"2021-05-13\",     }     createUrl = \"https:\/\/api.notion.com\/v1\/pages\"     data = json.dumps(record)     res = requests.request(\"POST\", createUrl, headers=headers, data=data)     return res<\/code><\/pre>\n<p> \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443:  <\/p>\n<pre><code class=\"python\">record = {\"parent\": { \"database_id\": notion_DB_id },\"properties\": {}} record['properties']['URL'] = {\"title\": [{\"text\": {\"content\": \"https:\/\/aura-s.com\/\"}}]} record['properties']['Message'] = {\"rich_text\": [{\"text\": {\"content\": \"Hello World!\"}}]} record['properties']['chatGPT_reply_English'] = {\"rich_text\": [{\"text\": {\"content\": \"How i can help you?\"}}]} insertDatabase(databaseId, record, token)<\/code><\/pre>\n<h3>\u0428\u0430\u0433 \u21164: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430<\/h3>\n<p>\u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0431\u043e\u0442\u0430 @BotFather \u00a0\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0435\u043c\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \/start\u00a0\u0438\u043b\u0438 \/newbot, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u0431\u043e\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c, \u0432\u0432\u043e\u0434\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0442\u0432\u0435\u0442 \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0431\u043e\u0442\u0430 \u0438 \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0412\u0430\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u0432 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u0430\u043c\u0438 \u0438 \u0432\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c.<\/p>\n<h3>\u0428\u0430\u0433 \u21165: \u0417\u0430\u043f\u0443\u0441\u043a HTTP API \u043d\u0430 Flask<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0445 \u043e\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 Backend \u043d\u0430 Flask.<\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0442\u043e\u0447\u043a\u0430 \u0432\u0437\u043e\u0434\u0430 \u0432 API, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 chatGPT \u0438 \u043f\u0440\u043e\u0441\u0438\u0442 \u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 3-\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442 \u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Notion.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e API:<\/p>\n<pre><code class=\"python\">from flask import Flask, render_template, redirect, url_for, request, session, jsonify from flask_cors import CORS from os import path import json import os import requests import datetime import openai import telebot  app = Flask(__name__) CORS(app)  # \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API \u0438\u0437 React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439  bot = telebot.TeleBot(config.tg_bot_key)      # \/api\/v1.0\/new_online_chat_message @app.route('\/api\/v1.0\/new_online_chat_message', methods=['GET']) def new_online_chat_message():     url = request.args.get(\"url\", '-')     message = request.args.get(\"message\", '-')     print('[START - new_online_chat_message]')     notion_DB_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'     record = {\"parent\": { \"database_id\": notion_DB_id },\"properties\": {}}     record['properties']['URL'] = {\"title\": [{\"text\": {\"content\": url}}]}     record['properties']['Message'] = {\"rich_text\": [{\"text\": {\"content\": message}}]}          # Ask chatGPT     reply = ''     if message != '-':         index = GPTSimpleVectorIndex.load_from_disk('\/wiki\/index.json')  # ID \u0447\u0430\u0442\u0430 \u0441 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u043e\u043c         chat_id = 'XXXXXXXXX'          # English         response = index.query(message + '. Answer in English', response_mode=\"compact\")         record['properties']['chatGPT_reply_English'] = {\"rich_text\": [{\"text\": {\"content\": response.response}}]}         reply = response.response         bot.send_message(chat_id, '??\\n' + reply)                  # Spanish         response = index.query(message + '. Answer in Spanish', response_mode=\"compact\")         record['properties']['chatGPT_reply_Spanish'] = {\"rich_text\": [{\"text\": {\"content\": response.response}}]}         reply = response.response         bot.send_message(chat_id, '??\\n' + reply)                  # German         response = index.query(message + '. Answer in German', response_mode=\"compact\")         record['properties']['chatGPT_reply_German'] = {\"rich_text\": [{\"text\": {\"content\": response.response}}]}         reply = response.response         bot.send_message(chat_id, '??\\n' + reply)          res = notion_api.insertDatabase(notion_DB_id, record, config.notion_token)     print(res, res.text)     ###     return reply  if __name__ == \"__main__\":     app.run(debug=True, host='0.0.0.0', port=5000)<\/code><\/pre>\n<h3>\u0428\u0430\u0433 \u21166: \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0437 \u0447\u0430\u0442\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043d\u0430 HTTP API<\/h3>\n<p>\u0418 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c &#8212; \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u0432\u0438\u0434\u0436\u0435\u0442 \u0447\u0430\u0442\u0430 <a href=\"http:\/\/Tawk.to\" rel=\"noopener noreferrer nofollow\">Tawk.to<\/a>:<\/p>\n<pre><code class=\"javascript\">&lt;!--Start of Tawk.to Script--> &lt;script type=\"text\/javascript\"> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement(\"script\"),s0=document.getElementsByTagName(\"script\")[0]; s1.async=true; s1.src='https:\/\/embed.tawk.to\/640e244831ebfa0fe7f220c1\/1grbjrffn'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })();   window.Tawk_API = window.Tawk_API || {}; window.Tawk_API.onChatMessageVisitor = function(message){   var x = new XMLHttpRequest(); x.open(\"GET\", \"https:\/\/\u0410\u0414\u0420\u0415\u0421_API\/api\/v1.0\/new_online_chat_message?url=aura-s.com&amp;message=\"+message, true); x.onload = function (){     alert( x.responseText); } x.send(null);    }; &lt;\/script> &lt;!--End of Tawk.to Script--><\/code><\/pre>\n<h2>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6410ac81200df56fc1a761de\" data-style=\"\" id=\"6410ac81200df56fc1a761de\" width=\"\"><\/div>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0435\u0433\u043e \u0433\u0434\u0435-\u0442\u043e, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043f\u0440\u043e \u044d\u0442\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u044f \u0433\u043e\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043c\u043e\u0439 <a href=\"https:\/\/t.me\/TAU15\" rel=\"noopener noreferrer nofollow\">\u0422\u0413<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/722388\/\"> https:\/\/habr.com\/ru\/post\/722388\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u043d\u043b\u0430\u0439\u043d-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 &#8212; \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0431\u0438\u0437\u043d\u0435\u0441\u043e\u0432. \u041e\u043d\u043b\u0430\u0439\u043d-\u0447\u0430\u0442 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0438\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>\u042f \u0441\u043b\u0435\u0434\u0438\u043b \u0437\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0432\u0438\u0434\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f chatGPT \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0435\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0430. \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0434\u0430\u043b\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044f \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0443\u043c\u0430\u044e \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c.<\/p>\n<h3>\u0424\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p><strong>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d-\u0447\u0430\u0442\u0430 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u043b\u044e\u0431\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u0430\u0440\u0438\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f \u0443 chatGPT, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h3>\u0428\u0430\u0433 \u21161: \u0412\u044b\u0431\u043e\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043e\u043d\u043b\u0430\u0439\u043d-\u0447\u0430\u0442\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c.<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043b \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"http:\/\/Tawk.to\" rel=\"noopener noreferrer nofollow\">Tawk.to<\/a>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u044d\u0442\u0438 \u0434\u0432\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0428\u0430\u0433 \u21162: \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 chatGPT<\/h3>\n<p>\u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<p><strong>?\ufe0f\u00a0LlamaIndex\u00a0?\u00a0(GPT Index)<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/jerryjliu\/llama_index\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/jerryjliu\/llama_index<\/a><\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/p>\n<pre><code class=\"python\">!pip install llama-index  import os os.environ[\"OPENAI_API_KEY\"] = 'YOUR_OPENAI_API_KEY'  from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader documents = SimpleDirectoryReader('data').load_data() index = GPTSimpleVectorIndex(documents)  # save to disk index.save_to_disk('index.json') # load from disk index = GPTSimpleVectorIndex.load_from_disk('index.json')  index.query(\"&lt;question_text>?\")<\/code><\/pre>\n<p> \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"markdown\"># auras.txt  AURA Services  AURA Services, based in Tel Aviv, Israel, is a platform that mediates between local partner performers and clients and focused on short-term local services.  AURA do marketing and local advertisement to promote local partner performers.  The company acts as a broker and charges a commission from local partner performers for promotion of each service for clients.<\/code><\/pre>\n<h3>\u0428\u0430\u0433 \u21163: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0431\u0430\u0437\u044b \u0432 Notion<\/h3>\n<p>\u0412\u0441\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 Notion.<\/p>\n<p>\u0412\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<p><a href=\"https:\/\/candied-cactus-f66.notion.site\/9cc1b8d874244cc0bef06d6de762d8df\" rel=\"noopener noreferrer nofollow\">https:\/\/candied-cactus-f66.notion.site\/9cc1b8d874244cc0bef06d6de762d8df<\/a><\/p>\n<figure class=\"full-width\"><\/figure>\n<p> \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:  <\/p>\n<p><a href=\"https:\/\/notionso.ru\/kb\/sozdanie-integratsiy-s-pomoschyu-api-notion\/\" rel=\"noopener noreferrer nofollow\">https:\/\/notionso.ru\/kb\/sozdanie-integratsiy-s-pomoschyu-api-notion\/<\/a><\/p>\n<p> \u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 Notion:  <\/p>\n<pre><code class=\"python\">def insertDatabase(databaseId, record, token):     headers = {         \"Accept\": \"application\/json\",         \"Authorization\": \"Bearer \" + token,         \"Content-Type\": \"application\/json\",         \"Notion-Version\": \"2021-05-13\",     }     createUrl = \"https:\/\/api.notion.com\/v1\/pages\"     data = json.dumps(record)     res = requests.request(\"POST\", createUrl, headers=headers, data=data)     return res<\/code><\/pre>\n<p> \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443:  <\/p>\n<pre><code class=\"python\">record = {\"parent\": { \"database_id\": notion_DB_id },\"properties\": {}} record['properties']['URL'] = {\"title\": [{\"text\": {\"content\": \"https:\/\/aura-s.com\/\"}}]} record['properties']['Message'] = {\"rich_text\": [{\"text\": {\"content\": \"Hello World!\"}}]} record['properties']['chatGPT_reply_English'] = {\"rich_text\": [{\"text\": {\"content\": \"How i can help you?\"}}]} insertDatabase(databaseId, record, token)<\/code><\/pre>\n<h3>\u0428\u0430\u0433 \u21164: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430<\/h3>\n<p>\u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0431\u043e\u0442\u0430 @BotFather \u00a0\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0435\u043c\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \/start\u00a0\u0438\u043b\u0438 \/newbot, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u0431\u043e\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c, \u0432\u0432\u043e\u0434\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0442\u0432\u0435\u0442 \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0431\u043e\u0442\u0430 \u0438 \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0412\u0430\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u0432 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u0430\u043c\u0438 \u0438 \u0432\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c.<\/p>\n<h3>\u0428\u0430\u0433 \u21165: \u0417\u0430\u043f\u0443\u0441\u043a HTTP API \u043d\u0430 Flask<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0445 \u043e\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 Backend \u043d\u0430 Flask.<\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0442\u043e\u0447\u043a\u0430 \u0432\u0437\u043e\u0434\u0430 \u0432 API, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 chatGPT \u0438 \u043f\u0440\u043e\u0441\u0438\u0442 \u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 3-\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442 \u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Notion.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e API:<\/p>\n<pre><code class=\"python\">from flask import Flask, render_template, redirect, url_for, request, session, jsonify from flask_cors import CORS from os import path import json import os import requests import datetime import openai import telebot  app = Flask(__name__) CORS(app)  # \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API \u0438\u0437 React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439  bot = telebot.TeleBot(config.tg_bot_key)      # \/api\/v1.0\/new_online_chat_message @app.route('\/api\/v1.0\/new_online_chat_message', methods=['GET']) def new_online_chat_message():     url = request.args.get(\"url\", '-')     message = request.args.get(\"message\", '-')     print('[START - new_online_chat_message]')     notion_DB_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'     record = {\"parent\": { \"database_id\": notion_DB_id },\"properties\": {}}     record['properties']['URL'] = {\"title\": [{\"text\": {\"content\": url}}]}     record['properties']['Message'] = {\"rich_text\": [{\"text\": {\"content\": message}}]}          # Ask chatGPT     reply = ''     if message != '-':         index = GPTSimpleVectorIndex.load_from_disk('\/wiki\/index.json')  # ID \u0447\u0430\u0442\u0430 \u0441 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u043e\u043c         chat_id = 'XXXXXXXXX'          # English         response = index.query(message + '. Answer in English', response_mode=\"compact\")         record['properties']['chatGPT_reply_English'] = {\"rich_text\": [{\"text\": {\"content\": response.response}}]}         reply = response.response         bot.send_message(chat_id, '??\\n' + reply)                  # Spanish         response = index.query(message + '. Answer in Spanish', response_mode=\"compact\")         record['properties']['chatGPT_reply_Spanish'] = {\"rich_text\": [{\"text\": {\"content\": response.response}}]}         reply = response.response         bot.send_message(chat_id, '??\\n' + reply)                  # German         response = index.query(message + '. Answer in German', response_mode=\"compact\")         record['properties']['chatGPT_reply_German'] = {\"rich_text\": [{\"text\": {\"content\": response.response}}]}         reply = response.response         bot.send_message(chat_id, '??\\n' + reply)          res = notion_api.insertDatabase(notion_DB_id, record, config.notion_token)     print(res, res.text)     ###     return reply  if __name__ == \"__main__\":     app.run(debug=True, host='0.0.0.0', port=5000)<\/code><\/pre>\n<h3>\u0428\u0430\u0433 \u21166: \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0437 \u0447\u0430\u0442\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043d\u0430 HTTP API<\/h3>\n<p>\u0418 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c &#8212; \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u0432\u0438\u0434\u0436\u0435\u0442 \u0447\u0430\u0442\u0430 <a href=\"http:\/\/Tawk.to\" rel=\"noopener noreferrer nofollow\">Tawk.to<\/a>:<\/p>\n<pre><code class=\"javascript\">&lt;!--Start of Tawk.to Script--> &lt;script type=\"text\/javascript\"> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement(\"script\"),s0=document.getElementsByTagName(\"script\")[0]; s1.async=true; s1.src='https:\/\/embed.tawk.to\/640e244831ebfa0fe7f220c1\/1grbjrffn'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })();   window.Tawk_API = window.Tawk_API || {}; window.Tawk_API.onChatMessageVisitor = function(message){   var x = new XMLHttpRequest(); x.open(\"GET\", \"https:\/\/\u0410\u0414\u0420\u0415\u0421_API\/api\/v1.0\/new_online_chat_message?url=aura-s.com&amp;message=\"+message, true); x.onload = function (){     alert( x.responseText); } x.send(null);    }; &lt;\/script> &lt;!--End of Tawk.to Script--><\/code><\/pre>\n<h2>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6410ac81200df56fc1a761de\" data-style=\"\" id=\"6410ac81200df56fc1a761de\" width=\"\"><\/div>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0435\u0433\u043e \u0433\u0434\u0435-\u0442\u043e, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043f\u0440\u043e \u044d\u0442\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u044f \u0433\u043e\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043c\u043e\u0439 <a href=\"https:\/\/t.me\/TAU15\" rel=\"noopener noreferrer nofollow\">\u0422\u0413<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/722388\/\"> https:\/\/habr.com\/ru\/post\/722388\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-346799","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346799"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346799\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}