feat: introduce agent communication, autonomous detection, and plugin support
feat: add interactive modes and agent execution tool refactor: remove asyncio dependencies from core api and assistant refactor: remove asyncio dependencies from command handlers maintenance: bump version to 1.10.0 maintenance: update pyproject.toml dependencies and test configuration
This commit is contained in:
+4
-4
@@ -7,7 +7,7 @@ from rp.core.http_client import http_client
|
||||
logger = logging.getLogger("rp")
|
||||
|
||||
|
||||
async def call_api(messages, model, api_url, api_key, use_tools, tools_definition, verbose=False):
|
||||
def call_api(messages, model, api_url, api_key, use_tools, tools_definition, verbose=False):
|
||||
try:
|
||||
messages = auto_slim_messages(messages, verbose=verbose)
|
||||
logger.debug(f"=== API CALL START ===")
|
||||
@@ -35,7 +35,7 @@ async def call_api(messages, model, api_url, api_key, use_tools, tools_definitio
|
||||
request_json = data
|
||||
logger.debug(f"Request payload size: {len(request_json)} bytes")
|
||||
logger.debug("Sending HTTP request...")
|
||||
response = await http_client.post(api_url, headers=headers, json_data=request_json)
|
||||
response = http_client.post(api_url, headers=headers, json_data=request_json)
|
||||
if response.get("error"):
|
||||
if "status" in response:
|
||||
logger.error(f"API HTTP Error: {response['status']} - {response.get('text', '')}")
|
||||
@@ -77,12 +77,12 @@ async def call_api(messages, model, api_url, api_key, use_tools, tools_definitio
|
||||
return {"error": str(e)}
|
||||
|
||||
|
||||
async def list_models(model_list_url, api_key):
|
||||
def list_models(model_list_url, api_key):
|
||||
try:
|
||||
headers = {}
|
||||
if api_key:
|
||||
headers["Authorization"] = f"Bearer {api_key}"
|
||||
response = await http_client.get(model_list_url, headers=headers)
|
||||
response = http_client.get(model_list_url, headers=headers)
|
||||
if response.get("error"):
|
||||
return {"error": response.get("text", "HTTP error")}
|
||||
data = json.loads(response["text"])
|
||||
|
||||
Reference in New Issue
Block a user