depriciate mock backend

This commit is contained in:
Alex
2024-12-20 11:01:57 +00:00
parent 666240f21e
commit 2aea24afdd
7 changed files with 0 additions and 1799 deletions

View File

@@ -1,5 +0,0 @@
# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

View File

@@ -1,11 +0,0 @@
FROM node:20.6.1-bullseye-slim
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "npm", "run", "start"]

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +0,0 @@
{
"name": "mock-backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node src/server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"json-server": "^0.17.4",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/json-server": "^0.14.5"
}
}

View File

@@ -1,244 +0,0 @@
{
"combine": [
{
"date": "default",
"description": "default",
"docLink": "default",
"fullName": "default",
"language": "default",
"location": "local",
"model": "openai_text-embedding-ada-002",
"name": "default",
"version": ""
},
{
"date": "13/02/2023",
"description": "Serverless Framework, the serverless application framework for building web, mobile and IoT applications on AWS Lambda, Azure Functions, Google CloudFunctions & more!",
"docLink": "https://serverless.com/framework/docs/",
"fullName": "Serverless Framework",
"language": "serverless",
"location": "remote",
"name": "serverless framework",
"version": "3.27.0"
},
{
"date": "15/02/2023",
"description": "Machine Learning in Python",
"docLink": "https://scikit-learn.org/stable/",
"fullName": "scikit-learn",
"language": "python",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "scikit-learn",
"version": "1.2.1"
},
{
"date": "07/02/2023",
"description": "Machine Learning in Python",
"docLink": "https://scikit-learn.org/stable/",
"fullName": "scikit-learn",
"language": "python",
"location": "remote",
"name": "scikit-learn",
"version": "1.2.1"
},
{
"date": "07/02/2023",
"description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.",
"docLink": "https://pandas.pydata.org/docs/",
"fullName": "Pandas",
"language": "python",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "pandas",
"version": "1.5.3"
},
{
"date": "07/02/2023",
"description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.",
"docLink": "https://pandas.pydata.org/docs/",
"fullName": "Pandas",
"language": "python",
"location": "remote",
"name": "pandas",
"version": "1.5.3"
},
{
"date": "29/02/2023",
"description": "Python is a programming language that lets you work quickly and integrate systems more effectively.",
"docLink": "https://docs.python.org/3/",
"fullName": "Python",
"language": "python",
"location": "remote",
"model": "huggingface_sentence-transformers-all-mpnet-base-v2",
"name": "python",
"version": "3.11.1"
},
{
"date": "15/02/2023",
"description": "Python is a programming language that lets you work quickly and integrate systems more effectively.",
"docLink": "https://docs.python.org/3/",
"fullName": "Python",
"language": "python",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "python",
"version": "3.11.1"
},
{
"date": "07/02/2023",
"description": "Python is a programming language that lets you work quickly and integrate systems more effectively.",
"docLink": "https://docs.python.org/3/",
"fullName": "Python",
"language": "python",
"location": "remote",
"name": "python",
"version": "3.11.1"
},
{
"date": "08/02/2023",
"description": "GPT Index is a project consisting of a set of data structures designed to make it easier to use large external knowledge bases with LLMs.",
"docLink": "https://gpt-index.readthedocs.io/en/latest/index.html",
"fullName": "LangChain",
"language": "python",
"location": "remote",
"name": "gpt-index",
"version": "0.4.0"
},
{
"date": "15/02/2023",
"description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.",
"docLink": "https://langchain.readthedocs.io/en/latest/index.html",
"fullName": "LangChain",
"language": "python",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "langchain",
"version": "0.0.87"
},
{
"date": "07/02/2023",
"description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.",
"docLink": "https://langchain.readthedocs.io/en/latest/index.html",
"fullName": "LangChain",
"language": "python",
"location": "remote",
"name": "langchain",
"version": "0.0.79"
},
{
"date": "13/03/2023",
"description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.",
"docLink": "https://langchain.readthedocs.io/en/latest/index.html",
"fullName": "LangChain",
"language": "python",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "langchain",
"version": "0.0.109"
},
{
"date": "16/03/2023",
"description": "A JavaScript library for building user interfaces\nGet Started\n",
"docLink": "https://reactjs.org/",
"fullName": "React",
"language": "javascript",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "react",
"version": "v18.2.0"
},
{
"date": "15/02/2023",
"description": "is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.",
"docLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
"fullName": "JavaScript",
"language": "javascript",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "javascript",
"version": "ES2015"
},
{
"date": "16/03/2023",
"description": "An approachable, performant and versatile framework for building web user interfaces. ",
"docLink": "https://vuejs.org/",
"fullName": "Vue.js",
"language": "javascript",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "vuejs",
"version": "v3.3.0"
},
{
"date": "16/03/2023",
"description": "Get ready for a development environment that can finally catch up with you.",
"docLink": "https://vitejs.dev/",
"fullName": "Vite",
"language": "javascript",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "vitejs",
"version": "v4.2.0"
},
{
"date": "15/02/2023",
"description": "Solidity is an object-oriented, high-level language for implementing smart contracts.",
"docLink": "https://docs.soliditylang.org/en/v0.8.18/",
"fullName": "Solidity",
"language": "ethereum",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "solidity",
"version": "0.8.18"
},
{
"date": "07/02/2023",
"description": "Solidity is an object-oriented, high-level language for implementing smart contracts.",
"docLink": "https://docs.soliditylang.org/en/v0.8.18/",
"fullName": "Solidity",
"language": "ethereum",
"location": "remote",
"name": "solidity",
"version": "0.8.18"
},
{
"date": "28/02/2023",
"description": "GPT-powered chat for documentation search & assistance. ",
"docLink": "https://github.com/arc53/DocsGPT/wiki",
"fullName": "DocsGPT",
"language": "docsgpt",
"location": "remote",
"model": "huggingface_sentence-transformers-all-mpnet-base-v2",
"name": "docsgpt",
"version": "0.1.0"
},
{
"date": "28/02/2023",
"description": "GPT-powered chat for documentation search & assistance. ",
"docLink": "https://github.com/arc53/DocsGPT/wiki",
"fullName": "DocsGPT",
"language": "docsgpt",
"location": "remote",
"model": "openai_text-embedding-ada-002",
"name": "docsgpt",
"version": "0.1.0"
}
],
"conversations": [
{
"id": "65cf39c936523eea21ebe117",
"name": "Request clarification"
},
{
"id": "65cf39ba36523eea21ebe116",
"name": "Clarification request"
},
{
"id": "65cf37e97d527c332bbac933",
"name": "Greetings, assistance inquiry."
}],
"docs_check": {
"status": "loaded"
}
}

View File

@@ -1,7 +0,0 @@
{
"/api/*": "/$1",
"/get_conversations": "/conversations",
"/get_single_conversation?id=:id": "/conversations/:id",
"/delete_conversation?id=:id": "/conversations/:id",
"/conversations?id=:id": "/conversations/:id"
}

View File

@@ -1,131 +0,0 @@
import jsonServer from "json-server";
import routes from "./mocks/routes.json" assert { type: "json" };
import { v4 as uuid } from "uuid";
import cors from 'cors'
const server = jsonServer.create();
const router = jsonServer.router("./src/mocks/db.json");
const middlewares = jsonServer.defaults();
const localStorage = [];
server.use(middlewares);
server.use(cors({ origin: ['*'] }))
server.use(jsonServer.rewriter(routes));
server.use((req, res, next) => {
if (req.method === "POST") {
if (req.url.includes("/delete_conversation")) {
req.method = "DELETE";
} else if (req.url === "/upload") {
const taskId = uuid();
localStorage.push(taskId);
}
}
next();
});
router.render = (req, res) => {
if (req.url === "/feedback") {
res.status(200).jsonp({ status: "ok" });
} else if (req.url === "/upload") {
res.status(200).jsonp({
status: "ok",
task_id: localStorage[localStorage.length - 1],
});
} else if (req.url.includes("/task_status")) {
const taskId = req.query["task_id"];
const taskIdExists = localStorage.includes(taskId);
if (taskIdExists) {
res.status(200).jsonp({
result: {
directory: "temp",
filename: "install.rst",
formats: [".rst", ".md", ".pdf"],
name_job: "somename",
user: "local",
},
status: "SUCCESS",
});
} else {
res.status(404).jsonp({});
}
} else if (req.url === "/stream" && req.method === "POST") {
res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
});
const message = ('Hi, How are you today?').split(' ');
let index = 0;
const interval = setInterval(() => {
if (index < message.length) {
res.write(`data: {"answer": "${message[index++]} "}\n`);
} else {
res.write(`data: {"type": "id", "id": "65cbc39d11f077b9eeb06d26"}\n`)
res.write(`data: {"type": "end"}\n`)
clearInterval(interval); // Stop the interval once the message is fully streamed
res.end(); // End the response
}
}, 500); // Send a word every 1 second
}
else if (req.url === '/search' && req.method === 'POST') {
res.status(200).json(
[
{
"text": "\n\n/api/answer\nIt's a POST request that sends a JSON in body with 4 values. It will receive an answer for a user provided question.\n",
"title": "API-docs.md"
},
{
"text": "\n\nOur Standards\n\nExamples of behavior that contribute to a positive environment for our\ncommunity include:\n* Demonstrating empathy and kindness towards other people\n",
"title": "How-to-use-different-LLM.md"
}
]
)
}
else if (req.url === '/get_prompts' && req.method === 'GET') {
res.status(200).json([
{
"id": "default",
"name": "default",
"type": "public"
},
{
"id": "creative",
"name": "creative",
"type": "public"
},
{
"id": "strict",
"name": "strict",
"type": "public"
}
]);
}
else if (req.url.startsWith('/get_single_prompt') && req.method==='GET') {
const id = req.query.id;
console.log('hre');
if (id === 'creative')
res.status(200).json({
"content": "You are a DocsGPT, friendly and helpful AI assistant by Arc53 that provides help with documents. You give thorough answers with code examples if possible."
})
else if (id === 'strict') {
res.status(200).json({
"content": "You are an AI Assistant, DocsGPT, adept at offering document assistance. \nYour expertise lies in providing answer on top of provided context."
})
}
else {
res.status(200).json({
"content": "You are a helpful AI assistant, DocsGPT, specializing in document assistance, designed to offer detailed and informative responses."
})
}
}
else {
res.status(res.statusCode).jsonp(res.locals.data);
}
};
server.use(router);
server.listen(8080, () => {
console.log("JSON Server is running");
});