Initial upload to Gitea
This commit is contained in:
1 parent
78193254ad
commit
8478998cae
1485 files changed
+461025
-42348
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
function assistantHistoryDb(query) {
|
||||
const chat = { id: 7, title: "chat", created_at: 0, updated_at: 0 };
|
||||
const db = {
|
||||
query: async (sql, params) => {
|
||||
if (sql.includes("FROM dashboard_assistant_chats c JOIN users")) return [{ ...chat }];
|
||||
return query(sql, params);
|
||||
}
|
||||
};
|
||||
db.pool = { getConnection: async () => ({
|
||||
beginTransaction: async () => {}, commit: async () => {}, rollback: async () => {}, release() {},
|
||||
execute: async (sql, params) => {
|
||||
if (sql.startsWith("SELECT id, email, suspended FROM users")) return [[{ id: params[0], email: params[1], suspended: 0 }]];
|
||||
if (sql.startsWith("SELECT id FROM dashboard_assistant_chats")) return [[{ id: params[0] }]];
|
||||
if (sql.startsWith("SELECT id, title")) return [[{ ...chat }]];
|
||||
if (sql.startsWith("SELECT title")) return [[{ title: chat.title }]];
|
||||
if (sql.startsWith("INSERT INTO dashboard_assistant_chats")) return [{ insertId: chat.id }];
|
||||
return [await query(sql, params)];
|
||||
}
|
||||
}) };
|
||||
return db;
|
||||
}
|
||||
|
||||
module.exports = { assistantHistoryDb };
|
||||
Reference in new issue
Block a user