fix: use configured model for all LiteLLM completions
All checks were successful
build-and-release / build (push) Successful in 3m38s

complete_as and complete_as_user were passing internal logical model names
(jd-generator, profile-writer, etc.) directly to LiteLLM, which only
knows the configured model alias (askash-main). Route all completions
through self.model so LiteLLM can resolve the correct backend model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tracewebstudio Dev 2026-07-17 00:48:19 +02:00
parent ed6a094003
commit 60d9c28b64

View file

@ -142,17 +142,20 @@ impl AiProvider for LiteLLMProvider {
async fn complete_as( async fn complete_as(
&self, &self,
model: &str, _model: &str,
system_prompt: &str, system_prompt: &str,
user_prompt: &str, user_prompt: &str,
) -> Result<String, AppError> { ) -> Result<String, AppError> {
self.chat(&self.api_key, model, system_prompt, user_prompt).await // LiteLLM routes everything through the configured model (e.g. askash-main).
// Logical model names like "jd-generator" are internal identifiers only.
let model = self.model.clone();
self.chat(&self.api_key, &model, system_prompt, user_prompt).await
} }
async fn complete_as_user( async fn complete_as_user(
&self, &self,
user_id: Option<&str>, user_id: Option<&str>,
model: &str, _model: &str,
system_prompt: &str, system_prompt: &str,
user_prompt: &str, user_prompt: &str,
) -> Result<String, AppError> { ) -> Result<String, AppError> {
@ -160,7 +163,8 @@ impl AiProvider for LiteLLMProvider {
(Some(uid), Some(client)) => client.get_key(uid).await, (Some(uid), Some(client)) => client.get_key(uid).await,
_ => None, _ => None,
}; };
self.chat(key.as_deref().unwrap_or(&self.api_key), model, system_prompt, user_prompt) let model = self.model.clone();
self.chat(key.as_deref().unwrap_or(&self.api_key), &model, system_prompt, user_prompt)
.await .await
} }
} }