generative data
This commit is contained in:
@@ -16,10 +16,20 @@ class GenerativesService(BaseService):
|
||||
logger.info("ENTER GENERATIVE")
|
||||
generate_list = GenerativesList.get_generative_list()
|
||||
practice_type = "Dentist"
|
||||
subscription_uid =" a42dbcc2-7466-4bea-aa67-8357c2c33925"
|
||||
product_id ="A000001"
|
||||
|
||||
for t in generate_list:
|
||||
prompt_string = str(t["prompt"]).replace("REPLACE_THIS", practice_type)
|
||||
var_name = t["name"]
|
||||
logger.info(f"GenerativesService ****** *****: {t['name']} {prompt_string}")
|
||||
json_response = []
|
||||
# json_response = GenerativeEngineIntegration.ask_generative(prompt_string)
|
||||
if json_response is not None:
|
||||
logger.info(json_response)
|
||||
logger.info(json_response["output"])
|
||||
logger.info(json_response["output"][0])
|
||||
logger.info(json_response["output"][0]["content"][0]["text"])
|
||||
text_result= json_response["output"][0]["content"][0]["text"]
|
||||
logger.info(f"INSERT *****: {product_id} {var_name} {subscription_uid} {text_result}")
|
||||
|
||||
res = []
|
||||
# res = GenerativeEngineIntegration.ask_generative("write 3 pharagraphs on a dentist website ")
|
||||
logger.info(res)
|
||||
|
||||
@@ -9,8 +9,63 @@ from app.models import MembersProducts, Products, Members, ProductsDetails, Prod
|
||||
|
||||
class OfficeDashboardService(BaseService):
|
||||
@staticmethod
|
||||
def get_subscriptions_data():
|
||||
pass
|
||||
def get_payments_data(filters):
|
||||
try:
|
||||
if filters is None:
|
||||
filters = {}
|
||||
|
||||
# Extract filters
|
||||
product_id = filters.get('product_id')
|
||||
member_id = filters.get('member_id')
|
||||
|
||||
# Extract pagination parameters
|
||||
page = int(filters.get('page', 1))
|
||||
limit = int(filters.get('limit', 20))
|
||||
|
||||
# Ensure page and limit are valid
|
||||
if page < 1:
|
||||
page = 1
|
||||
if limit < 1 or limit > 100:
|
||||
limit = 20
|
||||
|
||||
membersSubList, total_count = MembersProducts.get_all_subscriptions(product_id, member_id, page, limit)
|
||||
# Convert loans to dictionary format
|
||||
member_sub_data = []
|
||||
for subs in membersSubList:
|
||||
member_sub_data.append({
|
||||
'id': subs.id,
|
||||
'member_id': subs.member_id,
|
||||
'product_id': subs.product_id,
|
||||
'internal_url': subs.internal_url,
|
||||
'external_url': subs.external_url,
|
||||
'dns_group': subs.dns_group,
|
||||
'status': subs.status,
|
||||
'updated': subs.updated,
|
||||
"added": subs.added,
|
||||
})
|
||||
|
||||
# Calculate total pages
|
||||
total_pages = (total_count + limit - 1) // limit
|
||||
|
||||
response_data = {
|
||||
'subscriptions': member_sub_data,
|
||||
'count': len(member_sub_data),
|
||||
'pagination': {
|
||||
'total_count': total_count,
|
||||
'total_pages': total_pages,
|
||||
'current_page': page,
|
||||
'limit': limit,
|
||||
'has_next': page < total_pages,
|
||||
'has_prev': page > 1
|
||||
}
|
||||
}
|
||||
|
||||
return response_data
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
||||
return jsonify({"message": "Internal Server Error"}), 500
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_dashboard_data():
|
||||
|
||||
Reference in New Issue
Block a user