fix: handle default

This commit is contained in:
Timothy J. Baek 2024-06-23 19:05:56 -07:00
parent 627705a347
commit dc25f44d31
2 changed files with 4 additions and 0 deletions

View File

@ -191,6 +191,7 @@ async def update_function_valves_by_id(
Valves = function_module.Valves
try:
form_data = {k: v for k, v in form_data.items() if v is not None}
valves = Valves(**form_data)
Functions.update_function_valves_by_id(id, valves.model_dump())
return valves.model_dump()
@ -277,6 +278,7 @@ async def update_function_user_valves_by_id(
UserValves = function_module.UserValves
try:
form_data = {k: v for k, v in form_data.items() if v is not None}
user_valves = UserValves(**form_data)
Functions.update_user_valves_by_id_and_user_id(
id, user.id, user_valves.model_dump()

View File

@ -196,6 +196,7 @@ async def update_toolkit_valves_by_id(
Valves = toolkit_module.Valves
try:
form_data = {k: v for k, v in form_data.items() if v is not None}
valves = Valves(**form_data)
Tools.update_tool_valves_by_id(id, valves.model_dump())
return valves.model_dump()
@ -282,6 +283,7 @@ async def update_toolkit_user_valves_by_id(
UserValves = toolkit_module.UserValves
try:
form_data = {k: v for k, v in form_data.items() if v is not None}
user_valves = UserValves(**form_data)
Tools.update_user_valves_by_id_and_user_id(
id, user.id, user_valves.model_dump()