mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-19 16:22:10 +00:00
Merge pull request #22 from migatu/claude-provider-switch
Claude provider switch
This commit is contained in:
@@ -5,6 +5,9 @@ on:
|
|||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
# Manual trigger: run CI on demand from the Actions tab (or `gh workflow run
|
||||||
|
# ci.yml --ref <branch>`) without pushing a commit just to see it go green.
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|||||||
+12
-3
@@ -111,17 +111,26 @@ class Events(commands.Cog):
|
|||||||
|
|
||||||
@commands.hybrid_command(
|
@commands.hybrid_command(
|
||||||
name="gadaj_teraz",
|
name="gadaj_teraz",
|
||||||
description="Przełącz backend AI (np. gpt / claude). Tylko Vykidailo.",
|
description="Pokaż/przełącz backend AI (bez argumentu = status). Przełączanie: Vykidailo.",
|
||||||
)
|
)
|
||||||
async def gadaj_teraz(self, ctx, nazwa_konfigu: str):
|
async def gadaj_teraz(self, ctx, nazwa_konfigu: Optional[str] = None):
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
|
available = ai_functions.list_ai_configs()
|
||||||
|
# No argument -> report the active backend (read-only, open to all).
|
||||||
|
if not nazwa_konfigu:
|
||||||
|
active = ai_functions.get_active_ai_config()
|
||||||
|
await discord_friendly_reply(
|
||||||
|
ctx,
|
||||||
|
f"Teraz gadam przez **{active}**. Dostępne: {', '.join(available)}. "
|
||||||
|
"Przełączysz przez `$gadaj_teraz <config>` (tylko Vykidailo).",
|
||||||
|
)
|
||||||
|
return
|
||||||
is_admin = isinstance(ctx.author, discord.Member) and any(
|
is_admin = isinstance(ctx.author, discord.Member) and any(
|
||||||
role.name == "Vykidailo" for role in ctx.author.roles
|
role.name == "Vykidailo" for role in ctx.author.roles
|
||||||
)
|
)
|
||||||
if not is_admin:
|
if not is_admin:
|
||||||
await discord_friendly_reply(ctx, "Tylko Vykidailo może przełączać AI.")
|
await discord_friendly_reply(ctx, "Tylko Vykidailo może przełączać AI.")
|
||||||
return
|
return
|
||||||
available = ai_functions.list_ai_configs()
|
|
||||||
if nazwa_konfigu not in available:
|
if nazwa_konfigu not in available:
|
||||||
await discord_friendly_reply(
|
await discord_friendly_reply(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user