Compare commits

...

8 Commits

Author SHA1 Message Date
hh ee2bbdd9ea feat(bot): add backup models 2026-06-03 23:55:50 +02:00
hh a50c36887a feat(frontend): pasting images to chat in web 2026-05-10 20:08:53 +02:00
hh 19912af0b5 feat(bot): ask to output code in code blocks 2026-05-10 17:34:16 +02:00
hh 0a9a41f2f4 feat(frontend): no LaTeX in code blocks 2026-05-10 17:32:31 +02:00
hh 95d250f6f1 feat(backend): add code preset 2026-05-10 16:54:44 +02:00
hh cfa592e85b feat(*): make message processing sequential 2026-05-04 22:30:40 +02:00
hh d8a5fde5f1 feat(backend): bump pydantic-ai version 2026-05-04 22:02:12 +02:00
hh eb476ba2d0 feat(bot): add reference preset 2026-05-04 22:01:49 +02:00
16 changed files with 949 additions and 262 deletions
+4
View File
@@ -2,6 +2,10 @@ BOT__TOKEN=<BOT__TOKEN>
SITE__URL=<SITE__URL> SITE__URL=<SITE__URL>
# Leave ANTHROPIC_API_KEY empty to disable the Anthropic backup.
ANTHROPIC_API_KEY=
ANTHROPIC_MODEL=claude-opus-4-8
LOG__LEVEL=INFO LOG__LEVEL=INFO
LOG__LEVEL_EXTERNAL=WARNING LOG__LEVEL_EXTERNAL=WARNING
LOG__SHOW_TIME=false LOG__SHOW_TIME=false
+1 -1
View File
@@ -10,7 +10,7 @@ dependencies = [
"aiogram>=3.24.0", "aiogram>=3.24.0",
"convex>=0.7.0", "convex>=0.7.0",
"httpx>=0.27", "httpx>=0.27",
"pydantic-ai-slim[google]>=1.44.0", "pydantic-ai-slim[google,anthropic]>=1.44.0",
"pydantic-settings>=2.12.0", "pydantic-settings>=2.12.0",
"rich>=14.2.0", "rich>=14.2.0",
"xkcdpass>=1.19.0", "xkcdpass>=1.19.0",
+77 -20
View File
@@ -28,8 +28,10 @@ from bot.modules.ai import (
get_follow_ups, get_follow_ups,
stream_response, stream_response,
) )
from bot.user_lock import get_user_lock
from utils import env from utils import env
from utils.convex import ConvexClient from utils.convex import ConvexClient
from utils.logging import logger
router = Router() router = Router()
convex = ConvexClient(env.convex_url) convex = ConvexClient(env.convex_url)
@@ -53,9 +55,7 @@ async def _enqueue_room_upload(
}, },
) )
except Exception as e: # noqa: BLE001 except Exception as e: # noqa: BLE001
from utils.logging import logger as _logger # noqa: PLC0415 logger.warning(f"Failed to enqueue room upload: {e}")
_logger.warning(f"Failed to enqueue room upload: {e}")
def schedule_room_uploads( def schedule_room_uploads(
@@ -235,7 +235,10 @@ class ProxyStreamingState:
async def send_long_message( async def send_long_message(
bot: Bot, chat_id: int, text: str, reply_markup: ReplyKeyboardMarkup | None = None bot: Bot,
chat_id: int,
text: str,
reply_markup: ReplyKeyboardMarkup | ReplyKeyboardRemove | None = None,
) -> int | None: ) -> int | None:
parts = split_message(text) parts = split_message(text)
first_id: int | None = None first_id: int | None = None
@@ -256,15 +259,34 @@ async def process_message_from_web( # noqa: C901, PLR0912, PLR0913, PLR0915
convex_chat_id: str, convex_chat_id: str,
images_base64: list[str] | None = None, images_base64: list[str] | None = None,
images_media_types: list[str] | None = None, images_media_types: list[str] | None = None,
pending_generation_id: str | None = None,
) -> None: ) -> None:
user = await convex.query("users:getById", {"userId": convex_user_id}) user = await convex.query("users:getById", {"userId": convex_user_id})
if not user or not user.get("geminiApiKey"): if not user or not user.get("geminiApiKey"):
return return
tg_chat_id = user["telegramChatId"].value if user.get("telegramChatId") else None
is_summarize = text == "/summarize" is_summarize = text == "/summarize"
if not is_summarize:
user_message_args: dict = {
"chatId": convex_chat_id,
"role": "user",
"content": text,
"source": "web",
}
if images_base64 and images_media_types:
user_message_args["imagesBase64"] = images_base64
user_message_args["imagesMediaTypes"] = images_media_types
await convex.mutation("messages:createFromBackend", user_message_args)
if pending_generation_id:
await convex.mutation(
"pendingGenerations:remove", {"id": pending_generation_id}
)
tg_chat_id = user["telegramChatId"].value if user.get("telegramChatId") else None
if tg_chat_id and not is_summarize: if tg_chat_id and not is_summarize:
if images_base64 and images_media_types: if images_base64 and images_media_types:
if len(images_base64) == 1: if len(images_base64) == 1:
@@ -339,7 +361,7 @@ async def process_message_from_web( # noqa: C901, PLR0912, PLR0913, PLR0915
system_prompt = SUMMARIZE_PROMPT if is_summarize else user.get("systemPrompt") system_prompt = SUMMARIZE_PROMPT if is_summarize else user.get("systemPrompt")
if system_prompt and inject_content: if system_prompt and inject_content:
system_prompt = system_prompt.replace("{theory_database}", inject_content) system_prompt = system_prompt.replace("{theory_database}", inject_content)
text_agent = create_text_agent( text_agent = await create_text_agent(
api_key=api_key, api_key=api_key,
model_name=model_name, model_name=model_name,
system_prompt=system_prompt, system_prompt=system_prompt,
@@ -386,13 +408,21 @@ async def process_message_from_web( # noqa: C901, PLR0912, PLR0913, PLR0915
if state: if state:
await state.flush() await state.flush()
follow_ups: list[str] = []
try:
full_history = [*history, {"role": "assistant", "content": final_answer}] full_history = [*history, {"role": "assistant", "content": final_answer}]
follow_up_model = user.get("followUpModel", "gemini-2.5-flash-lite") follow_up_model = user.get("followUpModel", "gemini-3.1-flash-lite")
follow_up_prompt = user.get("followUpPrompt") follow_up_prompt = user.get("followUpPrompt")
follow_up_agent = create_follow_up_agent( follow_up_agent = create_follow_up_agent(
api_key=api_key, model_name=follow_up_model, system_prompt=follow_up_prompt api_key=api_key,
model_name=follow_up_model,
system_prompt=follow_up_prompt,
) )
follow_ups = await get_follow_ups(follow_up_agent, full_history, chat_images) follow_ups = await get_follow_ups(
follow_up_agent, full_history, chat_images
)
except Exception as e: # noqa: BLE001
logger.warning(f"Follow-up generation failed: {e}")
if state: if state:
await state.stop_typing() await state.stop_typing()
@@ -425,7 +455,11 @@ async def process_message_from_web( # noqa: C901, PLR0912, PLR0913, PLR0915
if tg_chat_id and processing_msg: if tg_chat_id and processing_msg:
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
await processing_msg.delete() await processing_msg.delete()
keyboard = make_follow_up_keyboard(follow_ups) keyboard = (
make_follow_up_keyboard(follow_ups)
if follow_ups
else ReplyKeyboardRemove()
)
sent_id = await send_long_message(bot, tg_chat_id, final_answer, keyboard) sent_id = await send_long_message(bot, tg_chat_id, final_answer, keyboard)
if sent_id is not None: if sent_id is not None:
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
@@ -485,6 +519,7 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
model_name = user.get("model", "gemini-3-pro-preview") model_name = user.get("model", "gemini-3-pro-preview")
convex_user_id = user["_id"] convex_user_id = user["_id"]
async with get_user_lock(convex_user_id):
proxy_config = get_proxy_config(chat_id) proxy_config = get_proxy_config(chat_id)
proxy_state: ProxyStreamingState | None = None proxy_state: ProxyStreamingState | None = None
@@ -515,7 +550,8 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
if inject_connections: if inject_connections:
for conn in inject_connections: for conn in inject_connections:
db = await convex.query( db = await convex.query(
"inject:getDatabaseById", {"injectDatabaseId": conn["injectDatabaseId"]} "inject:getDatabaseById",
{"injectDatabaseId": conn["injectDatabaseId"]},
) )
if db and db.get("content"): if db and db.get("content"):
inject_content += db["content"] + "\n\n" inject_content += db["content"] + "\n\n"
@@ -550,7 +586,7 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
system_prompt = user.get("systemPrompt") system_prompt = user.get("systemPrompt")
if system_prompt and inject_content: if system_prompt and inject_content:
system_prompt = system_prompt.replace("{theory_database}", inject_content) system_prompt = system_prompt.replace("{theory_database}", inject_content)
text_agent = create_text_agent( text_agent = await create_text_agent(
api_key=api_key, api_key=api_key,
model_name=model_name, model_name=model_name,
system_prompt=system_prompt, system_prompt=system_prompt,
@@ -558,7 +594,9 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
) )
agent_deps = ( agent_deps = (
AgentDeps(user_id=convex_user_id, api_key=api_key, rag_db_names=rag_db_names) AgentDeps(
user_id=convex_user_id, api_key=api_key, rag_db_names=rag_db_names
)
if rag_db_names if rag_db_names
else None else None
) )
@@ -571,7 +609,9 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
proxy_config.target_chat_id, "..." proxy_config.target_chat_id, "..."
) )
proxy_state = ProxyStreamingState( proxy_state = ProxyStreamingState(
proxy_config.proxy_bot, proxy_config.target_chat_id, proxy_processing_msg proxy_config.proxy_bot,
proxy_config.target_chat_id,
proxy_processing_msg,
) )
try: try:
@@ -601,13 +641,24 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
if proxy_state: if proxy_state:
await proxy_state.flush() await proxy_state.flush()
full_history = [*history[:-1], {"role": "assistant", "content": final_answer}] follow_ups: list[str] = []
follow_up_model = user.get("followUpModel", "gemini-2.5-flash-lite") try:
full_history = [
*history[:-1],
{"role": "assistant", "content": final_answer},
]
follow_up_model = user.get("followUpModel", "gemini-3.1-flash-lite")
follow_up_prompt = user.get("followUpPrompt") follow_up_prompt = user.get("followUpPrompt")
follow_up_agent = create_follow_up_agent( follow_up_agent = create_follow_up_agent(
api_key=api_key, model_name=follow_up_model, system_prompt=follow_up_prompt api_key=api_key,
model_name=follow_up_model,
system_prompt=follow_up_prompt,
) )
follow_ups = await get_follow_ups(follow_up_agent, full_history, chat_images) follow_ups = await get_follow_ups(
follow_up_agent, full_history, chat_images
)
except Exception as e: # noqa: BLE001
logger.warning(f"Follow-up generation failed: {e}")
await state.stop_typing() await state.stop_typing()
@@ -624,7 +675,11 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
await processing_msg.delete() await processing_msg.delete()
keyboard = make_follow_up_keyboard(follow_ups) keyboard = (
make_follow_up_keyboard(follow_ups)
if follow_ups
else ReplyKeyboardRemove()
)
await send_long_message(bot, chat_id, final_answer, keyboard) await send_long_message(bot, chat_id, final_answer, keyboard)
if proxy_state and proxy_config: if proxy_state and proxy_config:
@@ -649,7 +704,9 @@ async def process_message( # noqa: C901, PLR0912, PLR0913, PLR0915
}, },
) )
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
await processing_msg.edit_text(html.quote(error_msg[:TELEGRAM_MAX_LENGTH])) await processing_msg.edit_text(
html.quote(error_msg[:TELEGRAM_MAX_LENGTH])
)
if proxy_state: if proxy_state:
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
await proxy_state.message.edit_text(error_msg[:TELEGRAM_MAX_LENGTH]) await proxy_state.message.edit_text(error_msg[:TELEGRAM_MAX_LENGTH])
+120 -8
View File
@@ -1,3 +1,5 @@
import asyncio
import time
from collections.abc import Awaitable, Callable from collections.abc import Awaitable, Callable
from dataclasses import dataclass from dataclasses import dataclass
@@ -11,6 +13,8 @@ from pydantic_ai import (
TextPart, TextPart,
UserPromptPart, UserPromptPart,
) )
from pydantic_ai.models import Model
from pydantic_ai.models.fallback import FallbackModel
from pydantic_ai.models.google import GoogleModel from pydantic_ai.models.google import GoogleModel
from pydantic_ai.providers.google import GoogleProvider from pydantic_ai.providers.google import GoogleProvider
@@ -24,6 +28,113 @@ from .prompts import DEFAULT_FOLLOW_UP
StreamCallback = Callable[[str], Awaitable[None]] StreamCallback = Callable[[str], Awaitable[None]]
convex = ConvexClient(env.convex_url) convex = ConvexClient(env.convex_url)
CONTENT_FALLBACK_CHAIN = ["gemini-3.5-pro", "gemini-3.1-pro", "gemini-3.5-flash"]
FOLLOW_UP_FALLBACK_CHAIN = [
"gemini-3.5-flash",
"gemini-3.1-flash-lite",
"gemini-3.5-flash-lite",
]
MODELS_CACHE_TTL_SECONDS = 600.0
_models_cache: dict[str, tuple[float, set[str]]] = {}
def _strip_preview(name: str) -> str:
return (
name.removesuffix("-preview").rstrip("-") if name.endswith("-preview") else name
)
def _dedup(names: list[str]) -> list[str]:
seen: set[str] = set()
result: list[str] = []
for name in names:
if name and name not in seen:
seen.add(name)
result.append(name)
return result
def _fetch_google_models(api_key: str) -> set[str]:
names: set[str] = set()
try:
from google import genai # noqa: PLC0415
client = genai.Client(api_key=api_key)
for model in client.models.list():
name = (model.name or "").removeprefix("models/")
actions = getattr(model, "supported_actions", None) or getattr(
model, "supported_generation_methods", None
)
if actions and "generateContent" not in actions:
continue
if name:
names.add(name)
except Exception as e: # noqa: BLE001
logger.warning(f"Failed to list Google models: {e}")
return names
async def _available_google_models(api_key: str) -> set[str]:
cached = _models_cache.get(api_key)
now = time.monotonic()
if cached and (now - cached[0]) < MODELS_CACHE_TTL_SECONDS:
return cached[1]
names = await asyncio.to_thread(_fetch_google_models, api_key)
if names:
_models_cache[api_key] = (now, names)
return names
def _pick_from_available(available: set[str]) -> list[str]:
gemini = sorted(
n for n in available if n.startswith("gemini-") and "preview" not in n
)
pros = [n for n in gemini if "pro" in n]
flashes = [n for n in gemini if "flash" in n]
picked = _dedup([*pros[:2], *flashes[:2]])
return picked or sorted(available)[:3]
def _anthropic_model() -> Model | None:
key = env.anthropic_api_key.get_secret_value()
if not key:
return None
from pydantic_ai.models.anthropic import AnthropicModel # noqa: PLC0415
from pydantic_ai.providers.anthropic import AnthropicProvider # noqa: PLC0415
return AnthropicModel(env.anthropic_model, provider=AnthropicProvider(api_key=key))
def _as_model(models: list[Model]) -> Model:
return models[0] if len(models) == 1 else FallbackModel(*models)
async def build_content_model(api_key: str, requested_model: str) -> Model:
candidates = _dedup(
[requested_model, _strip_preview(requested_model), *CONTENT_FALLBACK_CHAIN]
)
available = await _available_google_models(api_key)
if available:
live = [name for name in candidates if name in available]
candidates = live or _pick_from_available(available) or candidates
provider = GoogleProvider(api_key=api_key)
models: list[Model] = [GoogleModel(name, provider=provider) for name in candidates]
anthropic = _anthropic_model()
if anthropic:
models.append(anthropic)
return _as_model(models)
def build_follow_up_model(api_key: str, requested_model: str) -> Model:
candidates = _dedup(
[requested_model, _strip_preview(requested_model), *FOLLOW_UP_FALLBACK_CHAIN]
)
provider = GoogleProvider(api_key=api_key)
models: list[Model] = [GoogleModel(name, provider=provider) for name in candidates]
return _as_model(models)
@dataclass @dataclass
class ImageData: class ImageData:
@@ -51,19 +162,18 @@ RAG_SYSTEM_ADDITION = (
) )
def create_text_agent( async def create_text_agent(
api_key: str, api_key: str,
model_name: str = "gemini-3-pro-preview", model_name: str = "gemini-3-pro-preview",
system_prompt: str | None = None, system_prompt: str | None = None,
rag_db_names: list[str] | None = None, rag_db_names: list[str] | None = None,
) -> Agent[AgentDeps, str] | Agent[None, str]: ) -> Agent[AgentDeps, str] | Agent[None, str]:
provider = GoogleProvider(api_key=api_key) model = await build_content_model(api_key, model_name)
model = GoogleModel(model_name, provider=provider)
base_prompt = system_prompt or DEFAULT_SYSTEM_PROMPT base_prompt = system_prompt or DEFAULT_SYSTEM_PROMPT
if rag_db_names: if rag_db_names:
full_prompt = f"{base_prompt}{RAG_SYSTEM_ADDITION} {LATEX_INSTRUCTION}" full_prompt = f"{base_prompt}{RAG_SYSTEM_ADDITION} {LATEX_INSTRUCTION}"
agent: Agent[None, str] = Agent( agent: Agent[AgentDeps, str] = Agent(
model, instructions=full_prompt, deps_type=AgentDeps model, instructions=full_prompt, deps_type=AgentDeps
) )
@@ -101,13 +211,15 @@ def create_text_agent(
def create_follow_up_agent( def create_follow_up_agent(
api_key: str, api_key: str,
model_name: str = "gemini-2.5-flash-lite", model_name: str = "gemini-3.1-flash-lite-preview",
system_prompt: str | None = None, system_prompt: str | None = None,
) -> Agent[None, FollowUpOptions]: ) -> Agent[None, FollowUpOptions]:
provider = GoogleProvider(api_key=api_key) model = build_follow_up_model(api_key, model_name)
model = GoogleModel(model_name, provider=provider)
prompt = system_prompt or DEFAULT_FOLLOW_UP prompt = system_prompt or DEFAULT_FOLLOW_UP
return Agent(model, output_type=FollowUpOptions, instructions=prompt) agent: Agent[None, FollowUpOptions] = Agent( # ty: ignore[invalid-assignment]
model, output_type=FollowUpOptions, instructions=prompt
)
return agent
def build_message_history(history: list[dict[str, str]]) -> list[ModelMessage]: def build_message_history(history: list[dict[str, str]]) -> list[ModelMessage]:
+96
View File
@@ -104,6 +104,100 @@ Example output:
"3. Usually implemented as swapping randomly selected subtrees of parent trees" "3. Usually implemented as swapping randomly selected subtrees of parent trees"
""" """
REFERENCE_SYSTEM = """
You are an Examination Engine for solving problem sets, designed for Apple Watch output.
You operate against context bank:
<EXAM_MATERIALS>
{theory_database}
</EXAM_MATERIALS>
*** PROTOCOL: BATCH PROCESSING ***
1. **DETECT ALL** problems in input.
2. **SOLVE ALL** sequentially in one response.
3. **ORDER:** follow source numbering. Subparts (a, b, c) stay grouped under parent.
4. **SEPARATOR:** "---" between problems.
5. **CONTINUATION:** new page after partial solve → don't repeat solved tasks.
6. **NO PREAMBLE.** Start directly with **Ex. 1**. No "I see the following problems".
*** SOLVING LOGIC ***
This is a PROBLEM-SOLVING engine, not a theory recall engine.
Every problem gets a full derivation.
- **Honor EXAM_MATERIALS first.** If they specify a formula source, notation,
forbidden method, required step or example - comply.
- Mirror approach exactly: same notation, structure, justification depth, voice.
- If no match in materials → infer canonical structure from examples and apply.
- **Show all reasoning** that examples show.
Don't skip steps "because obvious" if examples don't skip them.
- **Brief justifications welcome** when examples use them
("by symmetry", "since disjoint", "WLOG"). Match voice.
*** APPLE WATCH FORMATTING (strict) ***
- Line width: MAX 25-30 chars. Force breaks often.
- Math: `$$...$$` display, `$...$` inline, standard LaTeX.
"""
CODING_SYSTEM = """
You help solve programming, algorithms (Python), and systems (Linux/C/OS)
exam problems.
Output is consumed on Apple Watch but answers must be paste-ready into Moodle/code boxes
*** PROTOCOL: BATCH PROCESSING ***
1. **DETECT ALL** problems in image, solve sequentially.
2. **ORDER:** follow numbering on the page.
3. **SEPARATOR:** "---" between problems.
4. **CONTINUATION:** new image = next page, don't repeat solved tasks.
5. **TEXT OVERRIDE:** user types something (e.g. "fix Q3", "redo b",
"explain why not c") → answer that specifically. Fuzzy match typos.
6. **NO PREAMBLE.** Start directly with **Q1**. No "I see the following...".
*** CORE PRINCIPLES ***
- **Read carefully.** Exam questions are full of traps:
off-by-one, "select ALL that apply", forbidden methods, edge cases
("what if input is empty / negative / EOF?"). Slow down on the wording.
- **Bold the final answer** of every problem. User scans for it on a watch.
- **Match what the question actually asks for.** If it asks for "the output",
give the output. If it asks "which option", give the letter. If it asks
"explain why", explain. Don't dump everything you know.
- **For MCQ / select-all:** evaluate every option explicitly, don't just pick
one. Mark each ✓/✗ with a one-line reason. Watch for "almost true but
technically wrong" distractors (wrong complexity, off-by-one in distances,
wrong constant in Big-O, etc.).
- **For code writing:** output COMPLETE, COPY-PASTEABLE code. No "...",
no TODOs, no "rest is similar". Match the starter template EXACTLY:
same includes, function names, signatures, return types. Respect
constraints stated in the problem - they are graded on those.
- **For traces / step-by-step execution** (sort steps, graph traversal,
shell command, register state, whatever): show the state at each step
in compact form. Don't summarize ("after 5 iterations..."), show them.
- **For "what does this command/code do" questions:** mentally execute it.
State assumptions about environment if relevant (cwd, perms, shell, libc).
- **When something is genuinely ambiguous in the problem,** state your
assumption in one line, then proceed. Don't ask back - exam mode.
*** APPLE WATCH FORMATTING ***
- **Prose lines:** ~2530 chars, force breaks often.
- **Code blocks:** full width is fine, user scrolls.
- **Bold** the final answer.
- No "Hope this helps", no "Let me know if...", no recap at the end.
- ALWAYS output code and commands inside ``` codeblocks to not trigger LaTeX rendering
"""
DEFAULT_FOLLOW_UP = ( DEFAULT_FOLLOW_UP = (
"Based on the conversation, suggest 3 short follow-up questions " "Based on the conversation, suggest 3 short follow-up questions "
"the user might want to ask. Each option should be under 50 characters." "the user might want to ask. Each option should be under 50 characters."
@@ -124,4 +218,6 @@ PRESETS: dict[str, tuple[str, str]] = {
"exam": (EXAM_SYSTEM, EXAM_FOLLOW_UP), "exam": (EXAM_SYSTEM, EXAM_FOLLOW_UP),
"ragtheory": (RAGTHEORY_SYSTEM, EXAM_FOLLOW_UP), "ragtheory": (RAGTHEORY_SYSTEM, EXAM_FOLLOW_UP),
"proofs": (PROOFS_SYSTEM, EXAM_FOLLOW_UP), "proofs": (PROOFS_SYSTEM, EXAM_FOLLOW_UP),
"reference": (REFERENCE_SYSTEM, EXAM_FOLLOW_UP),
"code": (CODING_SYSTEM, EXAM_FOLLOW_UP),
} }
+3
View File
@@ -5,6 +5,7 @@ import time
from aiogram import Bot from aiogram import Bot
from bot.handlers.message.handler import process_message_from_web from bot.handlers.message.handler import process_message_from_web
from bot.user_lock import get_user_lock
from utils import env from utils import env
from utils.collaborative import ( from utils.collaborative import (
CollaborativeClient, CollaborativeClient,
@@ -53,6 +54,7 @@ async def start_sync_listener(bot: Bot) -> None:
async def handle_pending_generation(bot: Bot, item: dict, item_id: str) -> None: async def handle_pending_generation(bot: Bot, item: dict, item_id: str) -> None:
try: try:
async with get_user_lock(item["userId"]):
await process_message_from_web( await process_message_from_web(
convex_user_id=item["userId"], convex_user_id=item["userId"],
text=item["userMessage"], text=item["userMessage"],
@@ -60,6 +62,7 @@ async def handle_pending_generation(bot: Bot, item: dict, item_id: str) -> None:
convex_chat_id=item["chatId"], convex_chat_id=item["chatId"],
images_base64=item.get("imagesBase64"), images_base64=item.get("imagesBase64"),
images_media_types=item.get("imagesMediaTypes"), images_media_types=item.get("imagesMediaTypes"),
pending_generation_id=item_id,
) )
except Exception as e: # noqa: BLE001 except Exception as e: # noqa: BLE001
logger.error(f"Error processing {item_id}: {e}") logger.error(f"Error processing {item_id}: {e}")
+11
View File
@@ -0,0 +1,11 @@
import asyncio
_locks: dict[str, asyncio.Lock] = {}
def get_user_lock(convex_user_id: str) -> asyncio.Lock:
lock = _locks.get(convex_user_id)
if lock is None:
lock = asyncio.Lock()
_locks[convex_user_id] = lock
return lock
+7
View File
@@ -36,6 +36,13 @@ class Settings(BaseSettings):
log: LogSettings log: LogSettings
collaborative: CollaborativeSettings collaborative: CollaborativeSettings
anthropic_api_key: SecretStr = Field(
default=SecretStr(""), validation_alias=AliasChoices("ANTHROPIC_API_KEY")
)
anthropic_model: str = Field(
default="claude-sonnet-4-5", validation_alias=AliasChoices("ANTHROPIC_MODEL")
)
convex_url: str = Field(validation_alias=AliasChoices("CONVEX_SELF_HOSTED_URL")) convex_url: str = Field(validation_alias=AliasChoices("CONVEX_SELF_HOSTED_URL"))
convex_http_url: str = Field( convex_http_url: str = Field(
default="", validation_alias=AliasChoices("CONVEX_HTTP_URL") default="", validation_alias=AliasChoices("CONVEX_HTTP_URL")
+214 -44
View File
@@ -126,6 +126,25 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" }, { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
] ]
[[package]]
name = "anthropic"
version = "0.105.2"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "distro" },
{ name = "docstring-parser" },
{ name = "httpx" },
{ name = "jiter" },
{ name = "pydantic" },
{ name = "sniffio" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/46/46/47581b8c689c743ceabf6a0f9ff48472160900ce802d26c0fb50423997b3/anthropic-0.105.2.tar.gz", hash = "sha256:0e26b90841c2dced7cc6e98d21d5517d0be33f1876b8e779f478202e28bcaa07", size = 853789, upload-time = "2026-05-29T00:21:14.104Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/83/75/be0c357e33a5a56c8f9db5b4212f886138d2bf59c0952d858f6b75d710ef/anthropic-0.105.2-py3-none-any.whl", hash = "sha256:e53ed5f6bf36fb1ecb9b25d8634cfd30e02fab9fb3374a0c2d5c585874757230", size = 837507, upload-time = "2026-05-29T00:21:15.528Z" },
]
[[package]] [[package]]
name = "anyio" name = "anyio"
version = "4.12.1" version = "4.12.1"
@@ -154,7 +173,8 @@ source = { editable = "." }
dependencies = [ dependencies = [
{ name = "aiogram" }, { name = "aiogram" },
{ name = "convex" }, { name = "convex" },
{ name = "pydantic-ai-slim", extra = ["google"] }, { name = "httpx" },
{ name = "pydantic-ai-slim", extra = ["anthropic", "google"] },
{ name = "pydantic-settings" }, { name = "pydantic-settings" },
{ name = "rich" }, { name = "rich" },
{ name = "xkcdpass" }, { name = "xkcdpass" },
@@ -164,7 +184,8 @@ dependencies = [
requires-dist = [ requires-dist = [
{ name = "aiogram", specifier = ">=3.24.0" }, { name = "aiogram", specifier = ">=3.24.0" },
{ name = "convex", specifier = ">=0.7.0" }, { name = "convex", specifier = ">=0.7.0" },
{ name = "pydantic-ai-slim", extras = ["google"], specifier = ">=1.44.0" }, { name = "httpx", specifier = ">=0.27" },
{ name = "pydantic-ai-slim", extras = ["google", "anthropic"], specifier = ">=1.44.0" },
{ name = "pydantic-settings", specifier = ">=2.12.0" }, { name = "pydantic-settings", specifier = ">=2.12.0" },
{ name = "rich", specifier = ">=14.2.0" }, { name = "rich", specifier = ">=14.2.0" },
{ name = "xkcdpass", specifier = ">=1.19.0" }, { name = "xkcdpass", specifier = ">=1.19.0" },
@@ -179,6 +200,51 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900, upload-time = "2026-01-04T02:42:40.15Z" }, { url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900, upload-time = "2026-01-04T02:42:40.15Z" },
] ]
[[package]]
name = "cffi"
version = "2.0.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pycparser", marker = "implementation_name != 'PyPy'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/eb/56/b1ba7935a17738ae8453301356628e8147c79dbb825bcbc73dc7401f9846/cffi-2.0.0.tar.gz", hash = "sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529", size = 523588, upload-time = "2025-09-08T23:24:04.541Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/4b/8d/a0a47a0c9e413a658623d014e91e74a50cdd2c423f7ccfd44086ef767f90/cffi-2.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb", size = 185230, upload-time = "2025-09-08T23:23:00.879Z" },
{ url = "https://files.pythonhosted.org/packages/4a/d2/a6c0296814556c68ee32009d9c2ad4f85f2707cdecfd7727951ec228005d/cffi-2.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:45d5e886156860dc35862657e1494b9bae8dfa63bf56796f2fb56e1679fc0bca", size = 181043, upload-time = "2025-09-08T23:23:02.231Z" },
{ url = "https://files.pythonhosted.org/packages/b0/1e/d22cc63332bd59b06481ceaac49d6c507598642e2230f201649058a7e704/cffi-2.0.0-cp313-cp313-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:07b271772c100085dd28b74fa0cd81c8fb1a3ba18b21e03d7c27f3436a10606b", size = 212446, upload-time = "2025-09-08T23:23:03.472Z" },
{ url = "https://files.pythonhosted.org/packages/a9/f5/a2c23eb03b61a0b8747f211eb716446c826ad66818ddc7810cc2cc19b3f2/cffi-2.0.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d48a880098c96020b02d5a1f7d9251308510ce8858940e6fa99ece33f610838b", size = 220101, upload-time = "2025-09-08T23:23:04.792Z" },
{ url = "https://files.pythonhosted.org/packages/f2/7f/e6647792fc5850d634695bc0e6ab4111ae88e89981d35ac269956605feba/cffi-2.0.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:f93fd8e5c8c0a4aa1f424d6173f14a892044054871c771f8566e4008eaa359d2", size = 207948, upload-time = "2025-09-08T23:23:06.127Z" },
{ url = "https://files.pythonhosted.org/packages/cb/1e/a5a1bd6f1fb30f22573f76533de12a00bf274abcdc55c8edab639078abb6/cffi-2.0.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:dd4f05f54a52fb558f1ba9f528228066954fee3ebe629fc1660d874d040ae5a3", size = 206422, upload-time = "2025-09-08T23:23:07.753Z" },
{ url = "https://files.pythonhosted.org/packages/98/df/0a1755e750013a2081e863e7cd37e0cdd02664372c754e5560099eb7aa44/cffi-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c8d3b5532fc71b7a77c09192b4a5a200ea992702734a2e9279a37f2478236f26", size = 219499, upload-time = "2025-09-08T23:23:09.648Z" },
{ url = "https://files.pythonhosted.org/packages/50/e1/a969e687fcf9ea58e6e2a928ad5e2dd88cc12f6f0ab477e9971f2309b57c/cffi-2.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d9b29c1f0ae438d5ee9acb31cadee00a58c46cc9c0b2f9038c6b0b3470877a8c", size = 222928, upload-time = "2025-09-08T23:23:10.928Z" },
{ url = "https://files.pythonhosted.org/packages/36/54/0362578dd2c9e557a28ac77698ed67323ed5b9775ca9d3fe73fe191bb5d8/cffi-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6d50360be4546678fc1b79ffe7a66265e28667840010348dd69a314145807a1b", size = 221302, upload-time = "2025-09-08T23:23:12.42Z" },
{ url = "https://files.pythonhosted.org/packages/eb/6d/bf9bda840d5f1dfdbf0feca87fbdb64a918a69bca42cfa0ba7b137c48cb8/cffi-2.0.0-cp313-cp313-win32.whl", hash = "sha256:74a03b9698e198d47562765773b4a8309919089150a0bb17d829ad7b44b60d27", size = 172909, upload-time = "2025-09-08T23:23:14.32Z" },
{ url = "https://files.pythonhosted.org/packages/37/18/6519e1ee6f5a1e579e04b9ddb6f1676c17368a7aba48299c3759bbc3c8b3/cffi-2.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:19f705ada2530c1167abacb171925dd886168931e0a7b78f5bffcae5c6b5be75", size = 183402, upload-time = "2025-09-08T23:23:15.535Z" },
{ url = "https://files.pythonhosted.org/packages/cb/0e/02ceeec9a7d6ee63bb596121c2c8e9b3a9e150936f4fbef6ca1943e6137c/cffi-2.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:256f80b80ca3853f90c21b23ee78cd008713787b1b1e93eae9f3d6a7134abd91", size = 177780, upload-time = "2025-09-08T23:23:16.761Z" },
{ url = "https://files.pythonhosted.org/packages/92/c4/3ce07396253a83250ee98564f8d7e9789fab8e58858f35d07a9a2c78de9f/cffi-2.0.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5", size = 185320, upload-time = "2025-09-08T23:23:18.087Z" },
{ url = "https://files.pythonhosted.org/packages/59/dd/27e9fa567a23931c838c6b02d0764611c62290062a6d4e8ff7863daf9730/cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13", size = 181487, upload-time = "2025-09-08T23:23:19.622Z" },
{ url = "https://files.pythonhosted.org/packages/d6/43/0e822876f87ea8a4ef95442c3d766a06a51fc5298823f884ef87aaad168c/cffi-2.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b", size = 220049, upload-time = "2025-09-08T23:23:20.853Z" },
{ url = "https://files.pythonhosted.org/packages/b4/89/76799151d9c2d2d1ead63c2429da9ea9d7aac304603de0c6e8764e6e8e70/cffi-2.0.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c", size = 207793, upload-time = "2025-09-08T23:23:22.08Z" },
{ url = "https://files.pythonhosted.org/packages/bb/dd/3465b14bb9e24ee24cb88c9e3730f6de63111fffe513492bf8c808a3547e/cffi-2.0.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef", size = 206300, upload-time = "2025-09-08T23:23:23.314Z" },
{ url = "https://files.pythonhosted.org/packages/47/d9/d83e293854571c877a92da46fdec39158f8d7e68da75bf73581225d28e90/cffi-2.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775", size = 219244, upload-time = "2025-09-08T23:23:24.541Z" },
{ url = "https://files.pythonhosted.org/packages/2b/0f/1f177e3683aead2bb00f7679a16451d302c436b5cbf2505f0ea8146ef59e/cffi-2.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205", size = 222828, upload-time = "2025-09-08T23:23:26.143Z" },
{ url = "https://files.pythonhosted.org/packages/c6/0f/cafacebd4b040e3119dcb32fed8bdef8dfe94da653155f9d0b9dc660166e/cffi-2.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1", size = 220926, upload-time = "2025-09-08T23:23:27.873Z" },
{ url = "https://files.pythonhosted.org/packages/3e/aa/df335faa45b395396fcbc03de2dfcab242cd61a9900e914fe682a59170b1/cffi-2.0.0-cp314-cp314-win32.whl", hash = "sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f", size = 175328, upload-time = "2025-09-08T23:23:44.61Z" },
{ url = "https://files.pythonhosted.org/packages/bb/92/882c2d30831744296ce713f0feb4c1cd30f346ef747b530b5318715cc367/cffi-2.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25", size = 185650, upload-time = "2025-09-08T23:23:45.848Z" },
{ url = "https://files.pythonhosted.org/packages/9f/2c/98ece204b9d35a7366b5b2c6539c350313ca13932143e79dc133ba757104/cffi-2.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad", size = 180687, upload-time = "2025-09-08T23:23:47.105Z" },
{ url = "https://files.pythonhosted.org/packages/3e/61/c768e4d548bfa607abcda77423448df8c471f25dbe64fb2ef6d555eae006/cffi-2.0.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9", size = 188773, upload-time = "2025-09-08T23:23:29.347Z" },
{ url = "https://files.pythonhosted.org/packages/2c/ea/5f76bce7cf6fcd0ab1a1058b5af899bfbef198bea4d5686da88471ea0336/cffi-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d", size = 185013, upload-time = "2025-09-08T23:23:30.63Z" },
{ url = "https://files.pythonhosted.org/packages/be/b4/c56878d0d1755cf9caa54ba71e5d049479c52f9e4afc230f06822162ab2f/cffi-2.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c", size = 221593, upload-time = "2025-09-08T23:23:31.91Z" },
{ url = "https://files.pythonhosted.org/packages/e0/0d/eb704606dfe8033e7128df5e90fee946bbcb64a04fcdaa97321309004000/cffi-2.0.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8", size = 209354, upload-time = "2025-09-08T23:23:33.214Z" },
{ url = "https://files.pythonhosted.org/packages/d8/19/3c435d727b368ca475fb8742ab97c9cb13a0de600ce86f62eab7fa3eea60/cffi-2.0.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc", size = 208480, upload-time = "2025-09-08T23:23:34.495Z" },
{ url = "https://files.pythonhosted.org/packages/d0/44/681604464ed9541673e486521497406fadcc15b5217c3e326b061696899a/cffi-2.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592", size = 221584, upload-time = "2025-09-08T23:23:36.096Z" },
{ url = "https://files.pythonhosted.org/packages/25/8e/342a504ff018a2825d395d44d63a767dd8ebc927ebda557fecdaca3ac33a/cffi-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512", size = 224443, upload-time = "2025-09-08T23:23:37.328Z" },
{ url = "https://files.pythonhosted.org/packages/e1/5e/b666bacbbc60fbf415ba9988324a132c9a7a0448a9a8f125074671c0f2c3/cffi-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4", size = 223437, upload-time = "2025-09-08T23:23:38.945Z" },
{ url = "https://files.pythonhosted.org/packages/a0/1d/ec1a60bd1a10daa292d3cd6bb0b359a81607154fb8165f3ec95fe003b85c/cffi-2.0.0-cp314-cp314t-win32.whl", hash = "sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e", size = 180487, upload-time = "2025-09-08T23:23:40.423Z" },
{ url = "https://files.pythonhosted.org/packages/bf/41/4c1168c74fac325c0c8156f04b6749c8b6a8f405bbf91413ba088359f60d/cffi-2.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6", size = 191726, upload-time = "2025-09-08T23:23:41.742Z" },
{ url = "https://files.pythonhosted.org/packages/ae/3a/dbeec9d1ee0844c679f6bb5d6ad4e9f198b1224f4e7a32825f47f6192b0c/cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9", size = 184195, upload-time = "2025-09-08T23:23:43.004Z" },
]
[[package]] [[package]]
name = "charset-normalizer" name = "charset-normalizer"
version = "3.4.4" version = "3.4.4"
@@ -220,15 +286,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402, upload-time = "2025-10-14T04:42:31.76Z" }, { url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402, upload-time = "2025-10-14T04:42:31.76Z" },
] ]
[[package]]
name = "colorama"
version = "0.4.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
]
[[package]] [[package]]
name = "convex" name = "convex"
version = "0.7.0" version = "0.7.0"
@@ -263,6 +320,59 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/5d/a6/b01145a2a25c00024809dedf5fce0dc5e7cb3fbde477112e5569f35ff7d1/convex-0.7.0-cp39-abi3-win_amd64.whl", hash = "sha256:ee71e10a883fed22d2d2d43e828162eb0afe2071699fd36d6b0ba63a9639fee1", size = 1150704, upload-time = "2024-12-17T01:03:22.904Z" }, { url = "https://files.pythonhosted.org/packages/5d/a6/b01145a2a25c00024809dedf5fce0dc5e7cb3fbde477112e5569f35ff7d1/convex-0.7.0-cp39-abi3-win_amd64.whl", hash = "sha256:ee71e10a883fed22d2d2d43e828162eb0afe2071699fd36d6b0ba63a9639fee1", size = 1150704, upload-time = "2024-12-17T01:03:22.904Z" },
] ]
[[package]]
name = "cryptography"
version = "47.0.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "cffi", marker = "platform_python_implementation != 'PyPy'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/ef/b2/7ffa7fe8207a8c42147ffe70c3e360b228160c1d85dc3faff16aaa3244c0/cryptography-47.0.0.tar.gz", hash = "sha256:9f8e55fe4e63613a5e1cc5819030f27b97742d720203a087802ce4ce9ceb52bb", size = 830863, upload-time = "2026-04-24T19:54:57.056Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a4/98/40dfe932134bdcae4f6ab5927c87488754bf9eb79297d7e0070b78dd58e9/cryptography-47.0.0-cp311-abi3-macosx_10_9_universal2.whl", hash = "sha256:160ad728f128972d362e714054f6ba0067cab7fb350c5202a9ae8ae4ce3ef1a0", size = 7912214, upload-time = "2026-04-24T19:53:03.864Z" },
{ url = "https://files.pythonhosted.org/packages/34/c6/2733531243fba725f58611b918056b277692f1033373dcc8bd01af1c05d4/cryptography-47.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b9a8943e359b7615db1a3ba587994618e094ff3d6fa5a390c73d079ce18b3973", size = 4644617, upload-time = "2026-04-24T19:53:06.909Z" },
{ url = "https://files.pythonhosted.org/packages/00/e3/b27be1a670a9b87f855d211cf0e1174a5d721216b7616bd52d8581d912ed/cryptography-47.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f5c15764f261394b22aef6b00252f5195f46f2ca300bec57149474e2538b31f8", size = 4668186, upload-time = "2026-04-24T19:53:09.053Z" },
{ url = "https://files.pythonhosted.org/packages/81/b9/8443cfe5d17d482d348cee7048acf502bb89a51b6382f06240fd290d4ca3/cryptography-47.0.0-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:9c59ab0e0fa3a180a5a9c59f3a5abe3ef90d474bc56d7fadfbe80359491b615b", size = 4651244, upload-time = "2026-04-24T19:53:11.217Z" },
{ url = "https://files.pythonhosted.org/packages/5d/5e/13ed0cdd0eb88ba159d6dd5ebfece8cb901dbcf1ae5ac4072e28b55d3153/cryptography-47.0.0-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:34b4358b925a5ea3e14384ca781a2c0ef7ac219b57bb9eacc4457078e2b19f92", size = 5252906, upload-time = "2026-04-24T19:53:13.532Z" },
{ url = "https://files.pythonhosted.org/packages/64/16/ed058e1df0f33d440217cd120d41d5dda9dd215a80b8187f68483185af82/cryptography-47.0.0-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:0024b87d47ae2399165a6bfb20d24888881eeab83ae2566d62467c5ff0030ce7", size = 4701842, upload-time = "2026-04-24T19:53:15.618Z" },
{ url = "https://files.pythonhosted.org/packages/02/e0/3d30986b30fdbd9e969abbdf8ba00ed0618615144341faeb57f395a084fe/cryptography-47.0.0-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:1e47422b5557bb82d3fff997e8d92cff4e28b9789576984f08c248d2b3535d93", size = 4289313, upload-time = "2026-04-24T19:53:17.755Z" },
{ url = "https://files.pythonhosted.org/packages/df/fd/32db38e3ad0cb331f0691cb4c7a8a6f176f679124dee746b3af6633db4d9/cryptography-47.0.0-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:6f29f36582e6151d9686235e586dd35bb67491f024767d10b842e520dc6a07ac", size = 4650964, upload-time = "2026-04-24T19:53:20.062Z" },
{ url = "https://files.pythonhosted.org/packages/86/53/5395d944dfd48cb1f67917f533c609c34347185ef15eb4308024c876f274/cryptography-47.0.0-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:a9b761f012a943b7de0e828843c5688d0de94a0578d44d6c85a1bae32f87791f", size = 5207817, upload-time = "2026-04-24T19:53:22.498Z" },
{ url = "https://files.pythonhosted.org/packages/34/4f/e5711b28e1901f7d480a2b1b688b645aa4c77c73f10731ed17e7f7db3f0d/cryptography-47.0.0-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:4e1de79e047e25d6e9f8cea71c86b4a53aced64134f0f003bbcbf3655fd172c8", size = 4701544, upload-time = "2026-04-24T19:53:24.356Z" },
{ url = "https://files.pythonhosted.org/packages/22/22/c8ddc25de3010fc8da447648f5a092c40e7a8fadf01dd6d255d9c0b9373d/cryptography-47.0.0-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ef6b3634087f18d2155b1e8ce264e5345a753da2c5fa9815e7d41315c90f8318", size = 4783536, upload-time = "2026-04-24T19:53:26.665Z" },
{ url = "https://files.pythonhosted.org/packages/66/b6/d4a68f4ea999c6d89e8498579cba1c5fcba4276284de7773b17e4fa69293/cryptography-47.0.0-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:11dbb9f50a0f1bb9757b3d8c27c1101780efb8f0bdecfb12439c22a74d64c001", size = 4926106, upload-time = "2026-04-24T19:53:28.686Z" },
{ url = "https://files.pythonhosted.org/packages/54/ed/5f524db1fade9c013aa618e1c99c6ed05e8ffc9ceee6cda22fed22dda3f4/cryptography-47.0.0-cp311-abi3-win32.whl", hash = "sha256:7fda2f02c9015db3f42bb8a22324a454516ed10a8c29ca6ece6cdbb5efe2a203", size = 3258581, upload-time = "2026-04-24T19:53:31.058Z" },
{ url = "https://files.pythonhosted.org/packages/b2/dc/1b901990b174786569029f67542b3edf72ac068b6c3c8683c17e6a2f5363/cryptography-47.0.0-cp311-abi3-win_amd64.whl", hash = "sha256:f5c3296dab66202f1b18a91fa266be93d6aa0c2806ea3d67762c69f60adc71aa", size = 3775309, upload-time = "2026-04-24T19:53:33.054Z" },
{ url = "https://files.pythonhosted.org/packages/14/88/7aa18ad9c11bc87689affa5ce4368d884b517502d75739d475fc6f4a03c7/cryptography-47.0.0-cp314-cp314t-macosx_10_9_universal2.whl", hash = "sha256:be12cb6a204f77ed968bcefe68086eb061695b540a3dd05edac507a3111b25f0", size = 7904299, upload-time = "2026-04-24T19:53:35.003Z" },
{ url = "https://files.pythonhosted.org/packages/07/55/c18f75724544872f234678fdedc871391722cb34a2aee19faa9f63100bb2/cryptography-47.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:2ebd84adf0728c039a3be2700289378e1c164afc6748df1a5ed456767bef9ba7", size = 4631180, upload-time = "2026-04-24T19:53:37.517Z" },
{ url = "https://files.pythonhosted.org/packages/ee/65/31a5cc0eaca99cec5bafffe155d407115d96136bb161e8b49e0ef73f09a7/cryptography-47.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7f68d6fbc7fbbcfb0939fea72c3b96a9f9a6edfc0e1b1d29778a2066030418b1", size = 4653529, upload-time = "2026-04-24T19:53:39.775Z" },
{ url = "https://files.pythonhosted.org/packages/e5/bc/641c0519a495f3bfd0421b48d7cd325c4336578523ccd76ea322b6c29c7a/cryptography-47.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:6651d32eff255423503aa276739da98c30f26c40cbeffcc6048e0d54ef704c0c", size = 4638570, upload-time = "2026-04-24T19:53:42.129Z" },
{ url = "https://files.pythonhosted.org/packages/2b/f2/300327b0a47f6dc94dd8b71b57052aefe178bb51745073d73d80604f11ab/cryptography-47.0.0-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:3fb8fa48075fad7193f2e5496135c6a76ac4b2aa5a38433df0a539296b377829", size = 5238019, upload-time = "2026-04-24T19:53:44.577Z" },
{ url = "https://files.pythonhosted.org/packages/e9/5a/5b5cf994391d4bf9d9c7efd4c66aabe4d95227256627f8fea6cff7dfadbd/cryptography-47.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:11438c7518132d95f354fa01a4aa2f806d172a061a7bed18cf18cbdacdb204d7", size = 4686832, upload-time = "2026-04-24T19:53:47.015Z" },
{ url = "https://files.pythonhosted.org/packages/dc/2c/ae950e28fd6475c852fc21a44db3e6b5bcc1261d1e370f2b6e42fa800fef/cryptography-47.0.0-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:8c1a736bbb3288005796c3f7ccb9453360d7fed483b13b9f468aea5171432923", size = 4269301, upload-time = "2026-04-24T19:53:48.97Z" },
{ url = "https://files.pythonhosted.org/packages/67/fb/6a39782e150ffe5cc1b0018cb6ddc48bf7ca62b498d7539ffc8a758e977d/cryptography-47.0.0-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:f1557695e5c2b86e204f6ce9470497848634100787935ab7adc5397c54abd7ab", size = 4638110, upload-time = "2026-04-24T19:53:51.011Z" },
{ url = "https://files.pythonhosted.org/packages/8e/d7/0b3c71090a76e5c203164a47688b697635ece006dcd2499ab3a4dbd3f0bd/cryptography-47.0.0-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:f9a034b642b960767fb343766ae5ba6ad653f2e890ddd82955aef288ffea8736", size = 5194988, upload-time = "2026-04-24T19:53:52.962Z" },
{ url = "https://files.pythonhosted.org/packages/63/33/63a961498a9df51721ab578c5a2622661411fc520e00bd83b0cc64eb20c4/cryptography-47.0.0-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:b1c76fca783aa7698eb21eb14f9c4aa09452248ee54a627d125025a43f83e7a7", size = 4686563, upload-time = "2026-04-24T19:53:55.274Z" },
{ url = "https://files.pythonhosted.org/packages/b7/bf/5ee5b145248f92250de86145d1c1d6edebbd57a7fe7caa4dedb5d4cf06a1/cryptography-47.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:4f7722c97826770bab8ae92959a2e7b20a5e9e9bf4deae68fd86c3ca457bab52", size = 4770094, upload-time = "2026-04-24T19:53:57.753Z" },
{ url = "https://files.pythonhosted.org/packages/92/43/21d220b2da5d517773894dacdcdb5c682c28d3fffce65548cb06e87d5501/cryptography-47.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:09f6d7bf6724f8db8b32f11eccf23efc8e759924bc5603800335cf8859a3ddbd", size = 4913811, upload-time = "2026-04-24T19:54:00.236Z" },
{ url = "https://files.pythonhosted.org/packages/31/98/dc4ad376ac5f1a1a7d4a83f7b0c6f2bcad36b5d2d8f30aeb482d3a7d9582/cryptography-47.0.0-cp314-cp314t-win32.whl", hash = "sha256:6eebcaf0df1d21ce1f90605c9b432dd2c4f4ab665ac29a40d5e3fc68f51b5e63", size = 3237158, upload-time = "2026-04-24T19:54:02.606Z" },
{ url = "https://files.pythonhosted.org/packages/bc/da/97f62d18306b5133468bc3f8cc73a3111e8cdc8cf8d3e69474d6e5fd2d1b/cryptography-47.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:51c9313e90bd1690ec5a75ed047c27c0b8e6c570029712943d6116ef9a90620b", size = 3758706, upload-time = "2026-04-24T19:54:04.433Z" },
{ url = "https://files.pythonhosted.org/packages/e0/34/a4fae8ae7c3bc227460c9ae43f56abf1b911da0ec29e0ebac53bb0a4b6b7/cryptography-47.0.0-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:14432c8a9bcb37009784f9594a62fae211a2ae9543e96c92b2a8e4c3cd5cd0c4", size = 7904072, upload-time = "2026-04-24T19:54:06.411Z" },
{ url = "https://files.pythonhosted.org/packages/01/64/d7b1e54fdb69f22d24a64bb3e88dc718b31c7fb10ef0b9691a3cf7eeea6e/cryptography-47.0.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:07efe86201817e7d3c18781ca9770bc0db04e1e48c994be384e4602bc38f8f27", size = 4635767, upload-time = "2026-04-24T19:54:08.519Z" },
{ url = "https://files.pythonhosted.org/packages/8b/7b/cca826391fb2a94efdcdfe4631eb69306ee1cff0b22f664a412c90713877/cryptography-47.0.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2b45761c6ec22b7c726d6a829558777e32d0f1c8be7c3f3480f9c912d5ee8a10", size = 4654350, upload-time = "2026-04-24T19:54:10.795Z" },
{ url = "https://files.pythonhosted.org/packages/4c/65/4b57bcc823f42a991627c51c2f68c9fd6eb1393c1756aac876cba2accae2/cryptography-47.0.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:edd4da498015da5b9f26d38d3bfc2e90257bfa9cbed1f6767c282a0025ae649b", size = 4643394, upload-time = "2026-04-24T19:54:13.275Z" },
{ url = "https://files.pythonhosted.org/packages/f4/c4/2c5fbeea70adbbca2bbae865e1d605d6a4a7f8dbd9d33eaf69645087f06c/cryptography-47.0.0-cp38-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:9af828c0d5a65c70ec729cd7495a4bf1a67ecb66417b8f02ff125ab8a6326a74", size = 5225777, upload-time = "2026-04-24T19:54:15.18Z" },
{ url = "https://files.pythonhosted.org/packages/7e/b8/ac57107ef32749d2b244e36069bb688792a363aaaa3acc9e3cf84c130315/cryptography-47.0.0-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:256d07c78a04d6b276f5df935a9923275f53bd1522f214447fdf365494e2d515", size = 4688771, upload-time = "2026-04-24T19:54:17.835Z" },
{ url = "https://files.pythonhosted.org/packages/56/fc/9f1de22ff8be99d991f240a46863c52d475404c408886c5a38d2b5c3bb26/cryptography-47.0.0-cp38-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:5d0e362ff51041b0c0d219cc7d6924d7b8996f57ce5712bdcef71eb3c65a59cc", size = 4270753, upload-time = "2026-04-24T19:54:19.963Z" },
{ url = "https://files.pythonhosted.org/packages/00/68/d70c852797aa68e8e48d12e5a87170c43f67bb4a59403627259dd57d15de/cryptography-47.0.0-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:1581aef4219f7ca2849d0250edaa3866212fb74bf5667284f46aa92f9e65c1ca", size = 4642911, upload-time = "2026-04-24T19:54:21.818Z" },
{ url = "https://files.pythonhosted.org/packages/a5/51/661cbee74f594c5d97ff82d34f10d5551c085ca4668645f4606ebd22bd5d/cryptography-47.0.0-cp38-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:a49a3eb5341b9503fa3000a9a0db033161db90d47285291f53c2a9d2cd1b7f76", size = 5181411, upload-time = "2026-04-24T19:54:24.376Z" },
{ url = "https://files.pythonhosted.org/packages/94/87/f2b6c374a82cf076cfa1416992ac8e8ec94d79facc37aec87c1a5cb72352/cryptography-47.0.0-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:2207a498b03275d0051589e326b79d4cf59985c99031b05bb292ac52631c37fe", size = 4688262, upload-time = "2026-04-24T19:54:26.946Z" },
{ url = "https://files.pythonhosted.org/packages/14/e2/8b7462f4acf21ec509616f0245018bb197194ab0b65c2ea21a0bdd53c0eb/cryptography-47.0.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:7a02675e2fabd0c0fc04c868b8781863cbf1967691543c22f5470500ff840b31", size = 4775506, upload-time = "2026-04-24T19:54:28.926Z" },
{ url = "https://files.pythonhosted.org/packages/70/75/158e494e4c08dc05e039da5bb48553826bd26c23930cf8d3cd5f21fa8921/cryptography-47.0.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:80887c5cbd1774683cb126f0ab4184567f080071d5acf62205acb354b4b753b7", size = 4912060, upload-time = "2026-04-24T19:54:30.869Z" },
{ url = "https://files.pythonhosted.org/packages/06/bd/0a9d3edbf5eadbac926d7b9b3cd0c4be584eeeae4a003d24d9eda4affbbd/cryptography-47.0.0-cp38-abi3-win32.whl", hash = "sha256:ed67ea4e0cfb5faa5bc7ecb6e2b8838f3807a03758eec239d6c21c8769355310", size = 3248487, upload-time = "2026-04-24T19:54:33.494Z" },
{ url = "https://files.pythonhosted.org/packages/60/80/5681af756d0da3a599b7bdb586fac5a1540f1bcefd2717a20e611ddade45/cryptography-47.0.0-cp38-abi3-win_amd64.whl", hash = "sha256:835d2d7f47cdc53b3224e90810fb1d36ca94ea29cc1801fb4c1bc43876735769", size = 3755737, upload-time = "2026-04-24T19:54:35.408Z" },
]
[[package]] [[package]]
name = "distro" name = "distro"
version = "1.9.0" version = "1.9.0"
@@ -272,6 +382,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" }, { url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" },
] ]
[[package]]
name = "docstring-parser"
version = "0.18.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/e0/4d/f332313098c1de1b2d2ff91cf2674415cc7cddab2ca1b01ae29774bd5fdf/docstring_parser-0.18.0.tar.gz", hash = "sha256:292510982205c12b1248696f44959db3cdd1740237a968ea1e2e7a900eeb2015", size = 29341, upload-time = "2026-04-14T04:09:19.867Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a7/5f/ed01f9a3cdffbd5a008556fc7b2a08ddb1cc6ace7effa7340604b1d16699/docstring_parser-0.18.0-py3-none-any.whl", hash = "sha256:b3fcbed555c47d8479be0796ef7e19c2670d428d72e96da63f3a40122860374b", size = 22484, upload-time = "2026-04-14T04:09:18.638Z" },
]
[[package]] [[package]]
name = "frozenlist" name = "frozenlist"
version = "1.8.0" version = "1.8.0"
@@ -360,15 +479,15 @@ wheels = [
[[package]] [[package]]
name = "google-auth" name = "google-auth"
version = "2.47.0" version = "2.50.0"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "cryptography" },
{ name = "pyasn1-modules" }, { name = "pyasn1-modules" },
{ name = "rsa" },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/60/3c/ec64b9a275ca22fa1cd3b6e77fefcf837b0732c890aa32d2bd21313d9b33/google_auth-2.47.0.tar.gz", hash = "sha256:833229070a9dfee1a353ae9877dcd2dec069a8281a4e72e72f77d4a70ff945da", size = 323719, upload-time = "2026-01-06T21:55:31.045Z" } sdist = { url = "https://files.pythonhosted.org/packages/5f/18/238d7021d151bdab868f23433817b027dd759135202f4dfce0670d1230ca/google_auth-2.50.0.tar.gz", hash = "sha256:f35eafb191195328e8ce10a7883970877e7aeb49c2bfaa54aa0e394316d353d0", size = 336523, upload-time = "2026-04-30T21:19:29.659Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/db/18/79e9008530b79527e0d5f79e7eef08d3b179b7f851cfd3a2f27822fbdfa9/google_auth-2.47.0-py3-none-any.whl", hash = "sha256:c516d68336bfde7cf0da26aab674a36fedcf04b37ac4edd59c597178760c3498", size = 234867, upload-time = "2026-01-06T21:55:28.6Z" }, { url = "https://files.pythonhosted.org/packages/37/cf/4880c2137c14280b2f59975cdf12cc442bc0ae1f9ea473a26eaa0c146786/google_auth-2.50.0-py3-none-any.whl", hash = "sha256:04382175e28b94f49694977f0a792688b59a668def1499e9d8de996dc9ce5b15", size = 246495, upload-time = "2026-04-30T21:19:27.664Z" },
] ]
[package.optional-dependencies] [package.optional-dependencies]
@@ -378,7 +497,7 @@ requests = [
[[package]] [[package]]
name = "google-genai" name = "google-genai"
version = "1.59.0" version = "1.74.0"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "anyio" }, { name = "anyio" },
@@ -392,21 +511,18 @@ dependencies = [
{ name = "typing-extensions" }, { name = "typing-extensions" },
{ name = "websockets" }, { name = "websockets" },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/40/34/c03bcbc759d67ac3d96077838cdc1eac85417de6ea3b65b313fe53043eee/google_genai-1.59.0.tar.gz", hash = "sha256:0b7a2dc24582850ae57294209d8dfc2c4f5fcfde0a3f11d81dc5aca75fb619e2", size = 487374, upload-time = "2026-01-15T20:29:46.619Z" } sdist = { url = "https://files.pythonhosted.org/packages/33/c8/4a8f1de0a3268d526a345b8c74456b3e1e6ffd200982626326cf7ca83e5b/google_genai-1.74.0.tar.gz", hash = "sha256:c4c473cebdeb6e5adbb0639326de66a3a85a2209e0d32de7d66bf05c698abae8", size = 536772, upload-time = "2026-04-29T22:16:35.881Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/aa/53/6d00692fe50d73409b3406ae90c71bc4499c8ae7fac377ba16e283da917c/google_genai-1.59.0-py3-none-any.whl", hash = "sha256:59fc01a225d074fe9d1e626c3433da292f33249dadce4deb34edea698305a6df", size = 719099, upload-time = "2026-01-15T20:29:44.604Z" }, { url = "https://files.pythonhosted.org/packages/ca/2b/539c328b66f7bfef2df869371a1789361228e5a7694ba02a642608367b46/google_genai-1.74.0-py3-none-any.whl", hash = "sha256:87d0b311c67d4b2a0ca741e9fc6891330c29defae81d46d8db41079aa1a3d80a", size = 790433, upload-time = "2026-04-29T22:16:33.979Z" },
] ]
[[package]] [[package]]
name = "griffe" name = "griffelib"
version = "1.15.0" version = "2.0.2"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ sdist = { url = "https://files.pythonhosted.org/packages/9d/82/74f4a3310cdabfbb10da554c3a672847f1ed33c6f61dd472681ce7f1fe67/griffelib-2.0.2.tar.gz", hash = "sha256:3cf20b3bc470e83763ffbf236e0076b1211bac1bc67de13daf494640f2de707e", size = 166461, upload-time = "2026-03-27T11:34:51.091Z" }
{ name = "colorama" },
]
sdist = { url = "https://files.pythonhosted.org/packages/0d/0c/3a471b6e31951dce2360477420d0a8d1e00dea6cf33b70f3e8c3ab6e28e1/griffe-1.15.0.tar.gz", hash = "sha256:7726e3afd6f298fbc3696e67958803e7ac843c1cfe59734b6251a40cdbfb5eea", size = 424112, upload-time = "2025-11-10T15:03:15.52Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/9c/83/3b1d03d36f224edded98e9affd0467630fc09d766c0e56fb1498cbb04a9b/griffe-1.15.0-py3-none-any.whl", hash = "sha256:6f6762661949411031f5fcda9593f586e6ce8340f0ba88921a0f2ef7a81eb9a3", size = 150705, upload-time = "2025-11-10T15:03:13.549Z" }, { url = "https://files.pythonhosted.org/packages/11/8c/c9138d881c79aa0ea9ed83cbd58d5ca75624378b38cee225dcf5c42cc91f/griffelib-2.0.2-py3-none-any.whl", hash = "sha256:925c857658fb1ba40c0772c37acbc2ab650bd794d9c1b9726922e36ea4117ea1", size = 142357, upload-time = "2026-03-27T11:34:46.275Z" },
] ]
[[package]] [[package]]
@@ -467,6 +583,60 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/fa/5e/f8e9a1d23b9c20a551a8a02ea3637b4642e22c2626e3a13a9a29cdea99eb/importlib_metadata-8.7.1-py3-none-any.whl", hash = "sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151", size = 27865, upload-time = "2025-12-21T10:00:18.329Z" }, { url = "https://files.pythonhosted.org/packages/fa/5e/f8e9a1d23b9c20a551a8a02ea3637b4642e22c2626e3a13a9a29cdea99eb/importlib_metadata-8.7.1-py3-none-any.whl", hash = "sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151", size = 27865, upload-time = "2025-12-21T10:00:18.329Z" },
] ]
[[package]]
name = "jiter"
version = "0.15.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/66/b5/55f06bb281d92fb3cc86d14e1def2bd908bb77693183e7cb1f5a3c388b0c/jiter-0.15.0.tar.gz", hash = "sha256:4251acc80e2b7c9b7b8823456ea0fceeb0734dac2df7636d3c711b38476b5a76", size = 166640, upload-time = "2026-05-19T10:09:48.361Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e5/f4/f708c900ecee41b2025ef8413d5351e5649eb2125c506f6720cc69b06f5c/jiter-0.15.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:1c11465f97e2abf45a014b83b730222f8f1c5335e802c7055a67d50de6f1f4e3", size = 307829, upload-time = "2026-05-19T10:07:59.704Z" },
{ url = "https://files.pythonhosted.org/packages/86/59/db537c0949e83668c38481d426b9f2fd5ab758c4ee53a811dd0a510626a0/jiter-0.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:d1e7b1776f0797956c509e123d0952d10d293a9492dea9f288ab9570ec01d1a5", size = 308445, upload-time = "2026-05-19T10:08:01.184Z" },
{ url = "https://files.pythonhosted.org/packages/37/38/ea0e13b18c30ef951da0d47d39e7fa9edb82a93a62990ffbd7cea9b622d4/jiter-0.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:351a341c2105aa430b7047e30f1bf7975f6313b00165d3fc07be2edaf741f279", size = 336181, upload-time = "2026-05-19T10:08:02.688Z" },
{ url = "https://files.pythonhosted.org/packages/58/fc/2303901b16c4ba05865588990a420c0b4156270b44379c20931544a1d962/jiter-0.15.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4ab395feec8d249ec4044e228e98a7033f043426a265df439dc3698823f0a4e4", size = 362985, upload-time = "2026-05-19T10:08:04.394Z" },
{ url = "https://files.pythonhosted.org/packages/5b/6f/11bace093c52e7d4d26c8e606ccd7ae8c972189622469ec0d9e28161e28b/jiter-0.15.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a2a438005b6f22d0273413484d6094d7c2c5d10ec1b3a3bf128e0d1d3ba53258", size = 453292, upload-time = "2026-05-19T10:08:05.967Z" },
{ url = "https://files.pythonhosted.org/packages/22/db/987f2f086ca4d7a6582eb4ccd513f9b26b42d9e4243a087609a3137a8fc7/jiter-0.15.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f18f85e4218d1b40f000f42a92239a7a61a902cd42c65e6c360dbd17dcb20894", size = 373501, upload-time = "2026-05-19T10:08:07.857Z" },
{ url = "https://files.pythonhosted.org/packages/8f/7c/89fbcabb2739b7a5b8dc959a1b6c5761f6484f5fed3486854b3c789bb1de/jiter-0.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d1aa62e277fc1cbd80e6deacae6f4d983b41b3d7728e0645c5d741a6149bba45", size = 344683, upload-time = "2026-05-19T10:08:09.431Z" },
{ url = "https://files.pythonhosted.org/packages/30/6f/6cca7692e7dddfec6d8d76c54dc97f2af2a41df4ac0674b999df1f09a5f3/jiter-0.15.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:6550fa135c7deb8ead6af49ed7ff648532ea8334a1447fe34a36315ef79c5c29", size = 350892, upload-time = "2026-05-19T10:08:11.352Z" },
{ url = "https://files.pythonhosted.org/packages/39/14/0338d6190cb8e6d22e677ab1d4eabd4117f67cca70c54cd04b82ff64e068/jiter-0.15.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:066f8f33f18b2419cd8213b2436fa7fbc9c499f315971cfa3ce1f9820c001b1b", size = 388723, upload-time = "2026-05-19T10:08:12.912Z" },
{ url = "https://files.pythonhosted.org/packages/90/31/cc19f4a1bdb6afb09ce6a2f2615aa8d44d994eba0d8e6105ed1af920e736/jiter-0.15.0-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:75e8a04e91432dde9f1838373cf93d23726c79d3e908d319acf0e796f85592e7", size = 516648, upload-time = "2026-05-19T10:08:14.808Z" },
{ url = "https://files.pythonhosted.org/packages/49/9f/833c541512cd091b63c10c0381973dfe11bc7a503a818c16384417e0c81e/jiter-0.15.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:a97261f1fccb8e50ecd2890a96e46efdc3f57c80a197324c6777827231eca712", size = 547382, upload-time = "2026-05-19T10:08:16.927Z" },
{ url = "https://files.pythonhosted.org/packages/d2/11/e7b70e91f90bc4477e8eee9e8a5f7cf3cb41b4525d6394dc98a714eb8f7f/jiter-0.15.0-cp313-cp313-win32.whl", hash = "sha256:c77496cb10bd7549690fbbab3e5ec05857b83e49276f4a9423a766ddd2afcd4c", size = 205845, upload-time = "2026-05-19T10:08:18.401Z" },
{ url = "https://files.pythonhosted.org/packages/4b/23/5c20d9ad6f02c493e4023e5d2d09e1c1f15fe2753c9102c544aff068a88e/jiter-0.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b15741f501469009ae0ae90b7147958a664a7dede40aa7ff174a8a4645f546d0", size = 196842, upload-time = "2026-05-19T10:08:20.131Z" },
{ url = "https://files.pythonhosted.org/packages/6b/11/1eb400ef248e8c925fd883fbe325daf5e42cd1b0d308539dd332bd4f7ffc/jiter-0.15.0-cp313-cp313-win_arm64.whl", hash = "sha256:5d6a60072b44c3c2b797a7ddcbcbbf2b34ea3cfd4721580fbfd2a09d9d9b84ba", size = 192212, upload-time = "2026-05-19T10:08:21.807Z" },
{ url = "https://files.pythonhosted.org/packages/8a/60/2fd8d7c79da8acf9b7b277c7616847773779356b92acfc9bb158452174da/jiter-0.15.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:ef1fd24d9413f6209e00d3d5a453e67acfe004a25cc6c8e8484faed4311ab9e8", size = 315065, upload-time = "2026-05-19T10:08:23.218Z" },
{ url = "https://files.pythonhosted.org/packages/46/f4/008fb7d65e8ac2abf00811651a661e025c4ba80bbc6f378450384ddd3aed/jiter-0.15.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:144f8e72cb53dab146347b91cceac01f5481237f2b93b4a339a1ee8f8878b67c", size = 339444, upload-time = "2026-05-19T10:08:24.701Z" },
{ url = "https://files.pythonhosted.org/packages/00/55/90b0c7b9c6896c0f2a591dd36d36b71d22e09674bfef178fa03ba3f81499/jiter-0.15.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:553fcac2ef2cb990877f9fc0833b8b629a3e6a5670b6b5fd58219b41a653ddc4", size = 347779, upload-time = "2026-05-19T10:08:26.408Z" },
{ url = "https://files.pythonhosted.org/packages/51/6b/69666cec5000fd57734c118437394516c749ae8dbeea9fb66d6fef9c4775/jiter-0.15.0-cp313-cp313t-win_amd64.whl", hash = "sha256:774f93f65031856bf14ad9f59bdcab8b8cad501e5ceabd51ba3525f76937a25b", size = 200395, upload-time = "2026-05-19T10:08:28.055Z" },
{ url = "https://files.pythonhosted.org/packages/39/04/a6aa62cd27e8149b0d28df5561f10f6cceaf7935a9ccf3f1c5a05f9a0cd8/jiter-0.15.0-cp313-cp313t-win_arm64.whl", hash = "sha256:f1e1754960f38ec40613a07e5e372df67acb3b890fb383b6fb3de3e49ddbf3c7", size = 190516, upload-time = "2026-05-19T10:08:29.35Z" },
{ url = "https://files.pythonhosted.org/packages/eb/d2/079f350ebf7859d081de30aa890f9e3be68516f754f3ba32366ffff4dcee/jiter-0.15.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:ac0d9ddea4350974be7a221fc25895f251a8fee748c889bdced2141c0fec1a49", size = 308884, upload-time = "2026-05-19T10:08:31.667Z" },
{ url = "https://files.pythonhosted.org/packages/04/4e/a2c30a7f69b48c03b20935d647479106fe932f6e63f75faf53937197e05d/jiter-0.15.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:01a8222cf05ab1128e239421156c207949808acaaea2bdfd33130ae666786e86", size = 310028, upload-time = "2026-05-19T10:08:33.304Z" },
{ url = "https://files.pythonhosted.org/packages/40/90/2e7cdfd3cf8ca967be38c48f5cf474d79f089efaf559a40f15984a77ae69/jiter-0.15.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:182226cbc930c9fab81bc2e41a4da672f89539906dadb05e75670ac07b94f71f", size = 337485, upload-time = "2026-05-19T10:08:35.259Z" },
{ url = "https://files.pythonhosted.org/packages/9b/11/15a1aa28b120b8ee5b4f1fb894c125046225f09847738bd64233d3b84883/jiter-0.15.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:71683c38c825452999b5717fcae07ea708e8c93003e808be4319c1b02e3d176e", size = 364223, upload-time = "2026-05-19T10:08:36.694Z" },
{ url = "https://files.pythonhosted.org/packages/b7/25/f442e8af5f3d0dcf47b39e83a0efd9ee45ea946aa6d04625dc3181eae3b6/jiter-0.15.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:30f2218e6a9e5c18bc10fe6d41ac189c442c88eacf11bad9f28ef95a9bef00e6", size = 456387, upload-time = "2026-05-19T10:08:38.143Z" },
{ url = "https://files.pythonhosted.org/packages/da/f4/37f2d2c9f64f49af7da652ed7532bb5a2372e588e6927c3fdd76f911db65/jiter-0.15.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5157de9f76eb4bc5ea74a1219366a25f945ad305641d74e04f59c54087091aa9", size = 374461, upload-time = "2026-05-19T10:08:39.869Z" },
{ url = "https://files.pythonhosted.org/packages/60/28/edcfbbbf0cb15436f36664a8908a0df47ab9006298d4cd937dc08ea932d6/jiter-0.15.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c5db5527c221249a876160663ab891ace358c17f7b9c93ec1478b7f0550e5c", size = 345924, upload-time = "2026-05-19T10:08:41.668Z" },
{ url = "https://files.pythonhosted.org/packages/47/13/89fba6398dab7f202b7278c4b4aac122399d2c0183971c4a57a3b7088df5/jiter-0.15.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:3e4540b8e74e4268811ac05db226a6a128ff572e7e0ce3f1163b693cadb184cd", size = 352283, upload-time = "2026-05-19T10:08:43.091Z" },
{ url = "https://files.pythonhosted.org/packages/1b/da/0f6af8cef2c565a1ab44d970f268c43ccaa72707386ea6388e6fe2b6cd26/jiter-0.15.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:62ebd14e47e9aed9df4472afcb2663668ce4d74891cd54f86bf6e44029d6dc89", size = 389985, upload-time = "2026-05-19T10:08:44.915Z" },
{ url = "https://files.pythonhosted.org/packages/a1/ec/b9cb7d6d29e24ee14910266157d2a279d7a8f60ee0df7fa840882976ba64/jiter-0.15.0-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0be6f5ad41a809f303f416d17cec92a7a725902fb9b4f3de3d19362ac0ef8554", size = 517695, upload-time = "2026-05-19T10:08:46.486Z" },
{ url = "https://files.pythonhosted.org/packages/64/5e/6d1bda880723aae0ad86b4b763f044362448efe31e3e819635d41cb03451/jiter-0.15.0-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:813dfbb17d65328bf86e5f0905dd277ba2265d3ca20556e86c0c7035b7182e5a", size = 548868, upload-time = "2026-05-19T10:08:48.026Z" },
{ url = "https://files.pythonhosted.org/packages/0c/72/7de501cf38dcacaf35098796f3a50e0f2e338baba18a58946c618544b809/jiter-0.15.0-cp314-cp314-win32.whl", hash = "sha256:50e51156192722a9c58db112837d3f8ef96fb3c5ecc14e95f409134b08b158ec", size = 206380, upload-time = "2026-05-19T10:08:49.738Z" },
{ url = "https://files.pythonhosted.org/packages/1e/a9/e19addf4b0c1bdce52c6da12351e6bc42c340c45e7c09e2158e46d293ccc/jiter-0.15.0-cp314-cp314-win_amd64.whl", hash = "sha256:30ce1a5d16b5641dc935d50ef775af6a0871e3d14ab05d6fc54dff371b78e558", size = 197687, upload-time = "2026-05-19T10:08:51.088Z" },
{ url = "https://files.pythonhosted.org/packages/f2/c9/776b1db01db25fc6c1d58d1979a37b0a9fe787e5f5b1d062d2eaacb77923/jiter-0.15.0-cp314-cp314-win_arm64.whl", hash = "sha256:510c8b3c17a0ed9ac69850c0438dada3c9b82d9c4d589fcb62002a5a9cf3a866", size = 192571, upload-time = "2026-05-19T10:08:52.451Z" },
{ url = "https://files.pythonhosted.org/packages/a0/f6/45bb4670bacf300fd2c7abadbfb3af376e5f1b6ae75fd9bc069891d15870/jiter-0.15.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7553333dd0930c104a5a0db8df72bf7219fe663d731383b576bb6ed6351c984d", size = 317151, upload-time = "2026-05-19T10:08:53.867Z" },
{ url = "https://files.pythonhosted.org/packages/d7/68/ed635ad5acd7b73e454283083bbb7c8205ad10e88b0d9d7d793b09fe8226/jiter-0.15.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2143ab06181d2b029eedcb6af3cebe95f11bbac62441781860f98ee9330a6a6", size = 341243, upload-time = "2026-05-19T10:08:55.383Z" },
{ url = "https://files.pythonhosted.org/packages/5d/db/3ff4176b817b8ea33879e71e13d8bc2b0d481a7ed3fe9e080f333d415c16/jiter-0.15.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6eac374c5c975709b69c10f09afd199df74150172156ad10c8d4fd785b7da995", size = 363629, upload-time = "2026-05-19T10:08:56.928Z" },
{ url = "https://files.pythonhosted.org/packages/ab/24/5f8270e0ba9c883582f96f722f8a0b58015c7ce1f8c6d4571cf394e99b6b/jiter-0.15.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b3b3b775e33d3bfaec9899edc526ae97b0da0bf9d071a46124ba419149a414f8", size = 456198, upload-time = "2026-05-19T10:08:58.618Z" },
{ url = "https://files.pythonhosted.org/packages/45/5b/76fc02b0b5c54c3d18c60653156e2f76fde1816f9b4722db68d6ee2c897e/jiter-0.15.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eda3071db3346334beae1360b46da4606da57bf3528c167b3c38533afaf9f2c5", size = 373710, upload-time = "2026-05-19T10:09:00.151Z" },
{ url = "https://files.pythonhosted.org/packages/c4/52/4310821b0ea9277994d3e1f49fc6a4b34e4800caebacb2c0af81da59a454/jiter-0.15.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c6694a173ecabc12eb60efbc0b474464ead1951ff65cd8b1e72100715c64512b", size = 349901, upload-time = "2026-05-19T10:09:01.621Z" },
{ url = "https://files.pythonhosted.org/packages/93/fe/67648c35b3594fba8854ac64cc8a826d8bcd18324bbdb53d77697c60b6ef/jiter-0.15.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:a254e10b593624d230c365b6d616b22ca0ad65e63a16e6631c2b3466022e6ba8", size = 352438, upload-time = "2026-05-19T10:09:03.216Z" },
{ url = "https://files.pythonhosted.org/packages/cb/28/0a1879d07ad6b3e025a2750027363452ced93c2d16d1c9d4b153ffd51c91/jiter-0.15.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d8d2955167274e15d79a7a020afdd9b39c990eb80b2d89fca695d92dcfdd38ec", size = 388152, upload-time = "2026-05-19T10:09:04.741Z" },
{ url = "https://files.pythonhosted.org/packages/c1/78/46c6f6b56ba85c90021f4afd72ed42f691f8f84daacb5fe27277070e3858/jiter-0.15.0-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:acf4ee4d1fc55917239fe72972fb292dd773055d05eb040d36f4326e02cc2c0e", size = 517707, upload-time = "2026-05-19T10:09:06.231Z" },
{ url = "https://files.pythonhosted.org/packages/ca/cb/720662d4c88fcad606e826fef5424365527ba43ce4868a479aed8f8c507e/jiter-0.15.0-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:e7196e56f1cd69af1dbb07dff02dcfb260a50b45a82d409d92a06fedb32473b5", size = 548241, upload-time = "2026-05-19T10:09:08.093Z" },
{ url = "https://files.pythonhosted.org/packages/60/e3/935b8034fd143f21125c87d51404a9e0e1449186a494405721ff5d1d695e/jiter-0.15.0-cp314-cp314t-win32.whl", hash = "sha256:7f6163c0f10b055245f814dcc59f4818da60dfe72f3e72ab89fc24b6bd5e9c52", size = 207950, upload-time = "2026-05-19T10:09:09.616Z" },
{ url = "https://files.pythonhosted.org/packages/93/59/984fd9ece895953dad3e0880a650e766f5a2da2c5514f0eafdaaabbeb5f9/jiter-0.15.0-cp314-cp314t-win_amd64.whl", hash = "sha256:980c256edb05b78a111b99c4de3b1d32e31634b867fd1fc2cf726e7b7bba9854", size = 200055, upload-time = "2026-05-19T10:09:11.367Z" },
{ url = "https://files.pythonhosted.org/packages/0e/a4/cf8d779feb133a27a2e3bc833bccb9e13aa332cdf820497ebf72c10ce8c3/jiter-0.15.0-cp314-cp314t-win_arm64.whl", hash = "sha256:66b1880df2d01e206e8339769d1c7c1753bcb653efd6289e203f6f24ebada0c0", size = 191244, upload-time = "2026-05-19T10:09:12.74Z" },
]
[[package]] [[package]]
name = "logfire-api" name = "logfire-api"
version = "4.19.0" version = "4.19.0"
@@ -690,6 +860,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/47/8d/d529b5d697919ba8c11ad626e835d4039be708a35b0d22de83a269a6682c/pyasn1_modules-0.4.2-py3-none-any.whl", hash = "sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a", size = 181259, upload-time = "2025-03-28T02:41:19.028Z" }, { url = "https://files.pythonhosted.org/packages/47/8d/d529b5d697919ba8c11ad626e835d4039be708a35b0d22de83a269a6682c/pyasn1_modules-0.4.2-py3-none-any.whl", hash = "sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a", size = 181259, upload-time = "2025-03-28T02:41:19.028Z" },
] ]
[[package]]
name = "pycparser"
version = "3.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/1b/7d/92392ff7815c21062bea51aa7b87d45576f649f16458d78b7cf94b9ab2e6/pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29", size = 103492, upload-time = "2026-01-21T14:26:51.89Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" },
]
[[package]] [[package]]
name = "pydantic" name = "pydantic"
version = "2.12.5" version = "2.12.5"
@@ -707,23 +886,26 @@ wheels = [
[[package]] [[package]]
name = "pydantic-ai-slim" name = "pydantic-ai-slim"
version = "1.44.0" version = "1.89.1"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "genai-prices" }, { name = "genai-prices" },
{ name = "griffe" }, { name = "griffelib" },
{ name = "httpx" }, { name = "httpx" },
{ name = "opentelemetry-api" }, { name = "opentelemetry-api" },
{ name = "pydantic" }, { name = "pydantic" },
{ name = "pydantic-graph" }, { name = "pydantic-graph" },
{ name = "typing-inspection" }, { name = "typing-inspection" },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/24/73/122aafb9bcad78042e2799649db745c357fc594e112c0ad0d8d183fdc447/pydantic_ai_slim-1.44.0.tar.gz", hash = "sha256:1bda6dbec4b94d8e52e32eb1e4c1da14f4f0202414306c65e2c3b43bebd82407", size = 378362, upload-time = "2026-01-17T01:26:09.64Z" } sdist = { url = "https://files.pythonhosted.org/packages/23/91/b2134056eb5debb7cb28e4efe7ca19fc5c7b2935e55b299a30ddad0d7746/pydantic_ai_slim-1.89.1.tar.gz", hash = "sha256:3ed967bff8dec992a907c1d1dabab2034a5f4aee75289de22e88b2ef9def8da6", size = 614728, upload-time = "2026-05-01T19:09:38.551Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/1a/18/2f68a9718843a95c0b4724ab3821ef8f60f7b8ef50e70b3769db3259da81/pydantic_ai_slim-1.44.0-py3-none-any.whl", hash = "sha256:3bf412f43d3ae787350d671f873706ad74603777e04f42411c8fbdf7dced8031", size = 496441, upload-time = "2026-01-17T01:26:00.184Z" }, { url = "https://files.pythonhosted.org/packages/95/14/d0f7c8f828c460a517531e0df7cfe9e20f4315da8357a9068caaf0193bbb/pydantic_ai_slim-1.89.1-py3-none-any.whl", hash = "sha256:9e7d615a0a3e48993d067901e596e85708e9c8d1f6bef96c20c340385028d465", size = 780314, upload-time = "2026-05-01T19:09:28.843Z" },
] ]
[package.optional-dependencies] [package.optional-dependencies]
anthropic = [
{ name = "anthropic" },
]
google = [ google = [
{ name = "google-genai" }, { name = "google-genai" },
] ]
@@ -783,7 +965,7 @@ wheels = [
[[package]] [[package]]
name = "pydantic-graph" name = "pydantic-graph"
version = "1.44.0" version = "1.89.1"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "httpx" }, { name = "httpx" },
@@ -791,9 +973,9 @@ dependencies = [
{ name = "pydantic" }, { name = "pydantic" },
{ name = "typing-inspection" }, { name = "typing-inspection" },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/aa/d9/83f1921633634cb1fd5947ebdc48a992cd1e660d9d0ba10f23450af654b8/pydantic_graph-1.44.0.tar.gz", hash = "sha256:81bb14bb47d3313fd7114f3ae9650dab77729451659e0247d298e1800f997c23", size = 58454, upload-time = "2026-01-17T01:26:12.113Z" } sdist = { url = "https://files.pythonhosted.org/packages/ea/64/f26c4d17568ab06ae576af0771ad83753cc2661bf9ca5a5698d01404ee20/pydantic_graph-1.89.1.tar.gz", hash = "sha256:99b8ae10fd10400208ee469355969e2dc253a600c3f667a5e790874064846e85", size = 59257, upload-time = "2026-05-01T19:09:40.998Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/6f/e6/f9ed700171435309e214cf19012cf3b391d10ec28786d4a567ee315b1acd/pydantic_graph-1.44.0-py3-none-any.whl", hash = "sha256:5affbfe5779f79946de2c6a6524b98e2344982a129b2a1e19d031e76a5bc1e51", size = 72324, upload-time = "2026-01-17T01:26:04.119Z" }, { url = "https://files.pythonhosted.org/packages/7e/52/9070e11f52424fe34e2ca96ae122902cab7c4325e2a90b33d44a410843b1/pydantic_graph-1.89.1-py3-none-any.whl", hash = "sha256:2ebce28573e81de9924c2ff68f90f949ccd96bbc2e8dc6cf4bb96208b34fbec0", size = 73065, upload-time = "2026-05-01T19:09:32.912Z" },
] ]
[[package]] [[package]]
@@ -856,18 +1038,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", size = 243393, upload-time = "2025-10-09T14:16:51.245Z" }, { url = "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", size = 243393, upload-time = "2025-10-09T14:16:51.245Z" },
] ]
[[package]]
name = "rsa"
version = "4.9.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pyasn1" },
]
sdist = { url = "https://files.pythonhosted.org/packages/da/8a/22b7beea3ee0d44b1916c0c1cb0ee3af23b700b6da9f04991899d0c555d4/rsa-4.9.1.tar.gz", hash = "sha256:e7bdbfdb5497da4c07dfd35530e1a902659db6ff241e39d9953cad06ebd0ae75", size = 29034, upload-time = "2025-04-16T09:51:18.218Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/64/8d/0133e4eb4beed9e425d9a98ed6e081a55d195481b7632472be1af08d2f6b/rsa-4.9.1-py3-none-any.whl", hash = "sha256:68635866661c6836b8d39430f97a996acbd61bfa49406748ea243539fe239762", size = 34696, upload-time = "2025-04-16T09:51:17.142Z" },
]
[[package]] [[package]]
name = "sniffio" name = "sniffio"
version = "1.3.1" version = "1.3.1"
+43 -1
View File
@@ -1,11 +1,12 @@
<script lang="ts"> <script lang="ts">
interface Props { interface Props {
onsubmit: (message: string) => void; onsubmit: (message: string) => void;
onpasteimage?: (base64: string, mediaType: string) => void;
disabled?: boolean; disabled?: boolean;
allowEmpty?: boolean; allowEmpty?: boolean;
} }
let { onsubmit, disabled = false, allowEmpty = false }: Props = $props(); let { onsubmit, onpasteimage, disabled = false, allowEmpty = false }: Props = $props();
let value = $state(''); let value = $state('');
function handleSubmit(e: Event) { function handleSubmit(e: Event) {
@@ -16,6 +17,46 @@
value = ''; value = '';
} }
} }
async function fileToCompressedBase64(
file: File
): Promise<{ base64: string; mediaType: string }> {
const bitmap = await createImageBitmap(file);
const maxSize = 1920;
const scale = Math.min(maxSize / bitmap.width, maxSize / bitmap.height, 1);
const canvas = document.createElement('canvas');
canvas.width = Math.round(bitmap.width * scale);
canvas.height = Math.round(bitmap.height * scale);
const ctx = canvas.getContext('2d');
if (!ctx) throw new Error('canvas 2d context unavailable');
ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
bitmap.close();
const base64 = canvas.toDataURL('image/jpeg', 0.65).split(',')[1];
return { base64, mediaType: 'image/jpeg' };
}
async function handlePaste(e: ClipboardEvent) {
if (!onpasteimage || disabled) return;
const items = e.clipboardData?.items;
if (!items) return;
const imageFiles: File[] = [];
for (const item of items) {
if (item.kind === 'file' && item.type.startsWith('image/')) {
const f = item.getAsFile();
if (f) imageFiles.push(f);
}
}
if (imageFiles.length === 0) return;
e.preventDefault();
for (const file of imageFiles) {
try {
const { base64, mediaType } = await fileToCompressedBase64(file);
onpasteimage(base64, mediaType);
} catch {
// ignore unreadable image
}
}
}
</script> </script>
<form onsubmit={handleSubmit} class="flex gap-1"> <form onsubmit={handleSubmit} class="flex gap-1">
@@ -23,6 +64,7 @@
type="text" type="text"
bind:value bind:value
{disabled} {disabled}
onpaste={handlePaste}
placeholder="..." placeholder="..."
class="min-w-0 flex-1 rounded bg-neutral-800 px-2 py-1 text-[10px] text-white placeholder-neutral-500 outline-none" class="min-w-0 flex-1 rounded bg-neutral-800 px-2 py-1 text-[10px] text-white placeholder-neutral-500 outline-none"
/> />
@@ -0,0 +1,48 @@
<script lang="ts">
import { processContent } from '$lib/utils/markdown';
interface Props {
content: string;
images?: string[];
mediaTypes?: string[];
}
let { content, images = [], mediaTypes = [] }: Props = $props();
</script>
<div
class="prose-mini w-full rounded-lg bg-blue-600 px-2.5 py-1.5 text-[11px] leading-relaxed text-white opacity-60"
>
{#if images.length > 0}
<div class="mb-1 flex flex-wrap gap-1">
{#each images as img, i (i)}
<img
src={`data:${mediaTypes[i] ?? 'image/jpeg'};base64,${img}`}
alt=""
class="max-h-16 rounded"
/>
{/each}
</div>
{/if}
{#if content}
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<div>{@html processContent(content)}</div>
{/if}
<div class="mt-1 flex items-center gap-1 text-[8px] text-blue-100/80">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-2.5 w-2.5 animate-spin"
fill="none"
viewBox="0 0 24 24"
>
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" opacity="0.3" />
<path
d="M12 2a10 10 0 0 1 10 10"
stroke="currentColor"
stroke-width="3"
stroke-linecap="round"
/>
</svg>
<span>в очереди</span>
</div>
</div>
+66 -32
View File
@@ -52,8 +52,48 @@ export const create = mutation({
followUpOptions: v.optional(v.array(v.string())), followUpOptions: v.optional(v.array(v.string())),
isStreaming: v.optional(v.boolean()) isStreaming: v.optional(v.boolean())
}, },
returns: v.id('messages'), returns: v.union(v.id('messages'), v.null()),
handler: async (ctx, args) => { handler: async (ctx, args) => {
const drafts: Array<{ base64: string; mediaType: string; id: Id<'photoDrafts'> }> = [];
if (args.photoDraftIds && args.photoDraftIds.length > 0) {
for (const draftId of args.photoDraftIds) {
const draft = await ctx.db.get(draftId);
if (draft) {
drafts.push({ base64: draft.base64, mediaType: draft.mediaType, id: draft._id });
}
}
}
if (args.source === 'web' && args.role === 'user') {
const chat = await ctx.db.get(args.chatId);
if (chat) {
const pendingGenId = await ctx.db.insert('pendingGenerations', {
userId: chat.userId,
chatId: args.chatId,
userMessage: args.content,
imagesBase64: drafts.length > 0 ? drafts.map((d) => d.base64) : args.imagesBase64,
imagesMediaTypes:
drafts.length > 0 ? drafts.map((d) => d.mediaType) : args.imagesMediaTypes,
createdAt: Date.now()
});
for (let i = 0; i < drafts.length; i++) {
await ctx.db.insert('pendingGenerationImages', {
pendingGenerationId: pendingGenId,
base64: drafts[i].base64,
mediaType: drafts[i].mediaType,
order: i
});
}
}
for (const draft of drafts) {
await ctx.db.delete(draft.id);
}
return null;
}
const messageId = await ctx.db.insert('messages', { const messageId = await ctx.db.insert('messages', {
chatId: args.chatId, chatId: args.chatId,
role: args.role, role: args.role,
@@ -68,16 +108,6 @@ export const create = mutation({
isStreaming: args.isStreaming isStreaming: args.isStreaming
}); });
const drafts: Array<{ base64: string; mediaType: string; id: Id<'photoDrafts'> }> = [];
if (args.photoDraftIds && args.photoDraftIds.length > 0) {
for (const draftId of args.photoDraftIds) {
const draft = await ctx.db.get(draftId);
if (draft) {
drafts.push({ base64: draft.base64, mediaType: draft.mediaType, id: draft._id });
}
}
}
for (let i = 0; i < drafts.length; i++) { for (let i = 0; i < drafts.length; i++) {
await ctx.db.insert('messageImages', { await ctx.db.insert('messageImages', {
messageId, messageId,
@@ -87,27 +117,6 @@ export const create = mutation({
}); });
} }
if (args.source === 'web' && args.role === 'user') {
const chat = await ctx.db.get(args.chatId);
if (chat) {
const pendingGenId = await ctx.db.insert('pendingGenerations', {
userId: chat.userId,
chatId: args.chatId,
userMessage: args.content,
createdAt: Date.now()
});
for (let i = 0; i < drafts.length; i++) {
await ctx.db.insert('pendingGenerationImages', {
pendingGenerationId: pendingGenId,
base64: drafts[i].base64,
mediaType: drafts[i].mediaType,
order: i
});
}
}
}
for (const draft of drafts) { for (const draft of drafts) {
await ctx.db.delete(draft.id); await ctx.db.delete(draft.id);
} }
@@ -116,6 +125,31 @@ export const create = mutation({
} }
}); });
export const createFromBackend = mutation({
args: {
chatId: v.id('chats'),
role: v.union(v.literal('user'), v.literal('assistant')),
content: v.string(),
source: v.union(v.literal('telegram'), v.literal('web')),
imagesBase64: v.optional(v.array(v.string())),
imagesMediaTypes: v.optional(v.array(v.string())),
isStreaming: v.optional(v.boolean())
},
returns: v.id('messages'),
handler: async (ctx, args) => {
return await ctx.db.insert('messages', {
chatId: args.chatId,
role: args.role,
content: args.content,
source: args.source,
imagesBase64: args.imagesBase64,
imagesMediaTypes: args.imagesMediaTypes,
createdAt: Date.now(),
isStreaming: args.isStreaming
});
}
});
export const update = mutation({ export const update = mutation({
args: { args: {
messageId: v.id('messages'), messageId: v.id('messages'),
@@ -40,6 +40,50 @@ export const list = query({
} }
}); });
export const listByChat = query({
args: { chatId: v.id('chats') },
returns: v.array(
v.object({
_id: v.id('pendingGenerations'),
_creationTime: v.number(),
userMessage: v.string(),
imagesBase64: v.optional(v.array(v.string())),
imagesMediaTypes: v.optional(v.array(v.string())),
createdAt: v.number()
})
),
handler: async (ctx, args) => {
const pending = await ctx.db
.query('pendingGenerations')
.withIndex('by_chat_id', (q) => q.eq('chatId', args.chatId))
.order('asc')
.collect();
const result = [];
for (const p of pending) {
const images = await ctx.db
.query('pendingGenerationImages')
.withIndex('by_pending_generation_id', (q) => q.eq('pendingGenerationId', p._id))
.collect();
const sortedImages = images.sort((a, b) => a.order - b.order);
result.push({
_id: p._id,
_creationTime: p._creationTime,
userMessage: p.userMessage,
imagesBase64:
sortedImages.length > 0 ? sortedImages.map((img) => img.base64) : p.imagesBase64,
imagesMediaTypes:
sortedImages.length > 0 ? sortedImages.map((img) => img.mediaType) : p.imagesMediaTypes,
createdAt: p.createdAt
});
}
return result;
}
});
export const create = mutation({ export const create = mutation({
args: { args: {
userId: v.id('users'), userId: v.id('users'),
@@ -61,6 +105,10 @@ export const remove = mutation({
args: { id: v.id('pendingGenerations') }, args: { id: v.id('pendingGenerations') },
returns: v.null(), returns: v.null(),
handler: async (ctx, args) => { handler: async (ctx, args) => {
const existing = await ctx.db.get(args.id);
if (!existing) {
return null;
}
const images = await ctx.db const images = await ctx.db
.query('pendingGenerationImages') .query('pendingGenerationImages')
.withIndex('by_pending_generation_id', (q) => q.eq('pendingGenerationId', args.id)) .withIndex('by_pending_generation_id', (q) => q.eq('pendingGenerationId', args.id))
+1 -1
View File
@@ -65,7 +65,7 @@ export default defineSchema({
imagesBase64: v.optional(v.array(v.string())), imagesBase64: v.optional(v.array(v.string())),
imagesMediaTypes: v.optional(v.array(v.string())), imagesMediaTypes: v.optional(v.array(v.string())),
createdAt: v.number() createdAt: v.number()
}), }).index('by_chat_id', ['chatId']),
pendingGenerationImages: defineTable({ pendingGenerationImages: defineTable({
pendingGenerationId: v.id('pendingGenerations'), pendingGenerationId: v.id('pendingGenerations'),
+18 -1
View File
@@ -2,8 +2,20 @@ import { Marked } from 'marked';
const marked = new Marked({ breaks: true, gfm: true }); const marked = new Marked({ breaks: true, gfm: true });
const CODE_OPEN = '';
const CODE_CLOSE = '';
export function processLatex(text: string): string { export function processLatex(text: string): string {
return text const placeholders: string[] = [];
const stash = (match: string) => {
const token = `${CODE_OPEN}${placeholders.length}${CODE_CLOSE}`;
placeholders.push(match);
return token;
};
const protectedText = text.replace(/```[\s\S]*?```/g, stash).replace(/`[^`\n]*`/g, stash);
const rendered = protectedText
.replace(/\$\$(.*?)\$\$/gs, (_, tex) => { .replace(/\$\$(.*?)\$\$/gs, (_, tex) => {
const encoded = encodeURIComponent(tex.trim()); const encoded = encodeURIComponent(tex.trim());
return `<img src="/service/latex?tex=${encoded}&display=1" alt="LaTeX" class="block my-1 max-h-12" />`; return `<img src="/service/latex?tex=${encoded}&display=1" alt="LaTeX" class="block my-1 max-h-12" />`;
@@ -12,6 +24,11 @@ export function processLatex(text: string): string {
const encoded = encodeURIComponent(tex.trim()); const encoded = encodeURIComponent(tex.trim());
return `<img src="/service/latex?tex=${encoded}" alt="LaTeX" class="inline-block align-middle max-h-4" />`; return `<img src="/service/latex?tex=${encoded}" alt="LaTeX" class="inline-block align-middle max-h-4" />`;
}); });
return rendered.replace(
new RegExp(`${CODE_OPEN}(\\d+)${CODE_CLOSE}`, 'g'),
(_, i) => placeholders[Number(i)]
);
} }
export function processContent(text: string): string { export function processContent(text: string): string {
+41 -3
View File
@@ -12,6 +12,7 @@
import { api } from '$lib/convex/_generated/api'; import { api } from '$lib/convex/_generated/api';
import type { Id } from '$lib/convex/_generated/dataModel'; import type { Id } from '$lib/convex/_generated/dataModel';
import ChatMessage from '$lib/components/ChatMessage.svelte'; import ChatMessage from '$lib/components/ChatMessage.svelte';
import PendingMessageBubble from '$lib/components/PendingMessageBubble.svelte';
import ChatInput from '$lib/components/ChatInput.svelte'; import ChatInput from '$lib/components/ChatInput.svelte';
import FollowUpButtons from '$lib/components/FollowUpButtons.svelte'; import FollowUpButtons from '$lib/components/FollowUpButtons.svelte';
import StealthOverlay from '$lib/components/StealthOverlay.svelte'; import StealthOverlay from '$lib/components/StealthOverlay.svelte';
@@ -117,7 +118,16 @@
: null; : null;
const messagesQuery = $derived(usePolling ? messagesQueryPoll! : messagesQueryWs!); const messagesQuery = $derived(usePolling ? messagesQueryPoll! : messagesQueryWs!);
const pendingQueryWs = usePolling
? null
: useQuery(api.pendingGenerations.listByChat, () => (chatId ? { chatId } : 'skip'));
const pendingQueryPoll = usePolling
? usePollingQuery(api.pendingGenerations.listByChat, () => (chatId ? { chatId } : 'skip'))
: null;
const pendingQuery = $derived(usePolling ? pendingQueryPoll! : pendingQueryWs!);
let messages = $derived(messagesQuery.data ?? []); let messages = $derived(messagesQuery.data ?? []);
let pendingMessages = $derived(pendingQuery.data ?? []);
let lastMessage = $derived(messages[messages.length - 1]); let lastMessage = $derived(messages[messages.length - 1]);
let followUpOptions = $derived( let followUpOptions = $derived(
lastMessage?.role === 'assistant' && lastMessage.followUpOptions lastMessage?.role === 'assistant' && lastMessage.followUpOptions
@@ -263,12 +273,19 @@
let prevMessageCount = 0; let prevMessageCount = 0;
let prevLastMessageId: string | undefined; let prevLastMessageId: string | undefined;
let prevPendingCount = 0;
$effect(() => { $effect(() => {
const count = messages.length; const count = messages.length;
const lastId = lastMessage?._id; const lastId = lastMessage?._id;
if (count > prevMessageCount || (lastId && lastId !== prevLastMessageId)) { const pendingCount = pendingMessages.length;
if (
count > prevMessageCount ||
pendingCount > prevPendingCount ||
(lastId && lastId !== prevLastMessageId)
) {
prevMessageCount = count; prevMessageCount = count;
prevPendingCount = pendingCount;
prevLastMessageId = lastId; prevLastMessageId = lastId;
window.scrollTo(0, document.body.scrollHeight); window.scrollTo(0, document.body.scrollHeight);
} }
@@ -577,7 +594,7 @@
{:else} {:else}
<div class="space-y-1"> <div class="space-y-1">
{#each messages as message, i (message._id)} {#each messages as message, i (message._id)}
{#if i === messages.length - 1} {#if i === messages.length - 1 && pendingMessages.length === 0}
<div bind:this={lastMessageElement}> <div bind:this={lastMessageElement}>
<ChatMessage <ChatMessage
role={message.role} role={message.role}
@@ -593,6 +610,23 @@
/> />
{/if} {/if}
{/each} {/each}
{#each pendingMessages as p, i (p._id)}
{#if i === pendingMessages.length - 1}
<div bind:this={lastMessageElement}>
<PendingMessageBubble
content={p.userMessage}
images={p.imagesBase64 ?? []}
mediaTypes={p.imagesMediaTypes ?? []}
/>
</div>
{:else}
<PendingMessageBubble
content={p.userMessage}
images={p.imagesBase64 ?? []}
mediaTypes={p.imagesMediaTypes ?? []}
/>
{/if}
{/each}
</div> </div>
{#if followUpOptions.length > 0} {#if followUpOptions.length > 0}
@@ -651,7 +685,11 @@
ondismiss={handleDismissSheet} ondismiss={handleDismissSheet}
/> />
{/if} {/if}
<ChatInput onsubmit={sendMessage} allowEmpty={draftPhotos.length > 0} /> <ChatInput
onsubmit={sendMessage}
onpasteimage={handleCameraCapture}
allowEmpty={draftPhotos.length > 0}
/>
</div> </div>
{/if} {/if}