alpiecode 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {alpiecode-0.7.0 → alpiecode-0.7.2}/PKG-INFO +1 -1
- {alpiecode-0.7.0 → alpiecode-0.7.2}/pyproject.toml +1 -1
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/config.py +1 -1
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/local_model.py +30 -15
- {alpiecode-0.7.0 → alpiecode-0.7.2}/README.md +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/setup.cfg +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/alpiecode.egg-info/SOURCES.txt +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/__init__.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/agent.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/cli.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/compaction.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/github.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/guardian.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/media.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/memory.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/tools.py +0 -0
- {alpiecode-0.7.0 → alpiecode-0.7.2}/src/codeagent/updater.py +0 -0
|
@@ -75,7 +75,7 @@ def get_shared_http_client():
|
|
|
75
75
|
import httpx
|
|
76
76
|
_SHARED_HTTP_CLIENT = httpx.Client(
|
|
77
77
|
http2=True,
|
|
78
|
-
timeout=httpx.Timeout(
|
|
78
|
+
timeout=httpx.Timeout(120.0, connect=5.0),
|
|
79
79
|
limits=httpx.Limits(max_keepalive_connections=20, max_connections=50),
|
|
80
80
|
)
|
|
81
81
|
return _SHARED_HTTP_CLIENT
|
|
@@ -7,6 +7,7 @@ Provides an OpenAI-compatible `create_chat_completion` interface.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import os
|
|
10
|
+
import re
|
|
10
11
|
import sys
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
from typing import Any, Dict, List, Optional
|
|
@@ -242,30 +243,37 @@ def _ensure_llama_cpp():
|
|
|
242
243
|
else:
|
|
243
244
|
wheel_url = "https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.34-vulkan/llama_cpp_python-0.3.34-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl"
|
|
244
245
|
|
|
246
|
+
install_targets = [wheel_url, "llama-cpp-python"]
|
|
245
247
|
installed = False
|
|
246
248
|
last_error = ""
|
|
247
|
-
for
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
for target in install_targets:
|
|
250
|
+
for cmd_base in [
|
|
251
|
+
["uv", "pip", "install", target],
|
|
252
|
+
[sys.executable, "-m", "pip", "install", target],
|
|
253
|
+
]:
|
|
254
|
+
try:
|
|
255
|
+
res = subprocess.run(cmd_base, capture_output=True, text=True, timeout=180)
|
|
256
|
+
if res.returncode == 0:
|
|
257
|
+
installed = True
|
|
258
|
+
break
|
|
259
|
+
else:
|
|
260
|
+
last_error = res.stderr.strip() or res.stdout.strip()
|
|
261
|
+
except Exception as e:
|
|
262
|
+
last_error = str(e)
|
|
263
|
+
continue
|
|
264
|
+
if installed:
|
|
265
|
+
break
|
|
258
266
|
|
|
259
267
|
try:
|
|
260
268
|
from llama_cpp import Llama
|
|
261
269
|
print("✅ Pre-compiled local GGUF engine installed successfully!")
|
|
262
270
|
return Llama
|
|
263
271
|
except ImportError:
|
|
264
|
-
err_detail = f"\n Last error: {last_error[:
|
|
272
|
+
err_detail = f"\n Last error: {last_error[:300]}" if last_error else ""
|
|
265
273
|
raise RuntimeError(
|
|
266
274
|
"\n╭────────────────────────────────────────────────────────────╮\n"
|
|
267
275
|
"│ Failed to auto-install local GGUF engine. │\n"
|
|
268
|
-
"│
|
|
276
|
+
"│ Please check your internet connection for first setup. │\n"
|
|
269
277
|
"╰────────────────────────────────────────────────────────────╯"
|
|
270
278
|
f"{err_detail}"
|
|
271
279
|
)
|
|
@@ -388,8 +396,6 @@ class LocalModel:
|
|
|
388
396
|
|
|
389
397
|
enable_thinking = kwargs.get("enable_thinking", True)
|
|
390
398
|
|
|
391
|
-
# When thinking is disabled, inject assistant prefill to skip reasoning tokens
|
|
392
|
-
# This eliminates ~6s of thinking token generation per turn
|
|
393
399
|
if not enable_thinking:
|
|
394
400
|
msgs = list(messages) + [{"role": "assistant", "content": "<think>\n\n</think>\n\n"}]
|
|
395
401
|
else:
|
|
@@ -405,6 +411,15 @@ class LocalModel:
|
|
|
405
411
|
params["tool_choice"] = kwargs.get("tool_choice", "auto")
|
|
406
412
|
|
|
407
413
|
result_dict = llm.create_chat_completion(**params)
|
|
414
|
+
|
|
415
|
+
# Fix prefill response content so chat history remains valid across multi-turn sessions
|
|
416
|
+
if not enable_thinking and result_dict.get("choices"):
|
|
417
|
+
msg_dict = result_dict["choices"][0].get("message", {})
|
|
418
|
+
raw_content = msg_dict.get("content") or ""
|
|
419
|
+
# Strip redundant opening/closing think tags output by model after prefill
|
|
420
|
+
cleaned = re.sub(r"^\s*(?:</think>|<think>)*\s*", "", raw_content)
|
|
421
|
+
msg_dict["content"] = f"<think>\n\n</think>\n\n{cleaned}"
|
|
422
|
+
|
|
408
423
|
return _DictWrapper(result_dict)
|
|
409
424
|
|
|
410
425
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|