Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oxygent/preset_tools/file_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def write_file(


@file_tools.tool(
description="Read the content of a file. Returns an error message if the file does not exist."
description="Read the content of a file. Returns an error message if the file does not exist. For uploaded files, use the complete file path including directory structure."
)
def read_file(path: str = Field(description="Path to the file to read")) -> str:
if not os.path.exists(path):
Expand Down
10 changes: 10 additions & 0 deletions oxygent/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
After you call the retrieval tool, the user will give you feedback on the retrieved tools.
You cannot call non-existent tools out of thin air.

File handling guidelines:
- When you see file attachments in the format "File: filename, Path: full_path", use the complete file path for tool calls
- For uploaded files, always use the full path including directory structure
- Do not extract only the filename - use the complete path provided

Important instructions:
1. When you have collected enough information to answer the user's question, please respond in the following format:
<think>Your thinking (if analysis is needed)</think>
Expand All @@ -74,6 +79,11 @@
4. Use appropriate context from the user's question
5. Avoid simply repeating the raw data

File handling guidelines:
- When you see file attachments in the format "File: filename, Path: full_path", use the complete file path for tool calls
- For uploaded files, always use the full path including directory structure
- Do not extract only the filename - use the complete path provided

Tools for querying time can be obtained through retrieval tools.
${additional_prompt}
"""
Expand Down
8 changes: 5 additions & 3 deletions oxygent/schemas/oxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,17 @@ def get_query(self, master_level=False):
md_attachments = []
for i, attachment in enumerate(self.arguments.get("attachments", [])):
if attachment.startswith("../static/"):
attachment = f"{Config.get_cache_save_dir()}/uploads{attachment[9:]}"
relative_path = attachment[9:].lstrip('/')
attachment = f"{Config.get_cache_save_dir()}/uploads/{relative_path}"
is_image_flag = "!" if is_image(attachment) else ""
attachment_base_name = os.path.basename(attachment)
# Generate a clearer format to help LLM correctly understand the path
md_attachments.append(
f"{is_image_flag}[{attachment_base_name}]({attachment})"
f"{is_image_flag}File: {attachment_base_name}, Path: {attachment}"
)
attachments_str = "\n".join(md_attachments)
if attachments_str:
attachments_str += " "
attachments_str += "\n\n"

if master_level:
return attachments_str + self.shared_data.get("query", "")
Expand Down