Skip to content

Commit b795ad3

Browse files
committed
fixing tools files and datetime
1 parent 548bed4 commit b795ad3

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

src/backend/kernel_agents/agent_base.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,11 @@ async def kernel_wrapper(kernel_arguments: KernelArguments = None, **kwargs) ->
457457
return kernel_wrapper
458458

459459
@staticmethod
460-
def load_tools_config(agent_type: str, config_path: Optional[str] = None) -> Dict[str, Any]:
460+
def load_tools_config(filename: str, config_path: Optional[str] = None) -> Dict[str, Any]:
461461
"""Load tools configuration from a JSON file.
462462
463463
Args:
464-
agent_type: The type of agent (e.g., "marketing", "hr")
464+
filename: The filename without extension (e.g., "hr", "marketing")
465465
config_path: Optional explicit path to the configuration file
466466
467467
Returns:
@@ -471,16 +471,26 @@ def load_tools_config(agent_type: str, config_path: Optional[str] = None) -> Dic
471471
# Default path relative to the tools directory
472472
current_dir = os.path.dirname(os.path.abspath(__file__))
473473
backend_dir = os.path.dirname(current_dir) # Just one level up to get to backend dir
474-
config_path = os.path.join(backend_dir, "tools", f"{agent_type}_tools.json")
474+
475+
# Normalize filename to avoid issues with spaces and capitalization
476+
# Convert "Hr Agent" to "hr" and "TechSupport Agent" to "tech_support"
477+
logging.debug(f"Normalizing filename: {filename}")
478+
normalized_filename = filename.replace(" ", "_").replace("-", "_").lower()
479+
# If it ends with "_agent", remove it
480+
if normalized_filename.endswith("_agent"):
481+
normalized_filename = normalized_filename[:-6]
482+
logging
483+
config_path = os.path.join(backend_dir, "tools", f"{normalized_filename}_tools.json")
484+
logging.debug(f"Looking for tools config at: {config_path}")
475485

476486
try:
477487
with open(config_path, "r") as f:
478488
return json.load(f)
479489
except Exception as e:
480-
logging.error(f"Error loading {agent_type} tools configuration: {e}")
490+
logging.error(f"Error loading {filename} tools configuration: {e}")
481491
# Return empty default configuration
482492
return {
483-
"agent_name": f"{agent_type.capitalize()}Agent",
493+
"agent_name": f"{filename.capitalize()}Agent",
484494
"system_message": "You are an AI assistant",
485495
"tools": []
486496
}

src/backend/models/messages_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AgentType(str, Enum):
4646
PROCUREMENT = "Procurement_Agent"
4747
PRODUCT = "Product_Agent"
4848
GENERIC = "Generic_Agent"
49-
TECH_SUPPORT= "TechSupport_Agent"
49+
TECH_SUPPORT= "Tech_Support_Agent"
5050
GROUP_CHAT_MANAGER = "Group_Chat_Manager"
5151
PLANNER = "Planner_Agent"
5252

src/frontend/wwwroot/task/task.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,16 @@
113113
};
114114

115115
const toDateTime = (timestamp) => {
116-
const date = new Date(timestamp * 1000);
116+
// Handle ISO date string format (e.g., 2025-04-25T03:01:13.093260)
117+
// instead of Unix timestamp
118+
const date = new Date(timestamp);
119+
120+
// Check if date is valid
121+
if (isNaN(date.getTime())) {
122+
console.warn("Invalid date format:", timestamp);
123+
return "Invalid date";
124+
}
125+
117126
const options = { month: "short", day: "numeric" };
118127
const timeOptions = { hour: "numeric", minute: "numeric", hour12: true };
119128
return `${date.toLocaleDateString(
@@ -215,7 +224,7 @@
215224

216225
taskStatusDetails.innerHTML = `
217226
<p class="mb-3"><strong>Summary:</strong> ${task.summary}</p>
218-
<p><strong>Created:</strong> ${toDateTime(task.ts)}</p>
227+
<p><strong>Created:</strong> ${toDateTime(task.timestamp)}</p>
219228
`;
220229
};
221230

@@ -512,7 +521,7 @@
512521
${toAgentName(
513522
message.source
514523
)}${toDateTime(
515-
message.ts
524+
message.timestamp
516525
)} AI-generated content may be incorrect
517526
</div>
518527
<div class="notification is-light mt-1">
@@ -527,7 +536,7 @@
527536
<div class="media-content">
528537
<div class="content">
529538
<div class="is-size-7 has-text-weight-medium has-text-grey is-flex is-justify-content-end">
530-
You • ${toDateTime(message.ts)}
539+
You • ${toDateTime(message.timestamp)}
531540
</div>
532541
<div class="notification is-info is-light mt-1 is-pulled-right">
533542
${markdownConverter.makeHtml(

0 commit comments

Comments
 (0)