ai fix
This commit is contained in:
16
src/app.js
16
src/app.js
@@ -1,5 +1,6 @@
|
||||
const cors = require("cors");
|
||||
const express = require("express");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const swaggerUi = require("swagger-ui-express");
|
||||
const { config } = require("./config");
|
||||
@@ -7,7 +8,14 @@ const { pingMongo } = require("./db/client");
|
||||
const { router: apiRouter } = require("./routes/api");
|
||||
const { openApiDocument } = require("./swagger/openapi");
|
||||
|
||||
const skillFilePath = path.join(__dirname, "..", ".ai", "SKILL.md");
|
||||
const skillFilePaths = [
|
||||
path.join(__dirname, "..", ".idea", "SKILL.md"),
|
||||
path.join(__dirname, "..", ".ai", "SKILL.md"),
|
||||
];
|
||||
|
||||
function getSkillFilePath() {
|
||||
return skillFilePaths.find((filePath) => fs.existsSync(filePath));
|
||||
}
|
||||
|
||||
function createApp() {
|
||||
const app = express();
|
||||
@@ -54,6 +62,12 @@ function createApp() {
|
||||
});
|
||||
|
||||
app.get("/SKILL.md", (request, response) => {
|
||||
const skillFilePath = getSkillFilePath();
|
||||
if (!skillFilePath) {
|
||||
response.status(404).json({ error: "SKILL.md not found" });
|
||||
return;
|
||||
}
|
||||
|
||||
response.type("text/markdown");
|
||||
response.sendFile(skillFilePath);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user