Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/kimi_cli/ui/print/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from functools import partial
from pathlib import Path

from kosong.chat_provider import ChatProviderError
from kosong.chat_provider import APIStatusError, ChatProviderError
from kosong.message import Message
from rich import print

Expand Down Expand Up @@ -100,7 +100,13 @@ def _handler():
print(str(e))
except ChatProviderError as e:
logger.exception("LLM provider error:")
print(str(e))
if isinstance(e, APIStatusError) and e.status_code == 429:
print(
"API rate limit reached. Please wait a moment before retrying,"
" or reduce the number of concurrent agents."
)
else:
print(str(e))
except MaxStepsReached as e:
logger.warning("Max steps reached: {n_steps}", n_steps=e.n_steps)
print(str(e))
Expand Down
5 changes: 5 additions & 0 deletions src/kimi_cli/ui/shell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ def _handler():
console.print("[red]Membership expired, please renew your plan[/red]")
elif isinstance(e, APIStatusError) and e.status_code == 403:
console.print("[red]Quota exceeded, please upgrade your plan or retry later[/red]")
elif isinstance(e, APIStatusError) and e.status_code == 429:
console.print(
"[yellow]API rate limit reached. Please wait a moment before retrying,"
" or reduce the number of concurrent agents.[/yellow]"
)
else:
console.print(f"[red]LLM provider error: {e}[/red]")
except MaxStepsReached as e:
Expand Down
Loading