diff --git a/changai/changai/api/v2/clients.py b/changai/changai/api/v2/clients.py index 57191a4..72417bc 100644 --- a/changai/changai/api/v2/clients.py +++ b/changai/changai/api/v2/clients.py @@ -8,7 +8,7 @@ from google.genai import types from google.oauth2 import service_account from google.api_core import exceptions as google_exceptions -from changai.changai.api.v2.schema_utils import (ChangAIConfig, CHANGAI_SETTINGS, CHANGAI_GUIDE_LINK, ERPGULF_LINK, settingsUrl) +from changai.changai.api.v2.schema_utils import (ChangAIConfig, CHANGAI_SETTINGS, CHANGAI_GUIDE_LINK, ERPGULF_LINK, get_settings_url) _GEMINI_CLIENT = None _GEMINI_CONFIG = None APPLICATION_JSON = "application/json" @@ -67,14 +67,14 @@ def _throw_missing_vertex_field(project_id: str, location: str, credentials_json frappe.throw( _("Gemini Project ID is missing.

Please Go to Settings Page and enter your Gemini Project ID.
" "Check Quick Start Guide 👇:
Click here
" - "ERPGulf.com.").format(CHANGAI_GUIDE_LINK,settingsUrl,ERPGULF_LINK), + "ERPGulf.com.").format(CHANGAI_GUIDE_LINK,get_settings_url(),ERPGULF_LINK), title=_("Missing Gemini Project ID"), ) if not location: frappe.throw( _("Gemini Location is missing.

Please Go to Settings Page and enter your Gemini Location.
" "Check Quick Start Guide 👇:
Click here
" - "ERPGulf.com.").format(CHANGAI_GUIDE_LINK,settingsUrl,ERPGULF_LINK), + "ERPGulf.com.").format(CHANGAI_GUIDE_LINK,get_settings_url(),ERPGULF_LINK), title=_("Missing Gemini Location"), ) if not credentials_json: @@ -82,7 +82,7 @@ def _throw_missing_vertex_field(project_id: str, location: str, credentials_json _("Service Account Credentials are missing.

Please Go to Settings Page and enter your Service Account Credential.
" "Check Quick Start Guide 👇:
Click here" "ERPGulf.com." -).format(CHANGAI_GUIDE_LINK,settingsUrl,ERPGULF_LINK), +).format(CHANGAI_GUIDE_LINK,get_settings_url(),ERPGULF_LINK), title=_("Missing Service Account Credentials"), ) @@ -110,7 +110,7 @@ def _get_api_key_client(config): "Click here
" "ERPGulf.com." - ).format(CHANGAI_GUIDE_LINK,settingsUrl,ERPGULF_LINK), + ).format(CHANGAI_GUIDE_LINK,get_settings_url(),ERPGULF_LINK), title=_("Gemini Authentication Not Configured"), ) diff --git a/changai/changai/api/v2/fvs_stores/erpnext/emb_dir/field_docs.pkl b/changai/changai/api/v2/fvs_stores/erpnext/emb_dir/field_docs.pkl index 5e48b21..2650d8b 100644 Binary files a/changai/changai/api/v2/fvs_stores/erpnext/emb_dir/field_docs.pkl and b/changai/changai/api/v2/fvs_stores/erpnext/emb_dir/field_docs.pkl differ diff --git a/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.faiss b/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.faiss index 6e98485..86d3856 100644 Binary files a/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.faiss and b/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.faiss differ diff --git a/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.pkl b/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.pkl index 2f240b9..c01dabe 100644 Binary files a/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.pkl and b/changai/changai/api/v2/fvs_stores/erpnext/report_fvs/index.pkl differ diff --git a/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.faiss b/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.faiss index 9c14c2c..f3fcec5 100644 Binary files a/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.faiss and b/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.faiss differ diff --git a/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.pkl b/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.pkl index 7f2d9a1..7cc13aa 100644 Binary files a/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.pkl and b/changai/changai/api/v2/fvs_stores/erpnext/table_fvs/index.pkl differ diff --git a/changai/changai/api/v2/retrieve.py b/changai/changai/api/v2/retrieve.py index 9779376..8490cb1 100644 --- a/changai/changai/api/v2/retrieve.py +++ b/changai/changai/api/v2/retrieve.py @@ -14,7 +14,7 @@ ChangAIConfig, CHANGAI_GUIDE_LINK, ERPGULF_LINK, - settingsUrl, + get_settings_url, format_schema_context, publish_pipeline_update, _safe_join, @@ -103,7 +103,7 @@ def download_model_from_ui(): frappe.throw(_("Model download failed: {0}\n Check Quick Start Guide Here 👇:\n{1}
" "Download Embedding Model.
" "ERPGulf.com." -).format(str(e),CHANGAI_GUIDE_LINK,settingsUrl,ERPGULF_LINK)) +).format(str(e),CHANGAI_GUIDE_LINK,get_settings_url(),ERPGULF_LINK)) @@ -158,7 +158,7 @@ def get_embedding_engine(): "Click here" "ERPGulf.com." - ).format(CHANGAI_GUIDE_LINK,settingsUrl,ERPGULF_LINK), + ).format(CHANGAI_GUIDE_LINK,get_settings_url(),ERPGULF_LINK), title=_("Embedding Model Required") ) @@ -245,7 +245,7 @@ def get_master_vs(): ).format( master_vs_path, - settingsUrl, + get_settings_url(), CHANGAI_GUIDE_LINK, ERPGULF_LINK )) diff --git a/changai/changai/api/v2/schema_utils.py b/changai/changai/api/v2/schema_utils.py index b44a585..986d875 100644 --- a/changai/changai/api/v2/schema_utils.py +++ b/changai/changai/api/v2/schema_utils.py @@ -18,9 +18,9 @@ _VALUE_TO_FIELD = {} CHANGAI_GUIDE_LINK="https://app.erpgulf.com/en/articles/chang-ai-quick-start-guide" ERPGULF_LINK = "https://app.erpgulf.com/en/products/chang-ai-an-ai-agent" -settingsUrl = frappe.utils.get_url( - "/app/changai-settings/ChangAI%20Settings" -) +# settingsUrl = frappe.utils.get_url( +# "/app/changai-settings/ChangAI%20Settings" +# ) CHANGAI_SETTINGS = "ChangAI Settings" _ASSETS_DIR = Path(frappe.get_app_path("changai", "changai", "api", "v2", "assets")).resolve() _PROMPTS_DIR = Path(frappe.get_app_path("changai", "changai", "prompts")).resolve() @@ -30,7 +30,13 @@ JSON_EXT = ".json" YAML_EXT = ".yaml" +_settings_url = None +def get_settings_url(): + global _settings_url + if _settings_url is None: + _settings_url = frappe.utils.get_url("/app/changai-settings/ChangAI%20Settings") + return _settings_url def get_report_filter_fields(report_name: str): try: diff --git a/changai/changai/api/v2/text2sql_pipeline_v2.py b/changai/changai/api/v2/text2sql_pipeline_v2.py index 9c1c5d5..0d0a2df 100644 --- a/changai/changai/api/v2/text2sql_pipeline_v2.py +++ b/changai/changai/api/v2/text2sql_pipeline_v2.py @@ -33,7 +33,7 @@ hits_to_schema_context, CHANGAI_GUIDE_LINK, ERPGULF_LINK, - settingsUrl, + get_settings_url, publish_pipeline_update, ChangAIConfig ) @@ -544,7 +544,7 @@ def check_update(res:dict): "Check Quick Start Guide Here 👇:
" "Click here
" "ERPGulf.com" - ).format(settingsUrl, CHANGAI_GUIDE_LINK, ERPGULF_LINK)) + ).format(get_settings_url(), CHANGAI_GUIDE_LINK, ERPGULF_LINK)) if res.get("is_stale"): frappe.throw(_( @@ -556,7 +556,7 @@ def check_update(res:dict): "Check Quick Start Guide Here 👇:
" "Click here
" "ERPGulf.com" - ).format(res.get("days"), settingsUrl, CHANGAI_GUIDE_LINK, ERPGULF_LINK)) + ).format(res.get("days"), get_settings_url(), CHANGAI_GUIDE_LINK, ERPGULF_LINK)) def generate_orm(state: SQLState) -> SQLState: from changai.changai.api.v2.auto_gen_api import update_masterdata