Merge branch 'main' into feature/Zapier

This commit is contained in:
chungyau97
2023-06-30 09:30:38 +08:00
26 changed files with 281 additions and 85 deletions
+1
View File
@@ -3,4 +3,5 @@ PORT=3000
# FLOWISE_PASSWORD=1234
# DEBUG=true
# DATABASE_PATH=/your_database_path/.flowise
# APIKEY_PATH=/your_api_key_path/.flowise
# EXECUTION_MODE=child or main
+5 -5
View File
@@ -9,10 +9,10 @@ export interface IChatFlow {
id: string
name: string
flowData: string
apikeyid: string
deployed: boolean
isPublic: boolean
updatedDate: Date
createdDate: Date
apikeyid?: string
chatbotConfig?: string
}
@@ -22,7 +22,7 @@ export interface IChatMessage {
content: string
chatflowid: string
createdDate: Date
sourceDocuments: string
sourceDocuments?: string
}
export interface ITool {
@@ -30,8 +30,8 @@ export interface ITool {
name: string
description: string
color: string
schema: string
func: string
schema?: string
func?: string
updatedDate: Date
createdDate: Date
}
+4 -4
View File
@@ -13,11 +13,11 @@ export class ChatFlow implements IChatFlow {
@Column()
flowData: string
@Column({ nullable: true })
apikeyid: string
@Column()
deployed: boolean
isPublic: boolean
@Column({ nullable: true })
apikeyid?: string
@Column({ nullable: true })
chatbotConfig?: string
+1 -1
View File
@@ -18,7 +18,7 @@ export class ChatMessage implements IChatMessage {
content: string
@Column({ nullable: true })
sourceDocuments: string
sourceDocuments?: string
@CreateDateColumn()
createdDate: Date
+2 -2
View File
@@ -17,10 +17,10 @@ export class Tool implements ITool {
color: string
@Column({ nullable: true })
schema: string
schema?: string
@Column({ nullable: true })
func: string
func?: string
@CreateDateColumn()
createdDate: Date
+10
View File
@@ -211,6 +211,16 @@ export class App {
return res.status(404).send(`Chatflow ${req.params.id} not found`)
})
// Get specific chatflow via id (PUBLIC endpoint, used when sharing chatbot link)
this.app.get('/api/v1/public-chatflows/:id', async (req: Request, res: Response) => {
const chatflow = await this.AppDataSource.getRepository(ChatFlow).findOneBy({
id: req.params.id
})
if (chatflow && chatflow.isPublic) return res.json(chatflow)
else if (chatflow && !chatflow.isPublic) return res.status(401).send(`Unauthorized`)
return res.status(404).send(`Chatflow ${req.params.id} not found`)
})
// Save chatflow
this.app.post('/api/v1/chatflows', async (req: Request, res: Response) => {
const body = req.body
+1 -1
View File
@@ -463,7 +463,7 @@ export const isSameOverrideConfig = (
* @returns {string}
*/
export const getAPIKeyPath = (): string => {
return path.join(__dirname, '..', '..', 'api.json')
return process.env.APIKEY_PATH ? path.join(process.env.APIKEY_PATH, 'api.json') : path.join(__dirname, '..', '..', 'api.json')
}
/**