Skip to content

Commit b87491b

Browse files
committed
Added /rcc-devdocs command skeleton
1 parent 6f95c12 commit b87491b

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

ai-assistant/src/RocketChatterApp.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from "@rocket.chat/apps-engine/definition/api";
1717
import { UIKitViewSubmitInteractionContext } from "@rocket.chat/apps-engine/definition/uikit";
1818
import { AskCommand } from "./commands/AskCommand";
19+
import { DevDocsCommand } from "./commands/DevDocsCommand";
1920
import { DiagramCommand } from "./commands/DiagramCommand";
2021
import { DocumentCommand } from "./commands/DocumentCommand";
2122
import { FindSimilarCommand } from "./commands/FindSimilar";
@@ -49,6 +50,7 @@ export class RocketChatterApp extends App {
4950
configuration.slashCommands.provideSlashCommand(new HelpCommand());
5051

5152
configuration.slashCommands.provideSlashCommand(new AskCommand());
53+
configuration.slashCommands.provideSlashCommand(new DevDocsCommand());
5254
configuration.slashCommands.provideSlashCommand(new DiagramCommand());
5355
configuration.slashCommands.provideSlashCommand(new DocumentCommand());
5456
configuration.slashCommands.provideSlashCommand(
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import {
2+
IHttp,
3+
IModify,
4+
IRead,
5+
} from "@rocket.chat/apps-engine/definition/accessors";
6+
import {
7+
ISlashCommand,
8+
SlashCommandContext,
9+
} from "@rocket.chat/apps-engine/definition/slashcommands";
10+
11+
import { Neo4j } from "../core/db/neo4j";
12+
import { MiniLML6 } from "../core/embeddings/minilml6";
13+
import { Llama3_70B } from "../core/llm/llama3_70B";
14+
import { handleCommandResponse } from "../utils/handleCommandResponse";
15+
16+
export class DevDocsCommand implements ISlashCommand {
17+
public command = "rcc-devdocs";
18+
public i18nParamsExample = "";
19+
public i18nDescription = "";
20+
public providesPreview = false;
21+
22+
private async process(http: IHttp, query: string): Promise<string | null> {
23+
const db = new Neo4j(http);
24+
const llm = new Llama3_70B(http);
25+
const embeddingModel = new MiniLML6(http);
26+
27+
return "UNDER DEVELOPMENT";
28+
}
29+
30+
public async executor(
31+
context: SlashCommandContext,
32+
read: IRead,
33+
modify: IModify,
34+
http: IHttp
35+
): Promise<void> {
36+
const query = context.getArguments().join(" ");
37+
if (!query) {
38+
throw new Error("Error!");
39+
}
40+
41+
const sendEditedMessage = await handleCommandResponse(
42+
query,
43+
context.getSender(),
44+
context.getRoom(),
45+
modify,
46+
this.command
47+
);
48+
49+
const res = await this.process(http, query);
50+
if (res) {
51+
await sendEditedMessage(res);
52+
} else {
53+
await sendEditedMessage("❌ Unable to process your query");
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)