ki: return_model-Flag + ki_model in wiki_rassen; Evaluator filtert Claude-Einträge raus
This commit is contained in:
parent
d80abf07e5
commit
eea1de6d95
4 changed files with 14 additions and 5 deletions
|
|
@ -69,6 +69,7 @@ async def complete(
|
|||
requires_premium: bool = False,
|
||||
user_is_premium: bool = False,
|
||||
json_mode: bool = False,
|
||||
return_model: bool = False,
|
||||
) -> str:
|
||||
"""
|
||||
KI-Completion. Wählt automatisch den richtigen Backend.
|
||||
|
|
@ -99,18 +100,21 @@ async def complete(
|
|||
|
||||
# Cloud-Aufruf: nur wenn Premium UND cloud-Modus
|
||||
if requires_premium and user_is_premium and KI_MODE == "cloud":
|
||||
return await _cloud_complete(prompt, system, max_tokens, json_mode)
|
||||
text = await _cloud_complete(prompt, system, max_tokens, json_mode)
|
||||
return (text, CLOUD_MODEL) if return_model else text
|
||||
|
||||
# Lokaler Aufruf: Entwicklung + Free-User
|
||||
if KI_MODE in ("local", "cloud"):
|
||||
try:
|
||||
return await _local_complete(prompt, system, max_tokens, json_mode)
|
||||
text = await _local_complete(prompt, system, max_tokens, json_mode)
|
||||
return (text, LOCAL_MODEL) if return_model else text
|
||||
except Exception as e:
|
||||
logger.warning(f"Lokales KI-Modell nicht erreichbar: {e}")
|
||||
# Cloud-Fallback: im cloud-Modus immer, sonst nur für Premium-User
|
||||
if ANTHROPIC_KEY and (KI_MODE == "cloud" or (requires_premium and user_is_premium)):
|
||||
logger.info("Fallback auf Cloud-KI.")
|
||||
return await _cloud_complete(prompt, system, max_tokens, json_mode)
|
||||
text = await _cloud_complete(prompt, system, max_tokens, json_mode)
|
||||
return (text, CLOUD_MODEL) if return_model else text
|
||||
raise KIUnavailableError(
|
||||
"KI-Modell momentan nicht erreichbar. Bitte später erneut versuchen."
|
||||
) from e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue