fix encoding
This commit is contained in:
@@ -104,7 +104,7 @@ def run_workflow():
|
|||||||
modifications = ai_response.get("modifications", [])
|
modifications = ai_response.get("modifications", [])
|
||||||
modification_plan = command_generator.generate_commands(modifications)
|
modification_plan = command_generator.generate_commands(modifications)
|
||||||
|
|
||||||
with open("modification_plan.md", "w") as f:
|
with open("modification_plan.md", "w", encoding="utf-8") as f:
|
||||||
f.write(modification_plan)
|
f.write(modification_plan)
|
||||||
|
|
||||||
log(f"Generated modification plan:\n{modification_plan}")
|
log(f"Generated modification plan:\n{modification_plan}")
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ class AIInterface:
|
|||||||
|
|
||||||
# Подготовка сообщений для чат-комплитшена
|
# Подготовка сообщений для чат-комплитшена
|
||||||
messages = [{"role": "user", "content": prompt}]
|
messages = [{"role": "user", "content": prompt}]
|
||||||
if context:
|
# if context:
|
||||||
# Преобразуем контекст в строку
|
# # Преобразуем контекст в строку
|
||||||
context_str = self._format_context(context)
|
# context_str = self._format_context(context)
|
||||||
messages.append({"role": "system", "content": context_str})
|
# messages.append({"role": "system", "content": context_str})
|
||||||
|
|
||||||
# Создание запроса к OpenAI
|
# Создание запроса к OpenAI
|
||||||
response = self.client.chat.completions.create(
|
response = self.client.chat.completions.create(
|
||||||
model=DEFAULT_MODEL,
|
model=DEFAULT_MODEL,
|
||||||
messages=[{"role": "user", "content": "Write a poem about a tree"}],
|
messages=messages,
|
||||||
stream=False, # Пока отключаем стриминг для простоты
|
stream=False, # Пока отключаем стриминг для простоты
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class FileAnalyzer:
|
|||||||
Анализирует файл и извлекает информацию о функциях.
|
Анализирует файл и извлекает информацию о функциях.
|
||||||
"""
|
"""
|
||||||
log(f"Analyzing file: {file_path}")
|
log(f"Analyzing file: {file_path}")
|
||||||
with open(file_path, "r") as f:
|
with open(file_path, "r", encoding="utf-8") as f:
|
||||||
code = f.read()
|
code = f.read()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class ProjectMap:
|
|||||||
Сохраняет карту структуры в файл.
|
Сохраняет карту структуры в файл.
|
||||||
"""
|
"""
|
||||||
map_content = self.generate_map()
|
map_content = self.generate_map()
|
||||||
with open(output_file, "w") as f:
|
with open(output_file, "w", encoding="utf-8") as f:
|
||||||
f.write(map_content)
|
f.write(map_content)
|
||||||
log(f"Project map saved to {output_file}")
|
log(f"Project map saved to {output_file}")
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ class ProjectMap:
|
|||||||
gitignore_path = os.path.join(self.project_path, ".gitignore")
|
gitignore_path = os.path.join(self.project_path, ".gitignore")
|
||||||
rules = []
|
rules = []
|
||||||
if os.path.exists(gitignore_path):
|
if os.path.exists(gitignore_path):
|
||||||
with open(gitignore_path, "r") as f:
|
with open(gitignore_path, "r", encoding="utf-8") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line and not line.startswith("#"): # Игнорируем комментарии и пустые строки
|
if line and not line.startswith("#"): # Игнорируем комментарии и пустые строки
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ def read_file(file_path: str) -> str:
|
|||||||
"""
|
"""
|
||||||
Читает содержимое файла.
|
Читает содержимое файла.
|
||||||
"""
|
"""
|
||||||
with open(file_path, "r") as f:
|
with open(file_path, "r", encoding="utf-8") as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
def write_file(file_path: str, content: str):
|
def write_file(file_path: str, content: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user