bugfixes in chatbot snippets

This commit is contained in:
Jakob Pinterits
2024-04-07 22:47:45 +02:00
parent c09e54a0c8
commit 60704ab5d8
3 changed files with 10 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ from io import BytesIO, StringIO
from pathlib import Path
from typing import * # type: ignore
import imy.asset_manager
import imy.assets
import imy.package_metadata
from PIL.Image import Image
from typing_extensions import Annotated
@@ -45,7 +45,7 @@ Readonly = Annotated[T, _READONLY]
ImageLike = Path | Image | URL | bytes
ASSET_MANGER: imy.asset_manager.AssetManager = imy.asset_manager.AssetManager(
ASSET_MANGER: imy.assets.AssetManager = imy.assets.AssetManager(
xz_dir=RIO_ASSETS_DIR,
cache_dir=USER_CACHE_DIR / "rio",
version=imy.package_metadata.get_package_version("rio-ui"),
@@ -130,12 +130,10 @@ class FileInfo:
return self._contents.decode(encoding)
@overload
async def open(self, type: Literal["r"]) -> StringIO:
...
async def open(self, type: Literal["r"]) -> StringIO: ...
@overload
async def open(self, type: Literal["rb"]) -> BytesIO:
...
async def open(self, type: Literal["rb"]) -> BytesIO: ...
async def open(self, type: Literal["r", "rb"] = "r") -> StringIO | BytesIO:
"""

View File

@@ -82,22 +82,22 @@ class EmptyChatPlaceholder(rio.Component):
),
rio.Row(
comps.ChatSuggestionCard(
"restaurant",
"material/restaurant",
"Suggest ways to make a dish more delicious",
on_press=self.on_question,
),
comps.ChatSuggestionCard(
"coffee",
"material/coffee",
"What's the best way to store coffee?",
on_press=self.on_question,
),
comps.ChatSuggestionCard(
"co-present",
"material/co-present",
"Help me improve my presentation technique",
on_press=self.on_question,
),
comps.ChatSuggestionCard(
"work",
"material/work",
"Draft a job application email for me",
on_press=self.on_question,
),

View File

@@ -1,10 +1,11 @@
from __future__ import annotations
from dataclasses import KW_ONLY, field
from datetime import datetime, timezone
from typing import * # type: ignore
# <additional-imports>
from datetime import datetime, timezone
import openai
import rio