feat: split AI Input Agent into Copy/Type Agent submenu with settings
Renames the sidebar entry to "AI Copy/Type Agent" with Copy Agent, Type Agent, and Settings sub-pages. Settings shows the server's LAN IP address (via a new /api/ai/network-info endpoint) since it changes depending on which office the app is running in. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import express, { Request, Response } from "express";
|
||||
import fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import { storage } from "../storage";
|
||||
import { classifyInternalChat } from "../ai/internal-chat-graph";
|
||||
@@ -14,6 +15,24 @@ function getChatHistoryPath(userId: number): string {
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// GET /api/ai/network-info — local LAN IP address(es) of this server
|
||||
router.get("/network-info", async (req: Request, res: Response): Promise<any> => {
|
||||
try {
|
||||
const interfaces = os.networkInterfaces();
|
||||
const addresses: string[] = [];
|
||||
for (const name of Object.keys(interfaces)) {
|
||||
for (const iface of interfaces[name] ?? []) {
|
||||
if (iface.family === "IPv4" && !iface.internal) {
|
||||
addresses.push(iface.address);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.status(200).json({ ipAddress: addresses[0] ?? null, addresses });
|
||||
} catch (err) {
|
||||
return res.status(500).json({ error: "Failed to determine network info", details: String(err) });
|
||||
}
|
||||
});
|
||||
|
||||
// GET /api/ai/settings
|
||||
router.get("/settings", async (req: Request, res: Response): Promise<any> => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user