mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
Merge branch 'main' into feature/ChatHistory2
This commit is contained in:
@@ -167,7 +167,7 @@
|
||||
"data": {
|
||||
"id": "sqlDatabaseChain_0",
|
||||
"label": "Sql Database Chain",
|
||||
"version": 2,
|
||||
"version": 4,
|
||||
"name": "sqlDatabaseChain",
|
||||
"type": "SqlDatabaseChain",
|
||||
"baseClasses": ["SqlDatabaseChain", "BaseChain", "Runnable"],
|
||||
@@ -206,6 +206,46 @@
|
||||
"placeholder": "1270.0.0.1:5432/chinook",
|
||||
"id": "sqlDatabaseChain_0-input-url-string"
|
||||
},
|
||||
{
|
||||
"label": "Include Tables",
|
||||
"name": "includesTables",
|
||||
"type": "string",
|
||||
"description": "Tables to include for queries, seperated by comma. Can only use Include Tables or Ignore Tables",
|
||||
"placeholder": "table1, table2",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "sqlDatabaseChain_0-input-includesTables-string"
|
||||
},
|
||||
{
|
||||
"label": "Ignore Tables",
|
||||
"name": "ignoreTables",
|
||||
"type": "string",
|
||||
"description": "Tables to ignore for queries, seperated by comma. Can only use Ignore Tables or Include Tables",
|
||||
"placeholder": "table1, table2",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "sqlDatabaseChain_0-input-ignoreTables-string"
|
||||
},
|
||||
{
|
||||
"label": "Sample table's rows info",
|
||||
"name": "sampleRowsInTableInfo",
|
||||
"type": "number",
|
||||
"description": "Number of sample row for tables to load for info.",
|
||||
"placeholder": "3",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "sqlDatabaseChain_0-input-sampleRowsInTableInfo-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Keys",
|
||||
"name": "topK",
|
||||
"type": "number",
|
||||
"description": "If you are querying for several rows of a table you can select the maximum number of results you want to get by using the top_k parameter (default is 10). This is useful for avoiding query results that exceed the prompt max length or consume tokens unnecessarily.",
|
||||
"placeholder": "10",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "sqlDatabaseChain_0-input-topK-number"
|
||||
},
|
||||
{
|
||||
"label": "Custom Prompt",
|
||||
"name": "customPrompt",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flowise",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"description": "Flowiseai Server",
|
||||
"main": "dist/index",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -27,6 +27,7 @@ export default class Start extends Command {
|
||||
LOG_LEVEL: Flags.string(),
|
||||
TOOL_FUNCTION_BUILTIN_DEP: Flags.string(),
|
||||
TOOL_FUNCTION_EXTERNAL_DEP: Flags.string(),
|
||||
NUMBER_OF_PROXIES: Flags.string(),
|
||||
DATABASE_TYPE: Flags.string(),
|
||||
DATABASE_PATH: Flags.string(),
|
||||
DATABASE_PORT: Flags.string(),
|
||||
@@ -72,6 +73,7 @@ export default class Start extends Command {
|
||||
|
||||
if (flags.PORT) process.env.PORT = flags.PORT
|
||||
if (flags.DEBUG) process.env.DEBUG = flags.DEBUG
|
||||
if (flags.NUMBER_OF_PROXIES) process.env.NUMBER_OF_PROXIES = flags.NUMBER_OF_PROXIES
|
||||
|
||||
// Authorization
|
||||
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
|
||||
|
||||
@@ -12,7 +12,7 @@ async function addRateLimiter(id: string, duration: number, limit: number, messa
|
||||
rateLimiters[id] = rateLimit({
|
||||
windowMs: duration * 1000,
|
||||
max: limit,
|
||||
handler: (req, res) => {
|
||||
handler: (_, res) => {
|
||||
res.status(429).send(message)
|
||||
}
|
||||
})
|
||||
@@ -33,15 +33,19 @@ export function getRateLimiter(req: Request, res: Response, next: NextFunction)
|
||||
|
||||
export async function createRateLimiter(chatFlow: IChatFlow) {
|
||||
if (!chatFlow.apiConfig) return
|
||||
const apiConfig: any = JSON.parse(chatFlow.apiConfig)
|
||||
const apiConfig = JSON.parse(chatFlow.apiConfig)
|
||||
|
||||
const rateLimit: { limitDuration: number; limitMax: number; limitMsg: string } = apiConfig.rateLimit
|
||||
if (!rateLimit) return
|
||||
|
||||
const { limitDuration, limitMax, limitMsg } = rateLimit
|
||||
if (limitMax && limitDuration && limitMsg) await addRateLimiter(chatFlow.id, limitDuration, limitMax, limitMsg)
|
||||
}
|
||||
|
||||
export async function initializeRateLimiter(chatFlowPool: IChatFlow[]) {
|
||||
await chatFlowPool.map(async (chatFlow) => {
|
||||
await createRateLimiter(chatFlow)
|
||||
})
|
||||
await Promise.all(
|
||||
chatFlowPool.map(async (chatFlow) => {
|
||||
await createRateLimiter(chatFlow)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user