mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-03-13 15:56:37 +00:00
finalized function call static parameters
This commit is contained in:
parent
f9157d86f1
commit
888ea24534
@ -26,7 +26,7 @@ class FunctionCall:
|
||||
def sync_configuration(self):
|
||||
self.configuration_file_path = self.app.lollms_paths.personal_configuration_path/"services"/self.name/f"config.yaml"
|
||||
self.configuration_file_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
self.static_parameters.file_path = self.configuration_file_path
|
||||
self.static_parameters.config.file_path = self.configuration_file_path
|
||||
try:
|
||||
self.static_parameters.config.load_config()
|
||||
except:
|
||||
|
@ -227,8 +227,8 @@ async def get_function_call_settings(request: Request):
|
||||
if entry["name"] == function_name and Path(entry["dir"]).parent.name == str(fn_dir):
|
||||
try:
|
||||
fci = lollmsElfServer.load_function_call(entry, client)
|
||||
if hasattr(fci,"static_params"):
|
||||
return fci.static_params.config_template.template
|
||||
if hasattr(fci["class"],"static_parameters"):
|
||||
return fci["class"].static_parameters.config_template.template
|
||||
else:
|
||||
return {}
|
||||
except Exception as ex:
|
||||
@ -240,7 +240,7 @@ async def get_function_call_settings(request: Request):
|
||||
@router.post("/set_function_call_settings")
|
||||
async def set_function_call_settings(request: Request):
|
||||
data = await request.json()
|
||||
check_access(lollmsElfServer,data["client_id"])
|
||||
client = check_access(lollmsElfServer,data["client_id"])
|
||||
settings = data["settings"]
|
||||
"""
|
||||
Sets the active ttv settings.
|
||||
@ -257,13 +257,19 @@ async def set_function_call_settings(request: Request):
|
||||
# Add new entry
|
||||
for entry in lollmsElfServer.config.mounted_function_calls:
|
||||
if entry["name"] == function_name and Path(entry["dir"]).parent.name == str(fn_dir):
|
||||
if hasattr(entry,"static_params"):
|
||||
entry.static_params.update_template(settings)
|
||||
entry.static_params.config.save_config()
|
||||
entry.static_params.settings_updated()
|
||||
return {'status':True}
|
||||
else:
|
||||
return {'status':False}
|
||||
try:
|
||||
fci = lollmsElfServer.load_function_call(entry, client)
|
||||
if hasattr(fci["class"],"static_parameters"):
|
||||
fci["class"].static_parameters.update_template(settings)
|
||||
fci["class"].static_parameters.config.save_config()
|
||||
fci["class"].static_parameters.settings_updated()
|
||||
return {'status':True}
|
||||
else:
|
||||
return {'status':False}
|
||||
except Exception as ex:
|
||||
trace_exception(ex)
|
||||
return {}
|
||||
|
||||
else:
|
||||
return {'status':False}
|
||||
else:
|
||||
|
@ -708,8 +708,10 @@ def run_async(func: Callable[[], Coroutine[Any, Any, None]]) -> None:
|
||||
asyncio.set_event_loop(loop)
|
||||
|
||||
# If the loop is not running, run the coroutine until it completes
|
||||
loop.run_until_complete(func())
|
||||
|
||||
try:
|
||||
loop.run_until_complete(func())
|
||||
except:
|
||||
func()
|
||||
|
||||
def terminate_thread(thread):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user