chore: consolidate install, fix CLI portability, normalize LLM responses

- Point requirements.txt to pyproject.toml as single source of truth
- Resolve welcome.txt path relative to module for CLI portability
- Include cli/static files in package build
- Extract shared normalize_content for OpenAI Responses API and
  Gemini 3 list-format responses into base_client.py
- Update README install and CLI usage instructions
This commit is contained in:
Yijia-Xiao
2026-03-22 21:38:01 +00:00
parent 0b13145dc0
commit 77755f0431
7 changed files with 47 additions and 43 deletions
+19
View File
@@ -2,6 +2,25 @@ from abc import ABC, abstractmethod
from typing import Any, Optional
def normalize_content(response):
"""Normalize LLM response content to a plain string.
Multiple providers (OpenAI Responses API, Google Gemini 3) return content
as a list of typed blocks, e.g. [{'type': 'reasoning', ...}, {'type': 'text', 'text': '...'}].
Downstream agents expect response.content to be a string. This extracts
and joins the text blocks, discarding reasoning/metadata blocks.
"""
content = response.content
if isinstance(content, list):
texts = [
item.get("text", "") if isinstance(item, dict) and item.get("type") == "text"
else item if isinstance(item, str) else ""
for item in content
]
response.content = "\n".join(t for t in texts if t)
return response
class BaseLLMClient(ABC):
"""Abstract base class for LLM clients."""