60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
import requests
|
|
import json
|
|
import os
|
|
from decimal import Decimal
|
|
from config_base import *
|
|
from general_functions import *
|
|
from dotenv import load_dotenv
|
|
from elastic_helper import ElasticHelper
|
|
from create_ai_index import *
|
|
# from move_to_other import *
|
|
|
|
load_dotenv(dotenv_path='config.env')
|
|
# host=os.getenv('HOST_160_LOCAL')
|
|
host=os.getenv('HOST_160')
|
|
password=os.getenv('HOST_160_PASS')
|
|
print(host)
|
|
# print(password)
|
|
|
|
elastic = ElasticHelper(host, password)
|
|
|
|
# -----------------------------------------------------------------
|
|
### انتقال اطلاعات قبلی به اینجا
|
|
#elastic.moveCustomFileds("mj_qa_section", "mj_qa_section_temp", ["ners_v1", "nlp_parser", "code-ai"])
|
|
|
|
elastic.renameElasticIndex("mj_qa_opinion_temp", "mj_qa_opinion", "majles", "mj_qa_opinion")
|
|
elastic.renameElasticIndex("mj_qa_qanon_temp", "mj_qa_qanon", "majles", "mj_qa_qanon")
|
|
elastic.renameElasticIndex("mj_qa_section_temp", "mj_qa_section", "majles", "mj_qa_section")
|
|
elastic.renameElasticIndex("mj_rg_section_temp", "mj_rg_section", "majles", "mj_qa_section")
|
|
|
|
|
|
ai_url_base=os.getenv("AI_URL_BASE")
|
|
ai_url_vec=ai_url_base+'/vecsim/vector'
|
|
# ai_url_class=ai_url_base+'/vec_sim/class'
|
|
ai_url_class='http://192.168.23.51:6111/class'
|
|
# ai_url_ner=ai_url_base+'/vec_sim/ner'
|
|
|
|
# import_classification(elastic, ai_url_class, "mj_qa_section_temp")
|
|
# create_ai_Index(elastic, ai_url_vec ,"mj_qa_section_temp", "majles", "mj_qa_section")
|
|
|
|
|
|
# payload={
|
|
# "text":"سلام علیکم"
|
|
# }
|
|
# response = requests.request("POST", ai_url_vec, headers=HEADERS, json=payload)
|
|
# print(response.text)
|
|
# print(response)
|
|
|
|
|
|
payload={
|
|
"text":"طرفین به منظور اتمام مطالعات و احداث نیروگاههای جریانی ارس و تأسیسات مربوطه، منطقه مشترک ساختمانی و مطالعاتی را تعیین و امنیت این منطقه را در طول مدت اجراء و بهرهبرداری تأمین مینمایند. "
|
|
}
|
|
response = requests.request("POST", ai_url_class, headers=HEADERS, json=payload)
|
|
print(response.text)
|
|
print(response)
|
|
|
|
resp = json.loads(response.text)
|
|
print(resp['result'])
|
|
|
|
|