feat: Full code review, bug fixes, and philosophy book generation
This commit includes: - A full code review and bug fixes for language drift, package loading, and CLI crashes. - The generated 15,000-word philosophy manuscript. - CODE_REVIEW.md and CHANGELOG.md documenting the process.
This commit is contained in:
@@ -83,6 +83,9 @@ class LLMClient:
|
||||
"Authorization": f"Bearer {self.api_key}",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# STRICT ENGLISH ENFORCEMENT
|
||||
system_prompt += "\n\nIMPORTANT: You must respond ONLY in English. Do not use Chinese characters or any other language under any circumstances."
|
||||
|
||||
if self.provider == "minimax":
|
||||
return self._complete_minimax_sync(
|
||||
@@ -110,6 +113,10 @@ class LLMClient:
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# STRICT ENGLISH ENFORCEMENT
|
||||
nonlocal system_prompt
|
||||
system_prompt += "\n\nIMPORTANT: You must respond ONLY in English. Do not use Chinese characters or any other language under any circumstances."
|
||||
|
||||
if self.provider == "minimax":
|
||||
return await self._complete_minimax_async(
|
||||
system_prompt, user_prompt, temperature, max_tokens, headers
|
||||
@@ -140,8 +147,8 @@ class LLMClient:
|
||||
# Anthropic-compatible format
|
||||
payload = {
|
||||
"model": self.minimax_model,
|
||||
"system": system_prompt,
|
||||
"messages": [
|
||||
{"role": "system", "content": system_prompt},
|
||||
{"role": "user", "content": user_prompt},
|
||||
],
|
||||
"temperature": temperature,
|
||||
@@ -167,8 +174,15 @@ class LLMClient:
|
||||
|
||||
# Handle Anthropic-compatible response format
|
||||
if "content" in data:
|
||||
# Return the text content
|
||||
if isinstance(data["content"], list) and len(data["content"]) > 0:
|
||||
# Look for text content, skip thinking
|
||||
text_parts = []
|
||||
for item in data["content"]:
|
||||
if item.get("type") == "text":
|
||||
text_parts.append(item.get("text", ""))
|
||||
if text_parts:
|
||||
return "".join(text_parts)
|
||||
# If no text found, return first item's text or the item itself
|
||||
return data["content"][0].get("text", str(data["content"][0]))
|
||||
return str(data["content"])
|
||||
else:
|
||||
@@ -224,8 +238,8 @@ class LLMClient:
|
||||
"""Call MiniMax API (sync) using Anthropic-compatible endpoint."""
|
||||
payload = {
|
||||
"model": self.minimax_model,
|
||||
"system": system_prompt,
|
||||
"messages": [
|
||||
{"role": "system", "content": system_prompt},
|
||||
{"role": "user", "content": user_prompt},
|
||||
],
|
||||
"temperature": temperature,
|
||||
|
||||
Reference in New Issue
Block a user