Skip to content
Merged
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
53 changes: 1 addition & 52 deletions app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Ollama } from "ollama";
import { z } from "zod";
import { exec } from "child_process";
import { promisify } from "util";
import { commandKeywords } from "@/data/keywords";

const execAsync = promisify(exec);

Expand Down Expand Up @@ -119,58 +120,6 @@ export async function POST(request: NextRequest) {
const { message, context } = await request.json();

// Determine if this is a command request or general query
const commandKeywords = [
"command",
"execute",
"run",
"apply",
"block",
"allow",
"rule",
"iptables",
"add",
"remove",
"delete",
"create",
"configure",
"set",
"enable",
"disable",
"drop",
"accept",
"reject",
"forward",
"input",
"output",
"chain",
"table",
"flush",
"policy",
"insert",
"append",
"firewall",
"route",
"redirect",
"nat",
"masquerade",
"port",
"protocol",
"tcp",
"udp",
"icmp",
"ssh",
"http",
"https",
"connect",
"disconnect",
"link",
"unlink",
"bridge",
"subnet",
"vlan",
"interface",
];

const isCommandRequest = commandKeywords.some((keyword) =>
message.toLowerCase().includes(keyword)
);
Expand Down
Loading