Temporary fixing bug loggorilla in TUI
This commit is contained in:
parent
37c68a9ade
commit
870dcaea94
@ -1,5 +1,7 @@
|
||||
import os
|
||||
from scripts import loggorilla
|
||||
# NOTE: loggorilla dimatikan di tool ini. print()-nya bisa bikin error saat
|
||||
# proses keluar (SCI), jadi semua pemanggilan di bawah hanya di-comment, jangan dihapus.
|
||||
# from scripts import loggorilla
|
||||
|
||||
schema_instruction_use = {
|
||||
"type": "function",
|
||||
@ -24,7 +26,7 @@ schema_instruction_use = {
|
||||
}
|
||||
|
||||
def instruction_use(directory, filename):
|
||||
loggorilla.fyinf("tools.smart", f"Calling instruction_use with directory='{directory}', filename='{filename}'")
|
||||
# loggorilla.fyinf("tools.smart", f"Calling instruction_use with directory='{directory}', filename='{filename}'")
|
||||
current_file_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
project_root = os.path.dirname(current_file_dir)
|
||||
base_dir = os.path.join(project_root, "instruction")
|
||||
@ -34,15 +36,15 @@ def instruction_use(directory, filename):
|
||||
|
||||
if not os.path.exists(file_path):
|
||||
res = f"Error: Instruction file not found at {file_path}"
|
||||
loggorilla.fyinf("tools.smart", f"File not found: {res}")
|
||||
# loggorilla.fyinf("tools.smart", f"File not found: {res}")
|
||||
return res
|
||||
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
loggorilla.fyinf("tools.smart", f"Successfully read file. Content snippet: {content[:100]}...")
|
||||
# loggorilla.fyinf("tools.smart", f"Successfully read file. Content snippet: {content[:100]}...")
|
||||
return content
|
||||
except Exception as e:
|
||||
res = f"Error reading file: {str(e)}"
|
||||
loggorilla.fyinf("tools.smart", f"Exception occurred: {res}")
|
||||
# loggorilla.fyinf("tools.smart", f"Exception occurred: {res}")
|
||||
return res
|
||||
|
||||
Loading…
Reference in New Issue
Block a user