Closed CakeCrusher closed 8 months ago
thanks for noticing this!
indeed the problem is that if props are none it will none them in the db, here's how i prompted a solution:
let row = sqlx::query!(
r#"
UPDATE assistants
SET instructions = COALESCE($2, instructions),
name = COALESCE($3, name),
tools = COALESCE($4, tools),
model = COALESCE($5, model),
file_ids = COALESCE($7, file_ids)
WHERE id::text = $1 AND user_id::text = $6
RETURNING *
"#,
assistant_id,
assistant.inner.instructions,
assistant.inner.name,
&tools_json,
assistant.inner.model,
assistant.user_id,
&assistant.inner.file_ids,
)
should work i guess?
would love a PR!
with a unit test that do:
@louis030195 Whenever you update assistant all fields not passed are set to
None
or empty arrays (defaults).notice how instructions is now set to
None
I tried to resolve it but I'm a newbie on Rust, here is what I tried: https://chat.openai.com/share/64fe31d2-6078-4759-9982-be3924e50bba