Skip to content

Commit e09573d

Browse files
author
Shreyas-Microsoft
committed
Consistent agent naming
1 parent da3abdf commit e09573d

3 files changed

Lines changed: 34 additions & 14 deletions

File tree

src/backend/api/api_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
logger = AppLogger("APIRoutes")
2727

2828
# start processing the batch
29-
from sql_agents_start import process_batch_async # noqa: E402
29+
# from sql_agents_start import process_batch_async # noqa: E402
3030

3131
# start processing the batch
3232
@router.post("/start-processing")

src/frontend/src/api/utils.tsx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,35 @@ export const determineFileStatus = (file) => {
294294
return "error";
295295
};
296296
// Function to format agent type strings
297-
export const formatAgent = (str = "Agents") => {
298-
if (!str) return "Agents";
299-
return str
297+
export const formatAgent = (str = "Agent") => {
298+
if (!str) return "agent";
299+
300+
const cleaned = str
300301
.replace(/[^a-zA-Z\s]/g, " ") // Remove non-alphabetic characters
301-
.replace(/\s+/g, " ") // Replace multiple spaces with a single space
302-
.trim() // Remove leading/trailing spaces
303-
.split(" ") // Split words
304-
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) // Capitalize first letter
305-
.join(" ") || "Agents"; // Ensure default "Agent" if empty
302+
.replace(/\s+/g, " ") // Collapse multiple spaces
303+
.trim()
304+
.replace(/\bAgents\b/i, "Agent"); // Singularize "Agents" if it's the only word
305+
306+
const words = cleaned
307+
.split(" ")
308+
.filter(Boolean)
309+
.map(w => w.toLowerCase());
310+
311+
const hasAgent = words.includes("agent");
312+
313+
// Capitalize all except "agent" (unless it's the only word)
314+
const result = words.map((word, index) => {
315+
if (word === "agent") {
316+
return words.length === 1 ? "Agent" : "agent"; // Capitalize if it's the only word
317+
}
318+
return word.charAt(0).toUpperCase() + word.slice(1);
319+
});
320+
321+
if (!hasAgent) {
322+
result.push("agent");
323+
}
324+
325+
return result.join(" ");
306326
};
307327

308328
// Function to handle rate limit errors and ensure descriptions end with a dot

src/frontend/src/pages/modernizationPage.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,11 @@ enum ProcessingStage {
425425
}
426426

427427
enum Agents {
428-
Verifier = "Semantic Verifier",
429-
Checker = "Syntax Checker",
430-
Picker = "Picker",
431-
Migrator = "Migrator",
432-
Agents = "Agents"
428+
Verifier = "Semantic Verifier agent",
429+
Checker = "Syntax Checker agent",
430+
Picker = "Picker agent",
431+
Migrator = "Migrator agent",
432+
Agents = "Agent"
433433
}
434434

435435

0 commit comments

Comments
 (0)