Skip to content

Commit b3be609

Browse files
committed
Removed impact score from /rcc-whyused command because because of its misleading nature and completed /rcc-whyused command
1 parent 0ceb9dc commit b3be609

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

ai-assistant/src/commands/WhyUsedCommand.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ISlashCommand,
88
SlashCommandContext,
99
} from "@rocket.chat/apps-engine/definition/slashcommands";
10-
import { writeFileSync } from "fs";
1110
import { Neo4j } from "../core/services/db/neo4j";
1211
// import { renderDiagramToBase64URI } from "../core/diagram";
1312
import { PromptFactory } from "../core/prompt.factory";
@@ -26,7 +25,6 @@ export class WhyUsedCommand implements ISlashCommand {
2625
http: IHttp,
2726
query: string
2827
): Promise<{
29-
impact: string;
3028
explanation: string;
3129
diagram: string;
3230
} | null> {
@@ -41,6 +39,7 @@ export class WhyUsedCommand implements ISlashCommand {
4139
* ---------------------------------------------------------------------------------------------
4240
*/
4341
const keywords = await Query.getDBKeywordsFromQuery(llm, query);
42+
console.log(keywords);
4443
if (!keywords.length) return null;
4544

4645
/**
@@ -70,7 +69,6 @@ export class WhyUsedCommand implements ISlashCommand {
7069
);
7170
if (!result) return null;
7271

73-
const impact = result.split("<IMPACT>")[1].split("</IMPACT>")[0].trim();
7472
const explanation = result
7573
.split("<EXPLANATION>")[1]
7674
.split("</EXPLANATION>")[0]
@@ -86,19 +84,18 @@ export class WhyUsedCommand implements ISlashCommand {
8684
* Generate the diagram for the user's query given the nodes data
8785
* ---------------------------------------------------------------------------------------------
8886
*/
89-
const data = { impact, explanation, diagram: "" };
90-
if (!diagram) return { impact, explanation, diagram: "" };
91-
92-
if (diagram) {
93-
const parsedDiagram = diagram
94-
.replace("```mermaid", "")
95-
.replace("```", "")
96-
.trim();
97-
writeFileSync("output.txt", parsedDiagram);
98-
try {
99-
// data.diagram = await renderDiagramToBase64URI(parsedDiagram);
100-
} catch {}
101-
}
87+
const data = { explanation, diagram: "" };
88+
// TODO:
89+
// if (diagram) {
90+
// const parsedDiagram = diagram
91+
// .replace("```mermaid", "")
92+
// .replace("```", "")
93+
// .trim();
94+
// writeFileSync("output.txt", parsedDiagram);
95+
// try {
96+
// // data.diagram = await renderDiagramToBase64URI(parsedDiagram);
97+
// } catch {}
98+
// }
10299

103100
return data;
104101
}
@@ -126,10 +123,6 @@ export class WhyUsedCommand implements ISlashCommand {
126123
return;
127124
}
128125

129-
let message = "";
130-
message += `\n${res.explanation}\n`;
131-
message += `\n**Impact:** ${res.impact}`;
132-
133-
await sendEditedMessage(message, [res.diagram!]);
126+
await sendEditedMessage(res.explanation, [res.diagram!]);
134127
}
135128
}

0 commit comments

Comments
 (0)