Skip to content

Commit

Permalink
add new bot_name field to fp.make_app() (#120)
Browse files Browse the repository at this point in the history
add optional settings parameter to sync_bot_settings, which hits the new endpoint that does not require fetching settings from a running instance of the bot server.

* allow bot_name to be passed into fp.make_app()
  • Loading branch information
JohntheLi authored Aug 28, 2024
1 parent 34f0b6d commit 322d279
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/fastapi_poe/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ def make_app(
bot: Union[PoeBot, Sequence[PoeBot]],
access_key: str = "",
*,
bot_name: str = "",
api_key: str = "",
allow_without_key: bool = False,
app: Optional[FastAPI] = None,
Expand Down Expand Up @@ -912,11 +913,18 @@ def make_app(
raise ValueError(
"Cannot provide api_key if the bot object already has an access key"
)

if bot.bot_name is None:
bot.bot_name = bot_name
elif bot_name:
raise ValueError(
"Cannot provide bot_name if the bot object already has a bot_name"
)
bots = [bot]
else:
if access_key or api_key:
if access_key or api_key or bot_name:
raise ValueError(
"When serving multiple bots, the access_key must be set on each bot"
"When serving multiple bots, the access_key/bot_name must be set on each bot"
)
bots = bot

Expand Down

0 comments on commit 322d279

Please sign in to comment.