genarative cores
This commit is contained in:
@@ -34,6 +34,7 @@ MAIL_PORT= 465
|
|||||||
MAIL_USERNAME=message@chiefsoft.com
|
MAIL_USERNAME=message@chiefsoft.com
|
||||||
MAIL_PASSWORD=may12002!
|
MAIL_PASSWORD=may12002!
|
||||||
JWT_SECRET_KEY=dce6bd64f7d7101de4fed7cfc185a12851611a79bd60bbfdcc5b414b85f1fdb75e0905691c2a77ce94a7351b261fab4e183e17731ed40089f68f7290a793119f285d8ec7902d248ce15e8b1d4996ebacf5e7bcb06a38ac7ce0736f17d5c2895a499661d27095ac20aa174f9af2fba9a849dd2e6fd0aad8aa7e1ecc030c11eb8dc8dcb71d32233de3530d04f85918b9582f8b02587a7350aa34232825d4831707c7c5775026f3fdd92c5df555e6ff8b785525922709830206bbd49c371fb6e16bcab01ffccaf904108bb9789c578bce6afbb33bc77960051e680b2428d1f026473e71ef0f9997b2a6dc496e1c40509a1d289e3ff8b384c2d49e1d7719f9f4aaa1
|
JWT_SECRET_KEY=dce6bd64f7d7101de4fed7cfc185a12851611a79bd60bbfdcc5b414b85f1fdb75e0905691c2a77ce94a7351b261fab4e183e17731ed40089f68f7290a793119f285d8ec7902d248ce15e8b1d4996ebacf5e7bcb06a38ac7ce0736f17d5c2895a499661d27095ac20aa174f9af2fba9a849dd2e6fd0aad8aa7e1ecc030c11eb8dc8dcb71d32233de3530d04f85918b9582f8b02587a7350aa34232825d4831707c7c5775026f3fdd92c5df555e6ff8b785525922709830206bbd49c371fb6e16bcab01ffccaf904108bb9789c578bce6afbb33bc77960051e680b2428d1f026473e71ef0f9997b2a6dc496e1c40509a1d289e3ff8b384c2d49e1d7719f9f4aaa1
|
||||||
|
OPENAI_API_KEY = "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"
|
||||||
|
|
||||||
|
|
||||||
#Publishable key
|
#Publishable key
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ MAIL_PORT= 465
|
|||||||
MAIL_USERNAME=message@chiefsoft.com
|
MAIL_USERNAME=message@chiefsoft.com
|
||||||
MAIL_PASSWORD=may12002!
|
MAIL_PASSWORD=may12002!
|
||||||
JWT_SECRET_KEY=dce6bd64f7d7101de4fed7cfc185a12851611a79bd60bbfdcc5b414b85f1fdb75e0905691c2a77ce94a7351b261fab4e183e17731ed40089f68f7290a793119f285d8ec7902d248ce15e8b1d4996ebacf5e7bcb06a38ac7ce0736f17d5c2895a499661d27095ac20aa174f9af2fba9a849dd2e6fd0aad8aa7e1ecc030c11eb8dc8dcb71d32233de3530d04f85918b9582f8b02587a7350aa34232825d4831707c7c5775026f3fdd92c5df555e6ff8b785525922709830206bbd49c371fb6e16bcab01ffccaf904108bb9789c578bce6afbb33bc77960051e680b2428d1f026473e71ef0f9997b2a6dc496e1c40509a1d289e3ff8b384c2d49e1d7719f9f4aaa1
|
JWT_SECRET_KEY=dce6bd64f7d7101de4fed7cfc185a12851611a79bd60bbfdcc5b414b85f1fdb75e0905691c2a77ce94a7351b261fab4e183e17731ed40089f68f7290a793119f285d8ec7902d248ce15e8b1d4996ebacf5e7bcb06a38ac7ce0736f17d5c2895a499661d27095ac20aa174f9af2fba9a849dd2e6fd0aad8aa7e1ecc030c11eb8dc8dcb71d32233de3530d04f85918b9582f8b02587a7350aa34232825d4831707c7c5775026f3fdd92c5df555e6ff8b785525922709830206bbd49c371fb6e16bcab01ffccaf904108bb9789c578bce6afbb33bc77960051e680b2428d1f026473e71ef0f9997b2a6dc496e1c40509a1d289e3ff8b384c2d49e1d7719f9f4aaa1
|
||||||
|
OPENAI_API_KEY = "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"
|
||||||
|
|
||||||
#Publishable key
|
#Publishable key
|
||||||
STRIPE_PUB_KEY="pk_live_51RqL5OQ8vepTmh4AbXAnFmbgWDNJys2sfDcsLPVnOKRFx8EVOBOlO2RRN4lRNh6wNPhAj1A28xL3R0wHlMJ4WECo00rOM5iOto"
|
STRIPE_PUB_KEY="pk_live_51RqL5OQ8vepTmh4AbXAnFmbgWDNJys2sfDcsLPVnOKRFx8EVOBOlO2RRN4lRNh6wNPhAj1A28xL3R0wHlMJ4WECo00rOM5iOto"
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ MAIL_PORT= 465
|
|||||||
MAIL_USERNAME=message@chiefsoft.com
|
MAIL_USERNAME=message@chiefsoft.com
|
||||||
MAIL_PASSWORD=may12002!
|
MAIL_PASSWORD=may12002!
|
||||||
JWT_SECRET_KEY=dce6bd64f7d7101de4fed7cfc185a12851611a79bd60bbfdcc5b414b85f1fdb75e0905691c2a77ce94a7351b261fab4e183e17731ed40089f68f7290a793119f285d8ec7902d248ce15e8b1d4996ebacf5e7bcb06a38ac7ce0736f17d5c2895a499661d27095ac20aa174f9af2fba9a849dd2e6fd0aad8aa7e1ecc030c11eb8dc8dcb71d32233de3530d04f85918b9582f8b02587a7350aa34232825d4831707c7c5775026f3fdd92c5df555e6ff8b785525922709830206bbd49c371fb6e16bcab01ffccaf904108bb9789c578bce6afbb33bc77960051e680b2428d1f026473e71ef0f9997b2a6dc496e1c40509a1d289e3ff8b384c2d49e1d7719f9f4aaa1
|
JWT_SECRET_KEY=dce6bd64f7d7101de4fed7cfc185a12851611a79bd60bbfdcc5b414b85f1fdb75e0905691c2a77ce94a7351b261fab4e183e17731ed40089f68f7290a793119f285d8ec7902d248ce15e8b1d4996ebacf5e7bcb06a38ac7ce0736f17d5c2895a499661d27095ac20aa174f9af2fba9a849dd2e6fd0aad8aa7e1ecc030c11eb8dc8dcb71d32233de3530d04f85918b9582f8b02587a7350aa34232825d4831707c7c5775026f3fdd92c5df555e6ff8b785525922709830206bbd49c371fb6e16bcab01ffccaf904108bb9789c578bce6afbb33bc77960051e680b2428d1f026473e71ef0f9997b2a6dc496e1c40509a1d289e3ff8b384c2d49e1d7719f9f4aaa1
|
||||||
|
OPENAI_API_KEY = "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"
|
||||||
|
|
||||||
#Publishable key
|
#Publishable key
|
||||||
STRIPE_PUB_KEY="pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT"
|
STRIPE_PUB_KEY="pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT"
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
from .kafka import KafkaIntegration
|
from .kafka import KafkaIntegration
|
||||||
from .merms_stripe import StripeIntegration
|
from .merms_stripe import StripeIntegration
|
||||||
|
from .generative_engine import GenerativeEngineIntegration
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import stripe
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
from app.config import settings, Config
|
||||||
|
# import openai
|
||||||
|
from flask import jsonify
|
||||||
|
from openai import OpenAI
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class GenerativeEngineIntegration:
|
||||||
|
OPENAI_API_KEY = Config.OPENAI_API_KEY
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def ask_generative(generative_prompt):
|
||||||
|
try:
|
||||||
|
# response = GenerativeEngine.openai.chat.completions.create(
|
||||||
|
# model="gpt-3.5-turbo", # Or other suitable model
|
||||||
|
# messages=[{"role": "user", "content": generative_prompt}]
|
||||||
|
# )
|
||||||
|
|
||||||
|
client = OpenAI(api_key=GenerativeEngineIntegration.OPENAI_API_KEY)
|
||||||
|
|
||||||
|
|
||||||
|
response = client.responses.create(
|
||||||
|
model="gpt-4.1",
|
||||||
|
input=generative_prompt
|
||||||
|
)
|
||||||
|
|
||||||
|
# input = "Tell me a three sentence bedtime story about a unicorn."
|
||||||
|
logger.info(response)
|
||||||
|
json_response = json.loads(response.json())
|
||||||
|
# json_response = response.json()
|
||||||
|
# logger.info(json_response.keys())
|
||||||
|
logger.info(json_response)
|
||||||
|
# logger.info(json_response["output"])
|
||||||
|
logger.info(json_response["output"])
|
||||||
|
logger.info(json_response["output"][0])
|
||||||
|
logger.info(json_response["output"][0]["content"][0]["text"])
|
||||||
|
# return json_response["generated_text"]
|
||||||
|
|
||||||
|
# chatgpt_response = response.choices[0].message.content
|
||||||
|
return json_response
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"ChatGpt Call Error {e}")
|
||||||
|
return None
|
||||||
@@ -12,7 +12,8 @@ from app.api.services import (
|
|||||||
WebContentsService,
|
WebContentsService,
|
||||||
SubscriptionsService,
|
SubscriptionsService,
|
||||||
CommonDataService,
|
CommonDataService,
|
||||||
OfficeCustomerService
|
OfficeCustomerService,
|
||||||
|
GenerativesService
|
||||||
)
|
)
|
||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from app.api.middlewares import enforce_json, require_auth
|
from app.api.middlewares import enforce_json, require_auth
|
||||||
@@ -376,6 +377,15 @@ def get_web_contents():
|
|||||||
result = WebContentsService.get_web_contents_data(provision_uid)
|
result = WebContentsService.get_web_contents_data(provision_uid)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
#=====================================================
|
||||||
|
@api.route('/web/generatives', methods=['GET'])
|
||||||
|
def get_refresh_generatives():
|
||||||
|
logger.info("START TO ENTER GENERATIVE")
|
||||||
|
# Call the dashboard service
|
||||||
|
data = []
|
||||||
|
result = GenerativesService.process_generatives_list(data)
|
||||||
|
return jsonify(result)
|
||||||
|
|
||||||
#===================================================
|
#===================================================
|
||||||
# Common Data
|
# Common Data
|
||||||
#=====================================================
|
#=====================================================
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from app.api.services.office_auth import OfficeAuthService
|
|||||||
from app.api.services.web_contents import WebContentsService
|
from app.api.services.web_contents import WebContentsService
|
||||||
from app.api.services.subscriptions import SubscriptionsService
|
from app.api.services.subscriptions import SubscriptionsService
|
||||||
from app.api.services.common_data import CommonDataService
|
from app.api.services.common_data import CommonDataService
|
||||||
|
from app.api.services.genaratives import GenerativesService
|
||||||
|
|
||||||
|
|
||||||
# OFFICE
|
# OFFICE
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
from urllib import request
|
||||||
|
|
||||||
|
from flask import session, jsonify
|
||||||
|
from app.api.integrations import GenerativeEngineIntegration
|
||||||
|
from app.utils.logger import logger
|
||||||
|
from app.api.services.base_service import BaseService
|
||||||
|
from marshmallow import ValidationError
|
||||||
|
from app.extensions import db
|
||||||
|
from app.models import MembersProducts, Products, Members, ProductsDetails, ProductsDetails, ProvisionActions, \
|
||||||
|
MembersProductsSettings, ProductsTemplates
|
||||||
|
from app.api.helpers.response_helper import ResponseHelper
|
||||||
|
from app.api.schemas.myproduct import MyProductSchema
|
||||||
|
from app.api.schemas.provision import ProvisionSchema
|
||||||
|
from app.api.schemas.myproduct_settings import MyProductSettingsSchema
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import random
|
||||||
|
from app.config import Config
|
||||||
|
|
||||||
|
|
||||||
|
class GenerativesService(BaseService):
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def process_generatives_list(data):
|
||||||
|
logger.info("ENTER GENERATIVE")
|
||||||
|
|
||||||
|
res = []
|
||||||
|
# res = GenerativeEngineIntegration.ask_generative("write 3 pharagraphs on a dentist website ")
|
||||||
|
logger.info(res)
|
||||||
@@ -14,6 +14,8 @@ class Config:
|
|||||||
|
|
||||||
THIS_SITE_URL = os.getenv("THIS_SITE_URL", "https://qa-panel.mermsemr.com")
|
THIS_SITE_URL = os.getenv("THIS_SITE_URL", "https://qa-panel.mermsemr.com")
|
||||||
|
|
||||||
|
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY","qOLBHLMpSTfFrG9TEwA")
|
||||||
|
|
||||||
#Email Server
|
#Email Server
|
||||||
SEND_EMAIL_FROM = os.environ.get("SEND_EMAIL_FROM","message@chiefsoft.com")
|
SEND_EMAIL_FROM = os.environ.get("SEND_EMAIL_FROM","message@chiefsoft.com")
|
||||||
SEND_EMAIL_PASS = os.environ.get("SEND_EMAIL_PASS","may12002!")
|
SEND_EMAIL_PASS = os.environ.get("SEND_EMAIL_PASS","may12002!")
|
||||||
|
|||||||
+3
-1
@@ -45,4 +45,6 @@ pycountry
|
|||||||
|
|
||||||
stripe
|
stripe
|
||||||
|
|
||||||
requests
|
requests
|
||||||
|
|
||||||
|
openai
|
||||||
Reference in New Issue
Block a user