Fixed github_tool.py, added RAG bot
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
||||
import json
|
||||
import logging
|
||||
from openai import OpenAI
|
||||
import re
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
|
||||
@@ -82,10 +83,12 @@ class StandaloneLLMTool(BaseTool):
|
||||
headers={'Content-Type': 'text/plain; charset=utf-8', 'User-Agent': 'DualAICopilot/0.1'},
|
||||
method='POST'
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=500) as response:
|
||||
with urllib.request.urlopen(req, timeout=3600) as response:
|
||||
if response.status == 200:
|
||||
response_data = response.read().decode('utf-8')
|
||||
logging.info(f"Received response from external copilot: {response_data[:100]}...")
|
||||
# Remove content within <think> tags
|
||||
response_data = re.sub(r"<think>.*?</think>", "", response_data, flags=re.DOTALL)
|
||||
return response_data
|
||||
else:
|
||||
error_message = f"External copilot at {self.copilot_url} returned an error: {response.status} {response.reason}"
|
||||
|
||||
Reference in New Issue
Block a user