fix: better error for moved openai resource (#2724)

* fix: better error for moved openai resource

* fix: nit
This commit is contained in:
HugoCasa
2023-11-29 00:24:56 +01:00
committed by GitHub
parent 3f4a9e06cf
commit 0ae29310ee
+7 -3
View File
@@ -102,9 +102,13 @@ async fn proxy(
&openai_resource_path,
&w_id
)
.fetch_one(&mut *tx)
.await?;
tx.commit().await?;
.fetch_optional(&mut *tx)
.await?
.ok_or_else(|| {
create_openai_json_error(format!(
"Could not find the OpenAI resource at path {openai_resource_path}, update the resource path in the workspace settings"
))
})?;
if resource.is_none() {
return Err(create_openai_json_error(