Fixed github_tool.py, added RAG bot

This commit is contained in:
2025-06-06 17:41:30 -05:00
parent 587fbfbf97
commit 7386fdeeed
6 changed files with 1731 additions and 5 deletions
+1275 -4
View File
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -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}"