Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -567,9 +567,9 @@ async def upload_document(
|
|
567 |
#to retrieve from knowledgebase
|
568 |
@app.get("/api/document_upload")
|
569 |
async def get_document(company_id: str = Query(...), company_name: str = Query(...)):
|
570 |
-
print(f"Received companyId and name: {company_id}
|
571 |
#async def get_data_connectors(company_id: str, company_name: str):
|
572 |
-
logging.info(f"Received request for company_id and company_id: {company_id}
|
573 |
try:
|
574 |
cnx = get_db_connection()
|
575 |
cursor = cnx.cursor()
|
@@ -577,10 +577,10 @@ async def get_document(company_id: str = Query(...), company_name: str = Query(.
|
|
577 |
SELECT kb.kid,kb.company_id, kb.file_path, kb.document_name, kb.document_desc,kb.department,kb.version,kb.vectorDBflag,kb.last_updated
|
578 |
FROM u852023448_redmindgpt.knowledge_base kb
|
579 |
JOIN u852023448_redmindgpt.company_detail cd ON kb.company_id = cd.company_id
|
580 |
-
WHERE kb.company_id = %s
|
581 |
"""
|
582 |
logging.info(f"Executing query: {query} with company_id: {company_id}")
|
583 |
-
params = (company_id,
|
584 |
logging.info(f"Query parameters: {params}")
|
585 |
print(f"Query parameters: {params}")
|
586 |
|
@@ -997,9 +997,9 @@ async def API_saveconnectors(request: Request,
|
|
997 |
# retrieve api connectors
|
998 |
@app.get("/api/get_api_connectors")
|
999 |
async def get_api_connectors(company_id: str = Query(...), company_name: str = Query(...)):
|
1000 |
-
print(f"Received companyId and name: {company_id}
|
1001 |
#async def get_data_connectors(company_id: str, company_name: str):
|
1002 |
-
logging.info(f"Received request for company_id and company_id: {company_id}
|
1003 |
try:
|
1004 |
cnx =get_db_connection()
|
1005 |
cursor = cnx.cursor()
|
@@ -1007,10 +1007,10 @@ async def get_api_connectors(company_id: str = Query(...), company_name: str = Q
|
|
1007 |
SELECT ac.id, ac.company_id, ac.api_name, ac.api_endpoint,ac.auth_token,ac.input_param, ac.output_json, ac.description
|
1008 |
FROM u852023448_redmindgpt.api_connectors ac
|
1009 |
JOIN u852023448_redmindgpt.company_detail cd ON ac.company_id = cd.company_id
|
1010 |
-
WHERE ac.company_id = %s
|
1011 |
"""
|
1012 |
logging.info(f"Executing query: {query} with company_id: {company_id}")
|
1013 |
-
params = (company_id,
|
1014 |
logging.info(f"Query parameters: {params}")
|
1015 |
print(f"Query parameters: {params}")
|
1016 |
|
@@ -1271,9 +1271,9 @@ async def prompt_saveconnectors(request: Request,
|
|
1271 |
# retrieve api connectors
|
1272 |
@app.get("/api/get_prompt_templates")
|
1273 |
async def get_prompt_connectors(company_id: str = Query(...), company_name: str = Query(...)):
|
1274 |
-
print(f"Received companyId and name: {company_id}
|
1275 |
#async def get_data_connectors(company_id: str, company_name: str):
|
1276 |
-
logging.info(f"Received request for company_id and company_id: {company_id}
|
1277 |
try:
|
1278 |
cnx =get_db_connection()
|
1279 |
cursor = cnx.cursor()
|
@@ -1281,10 +1281,10 @@ async def get_prompt_connectors(company_id: str = Query(...), company_name: str
|
|
1281 |
SELECT pt.id,pt.company_id,pt.scenario,pt.prompts,pt.comments
|
1282 |
FROM u852023448_redmindgpt.prompt_templates pt
|
1283 |
JOIN u852023448_redmindgpt.company_detail cd ON pt.company_id = cd.company_id
|
1284 |
-
WHERE pt.company_id = %s
|
1285 |
"""
|
1286 |
logging.info(f"Executing query: {query} with company_id: {company_id}")
|
1287 |
-
params = (company_id,
|
1288 |
logging.info(f"Query parameters: {params}")
|
1289 |
print(f"Query parameters: {params}")
|
1290 |
|
|
|
567 |
#to retrieve from knowledgebase
|
568 |
@app.get("/api/document_upload")
|
569 |
async def get_document(company_id: str = Query(...), company_name: str = Query(...)):
|
570 |
+
print(f"Received companyId and name: {company_id}") # Log rec
|
571 |
#async def get_data_connectors(company_id: str, company_name: str):
|
572 |
+
logging.info(f"Received request for company_id and company_id: {company_id}")
|
573 |
try:
|
574 |
cnx = get_db_connection()
|
575 |
cursor = cnx.cursor()
|
|
|
577 |
SELECT kb.kid,kb.company_id, kb.file_path, kb.document_name, kb.document_desc,kb.department,kb.version,kb.vectorDBflag,kb.last_updated
|
578 |
FROM u852023448_redmindgpt.knowledge_base kb
|
579 |
JOIN u852023448_redmindgpt.company_detail cd ON kb.company_id = cd.company_id
|
580 |
+
WHERE kb.company_id = %s
|
581 |
"""
|
582 |
logging.info(f"Executing query: {query} with company_id: {company_id}")
|
583 |
+
params = (company_id,)
|
584 |
logging.info(f"Query parameters: {params}")
|
585 |
print(f"Query parameters: {params}")
|
586 |
|
|
|
997 |
# retrieve api connectors
|
998 |
@app.get("/api/get_api_connectors")
|
999 |
async def get_api_connectors(company_id: str = Query(...), company_name: str = Query(...)):
|
1000 |
+
print(f"Received companyId and name: {company_id}") # Log rec
|
1001 |
#async def get_data_connectors(company_id: str, company_name: str):
|
1002 |
+
logging.info(f"Received request for company_id and company_id: {company_id}")
|
1003 |
try:
|
1004 |
cnx =get_db_connection()
|
1005 |
cursor = cnx.cursor()
|
|
|
1007 |
SELECT ac.id, ac.company_id, ac.api_name, ac.api_endpoint,ac.auth_token,ac.input_param, ac.output_json, ac.description
|
1008 |
FROM u852023448_redmindgpt.api_connectors ac
|
1009 |
JOIN u852023448_redmindgpt.company_detail cd ON ac.company_id = cd.company_id
|
1010 |
+
WHERE ac.company_id = %s
|
1011 |
"""
|
1012 |
logging.info(f"Executing query: {query} with company_id: {company_id}")
|
1013 |
+
params = (company_id,)
|
1014 |
logging.info(f"Query parameters: {params}")
|
1015 |
print(f"Query parameters: {params}")
|
1016 |
|
|
|
1271 |
# retrieve api connectors
|
1272 |
@app.get("/api/get_prompt_templates")
|
1273 |
async def get_prompt_connectors(company_id: str = Query(...), company_name: str = Query(...)):
|
1274 |
+
print(f"Received companyId and name: {company_id}) # Log rec
|
1275 |
#async def get_data_connectors(company_id: str, company_name: str):
|
1276 |
+
logging.info(f"Received request for company_id and company_id: {company_id}")
|
1277 |
try:
|
1278 |
cnx =get_db_connection()
|
1279 |
cursor = cnx.cursor()
|
|
|
1281 |
SELECT pt.id,pt.company_id,pt.scenario,pt.prompts,pt.comments
|
1282 |
FROM u852023448_redmindgpt.prompt_templates pt
|
1283 |
JOIN u852023448_redmindgpt.company_detail cd ON pt.company_id = cd.company_id
|
1284 |
+
WHERE pt.company_id = %s
|
1285 |
"""
|
1286 |
logging.info(f"Executing query: {query} with company_id: {company_id}")
|
1287 |
+
params = (company_id,)
|
1288 |
logging.info(f"Query parameters: {params}")
|
1289 |
print(f"Query parameters: {params}")
|
1290 |
|