Spaces:
Sleeping
Sleeping
Commit History
-
feat: add pro-enhanced model + extra_fields support
- New model: gemini-3.1-pro-enhanced ([31]=2 [80]=3, ~25% more output) - extra_fields in model config applied to StreamGenerate payload - Inner array expanded to 102 elements for higher field indices - Plumbed extra_fields through generate/generate_stream/server10335bd -
feat: full Google Native API support for Gemini CLI compatibility
LiangLliuAdd complete support for Google's generateContent/streamGenerateContent endpoints, enabling seamless integration with Gemini CLI and the @google/genai SDK. Key changes: 1. Real streaming (server.py) - Stream via generate_stream() with per-delta SSE chunks - Empty delta filtering (SDK rejects part.text === "") - Separate final chunk with finishReason: "STOP" + usageMetadata - Tool requests fall back to non-streaming to avoid truncated blocks 2. Function calling via prompt engineering (tools.py) - build_tool_prompt(): natural language tool instructions that avoid Gemini Web's prompt-injection detection - google_contents_to_prompt(): converts systemInstruction, tools, functionCall/functionResponse parts into prompt string + images - parse_google_function_calls(): extracts function calls from model output (3 formats: backtick blocks, bare blocks, raw JSON) 3. SDK protocol compliance - SSE format matches SDK regex /^\s*data: (.*)(?:\n\n)/ - func…3f5152e
-
fix: code review issues (P1-P3)
- Cookie file caching with mtime check (no disk read per request) - Streaming retry logic (same as non-streaming) - Reusable httpx.Client and ssl context (no per-request allocation) - Shared _extract_texts_from_line() eliminates parsing duplication - _start_sse() helper eliminates 4x SSE header repetition - _usage() helper for token estimation - _parse_body() with proper 400 on invalid JSON - ValueError guard on @think= parameter - Single-pass regex in parse_tool_calls - Fixed __main__.py httpx detection (was always showing 'fallback') - Removed unused base64 import from gemini.pyd27caee -
feat: modularize + true streaming + multimodal support
- Split into package: gemini_web2api/{config,models,gemini,tools,server} - True SSE streaming via httpx (falls back to urllib if not installed) - Multimodal: image_url support in messages (base64 or URL) - pyproject.toml + requirements.txt for pip install - Entry: python -m gemini_web2api or gemini-web2api CLI85919ae