Chore/refractor (#4454)

* markdown files and env examples cleanup

* components update

* update jsonlines description

* server refractor

* update telemetry

* add execute custom node

* add ui refractor

* add username and password authenticate

* correctly retrieve past images in agentflowv2

* disable e2e temporarily

* add existing username and password authenticate

* update migration to default workspace

* update todo

* blob storage migrating

* throw error on agent tool call error

* add missing execution import

* add referral

* chore: add error message when importData is undefined

* migrate api keys to db

* fix: data too long for column executionData

* migrate api keys from json to db at init

* add info on account setup

* update docstore missing fields

---------

Co-authored-by: chungyau97 <chungyau97@gmail.com>
This commit is contained in:
Henry Heng
2025-05-27 14:29:42 +08:00
committed by GitHub
parent e35a126b46
commit 5a37227d14
560 changed files with 62127 additions and 4100 deletions
+27
View File
@@ -0,0 +1,27 @@
import client from '@/api/client'
const inviteAccount = (body) => client.post(`/account/invite`, body)
const registerAccount = (body) => client.post(`/account/register`, body)
const verifyAccountEmail = (body) => client.post('/account/verify', body)
const resendVerificationEmail = (body) => client.post('/account/resend-verification', body)
const forgotPassword = (body) => client.post('/account/forgot-password', body)
const resetPassword = (body) => client.post('/account/reset-password', body)
const getBillingData = () => client.get('/account/billing')
const cancelSubscription = (body) => client.post('/account/cancel-subscription', body)
const logout = () => client.post('/account/logout')
const getBasicAuth = () => client.get('/account/basic-auth')
const checkBasicAuth = (body) => client.post('/account/basic-auth', body)
export default {
getBillingData,
inviteAccount,
registerAccount,
verifyAccountEmail,
resendVerificationEmail,
forgotPassword,
resetPassword,
cancelSubscription,
logout,
getBasicAuth,
checkBasicAuth
}
+9
View File
@@ -0,0 +1,9 @@
import client from './client'
const fetchLoginActivity = (body) => client.post(`/audit/login-activity`, body)
const deleteLoginActivity = (body) => client.post(`/audit/login-activity/delete`, body)
export default {
fetchLoginActivity,
deleteLoginActivity
}
+14
View File
@@ -0,0 +1,14 @@
import client from './client'
// auth
const resolveLogin = (body) => client.post(`/auth/resolve`, body)
const login = (body) => client.post(`/auth/login`, body)
// permissions
const getAllPermissions = () => client.get(`/auth/permissions`)
export default {
resolveLogin,
login,
getAllPermissions
}
+3
View File
@@ -20,6 +20,8 @@ const getIsChatflowStreaming = (id) => client.get(`/chatflows-streaming/${id}`)
const getAllowChatflowUploads = (id) => client.get(`/chatflows-uploads/${id}`)
const getHasChatflowChanged = (id, lastUpdatedDateTime) => client.get(`/chatflows/has-changed/${id}/${lastUpdatedDateTime}`)
const generateAgentflow = (body) => client.post(`/agentflowv2-generator/generate`, body)
export default {
@@ -33,5 +35,6 @@ export default {
deleteChatflow,
getIsChatflowStreaming,
getAllowChatflowUploads,
getHasChatflowChanged,
generateAgentflow
}
+26 -13
View File
@@ -1,26 +1,39 @@
import axios from 'axios'
import { baseURL } from '@/store/constant'
import { baseURL, ErrorMessage } from '@/store/constant'
import AuthUtils from '@/utils/authUtils'
const apiClient = axios.create({
baseURL: `${baseURL}/api/v1`,
headers: {
'Content-type': 'application/json',
'x-request-from': 'internal'
}
},
withCredentials: true
})
apiClient.interceptors.request.use(function (config) {
const username = localStorage.getItem('username')
const password = localStorage.getItem('password')
if (username && password) {
config.auth = {
username,
password
apiClient.interceptors.response.use(
function (response) {
return response
},
async (error) => {
if (error.response.status === 401) {
// check if refresh is needed
if (error.response.data.message === ErrorMessage.TOKEN_EXPIRED && error.response.data.retry === true) {
const originalRequest = error.config
// call api to get new token
const response = await axios.post(`${baseURL}/api/v1/auth/refreshToken`, {}, { withCredentials: true })
if (response.data.id) {
// retry the original request
return apiClient.request(originalRequest)
}
}
localStorage.removeItem('username')
localStorage.removeItem('password')
AuthUtils.removeCurrentUser()
}
}
return config
})
return Promise.reject(error)
}
)
export default apiClient
+30
View File
@@ -0,0 +1,30 @@
import client from './client'
const getAllDatasets = () => client.get('/datasets')
//dataset
const getDataset = (id) => client.get(`/datasets/set/${id}`)
const createDataset = (body) => client.post(`/datasets/set`, body)
const updateDataset = (id, body) => client.put(`/datasets/set/${id}`, body)
const deleteDataset = (id) => client.delete(`/datasets/set/${id}`)
//rows
const createDatasetRow = (body) => client.post(`/datasets/rows`, body)
const updateDatasetRow = (id, body) => client.put(`/datasets/rows/${id}`, body)
const deleteDatasetRow = (id) => client.delete(`/datasets/rows/${id}`)
const deleteDatasetItems = (ids) => client.patch(`/datasets/rows`, { ids })
const reorderDatasetRow = (body) => client.post(`/datasets/reorder`, body)
export default {
getAllDatasets,
getDataset,
createDataset,
updateDataset,
deleteDataset,
createDatasetRow,
updateDatasetRow,
deleteDatasetRow,
deleteDatasetItems,
reorderDatasetRow
}
+22
View File
@@ -0,0 +1,22 @@
import client from './client'
//evaluation
const getAllEvaluations = () => client.get('/evaluations')
const getIsOutdated = (id) => client.get(`/evaluations/is-outdated/${id}`)
const getEvaluation = (id) => client.get(`/evaluations/${id}`)
const createEvaluation = (body) => client.post(`/evaluations`, body)
const deleteEvaluation = (id) => client.delete(`/evaluations/${id}`)
const runAgain = (id) => client.get(`/evaluations/run-again/${id}`)
const getVersions = (id) => client.get(`/evaluations/versions/${id}`)
const deleteEvaluations = (ids, isDeleteAllVersion) => client.patch(`/evaluations`, { ids, isDeleteAllVersion })
export default {
createEvaluation,
deleteEvaluation,
getAllEvaluations,
getEvaluation,
getIsOutdated,
runAgain,
getVersions,
deleteEvaluations
}
+17
View File
@@ -0,0 +1,17 @@
import client from './client'
const getAllEvaluators = () => client.get('/evaluators')
//evaluators
const createEvaluator = (body) => client.post(`/evaluators`, body)
const getEvaluator = (id) => client.get(`/evaluators/${id}`)
const updateEvaluator = (id, body) => client.put(`/evaluators/${id}`, body)
const deleteEvaluator = (id) => client.delete(`/evaluators/${id}`)
export default {
getAllEvaluators,
createEvaluator,
getEvaluator,
updateEvaluator,
deleteEvaluator
}
+10
View File
@@ -0,0 +1,10 @@
import client from './client'
const getAllFiles = () => client.get('/files')
const deleteFile = (path) => client.delete(`/files`, { params: { path } })
export default {
getAllFiles,
deleteFile
}
+7
View File
@@ -0,0 +1,7 @@
import client from './client'
const getLogs = (startDate, endDate) => client.get(`/logs?startDate=${startDate}&endDate=${endDate}`)
export default {
getLogs
}
+16
View File
@@ -0,0 +1,16 @@
import client from '@/api/client'
// TODO: use this endpoint but without the org id because org id will be null
const getLoginMethods = (organizationId) => client.get(`/loginmethod?organizationId=${organizationId}`)
// TODO: don't use this endpoint.
const getDefaultLoginMethods = () => client.get(`/loginmethod/default`)
const updateLoginMethods = (body) => client.put(`/loginmethod`, body)
const testLoginMethod = (body) => client.post(`/loginmethod/test`, body)
export default {
getLoginMethods,
updateLoginMethods,
testLoginMethod,
getDefaultLoginMethods
}
+4 -1
View File
@@ -7,9 +7,12 @@ const getNodesByCategory = (name) => client.get(`/nodes/category/${name}`)
const executeCustomFunctionNode = (body) => client.post(`/node-custom-function`, body)
const executeNodeLoadMethod = (name, body) => client.post(`/node-load-method/${name}`, body)
export default {
getAllNodes,
getSpecificNode,
executeCustomFunctionNode,
getNodesByCategory
getNodesByCategory,
executeNodeLoadMethod
}
+7
View File
@@ -0,0 +1,7 @@
import client from './client'
const getSettings = () => client.get('/settings')
export default {
getSettings
}
+7
View File
@@ -0,0 +1,7 @@
import client from '@/api/client'
const getPricingPlans = (body) => client.get(`/pricing`, body)
export default {
getPricingPlans
}
+17
View File
@@ -0,0 +1,17 @@
import client from './client'
const getAllRolesByOrganizationId = (organizationId) => client.get(`/role?organizationId=${organizationId}`)
const getRoleById = (id) => client.get(`/auth/roles/${id}`)
const createRole = (body) => client.post(`/role`, body)
const updateRole = (body) => client.put(`/role`, body)
const getRoleByName = (name) => client.get(`/auth/roles/name/${name}`)
const deleteRole = (id, organizationId) => client.delete(`/role?id=${id}&organizationId=${organizationId}`)
export default {
getAllRolesByOrganizationId,
getRoleById,
createRole,
updateRole,
getRoleByName,
deleteRole
}
+7
View File
@@ -0,0 +1,7 @@
import client from './client'
const ssoLogin = (providerName) => client.get(`/${providerName}/login`)
export default {
ssoLogin
}
+59
View File
@@ -0,0 +1,59 @@
import client from './client'
// users
const getUserById = (id) => client.get(`/user?id=${id}`)
const updateUser = (body) => client.put(`/user`, body)
// organization users
const getAllUsersByOrganizationId = (organizationId) => client.get(`/organizationuser?organizationId=${organizationId}`)
const getUserByUserIdOrganizationId = (organizationId, userId) =>
client.get(`/organizationuser?organizationId=${organizationId}&userId=${userId}`)
const getOrganizationsByUserId = (userId) => client.get(`/organizationuser?userId=${userId}`)
const updateOrganizationUser = (body) => client.put(`/organizationuser`, body)
const deleteOrganizationUser = (organizationId, userId) =>
client.delete(`/organizationuser?organizationId=${organizationId}&userId=${userId}`)
const getAdditionalSeatsQuantity = (subscriptionId) =>
client.get(`/organization/additional-seats-quantity?subscriptionId=${subscriptionId}`)
const getCustomerDefaultSource = (customerId) => client.get(`/organization/customer-default-source?customerId=${customerId}`)
const getAdditionalSeatsProration = (subscriptionId, quantity) =>
client.get(`/organization/additional-seats-proration?subscriptionId=${subscriptionId}&quantity=${quantity}`)
const updateAdditionalSeats = (subscriptionId, quantity, prorationDate) =>
client.post(`/organization/update-additional-seats`, { subscriptionId, quantity, prorationDate })
const getPlanProration = (subscriptionId, newPlanId) =>
client.get(`/organization/plan-proration?subscriptionId=${subscriptionId}&newPlanId=${newPlanId}`)
const updateSubscriptionPlan = (subscriptionId, newPlanId, prorationDate) =>
client.post(`/organization/update-subscription-plan`, { subscriptionId, newPlanId, prorationDate })
const getCurrentUsage = () => client.get(`/organization/get-current-usage`)
// workspace users
const getAllUsersByWorkspaceId = (workspaceId) => client.get(`/workspaceuser?workspaceId=${workspaceId}`)
const getUserByRoleId = (roleId) => client.get(`/workspaceuser?roleId=${roleId}`)
const getUserByUserIdWorkspaceId = (userId, workspaceId) => client.get(`/workspaceuser?userId=${userId}&workspaceId=${workspaceId}`)
const getWorkspacesByUserId = (userId) => client.get(`/workspaceuser?userId=${userId}`)
const getWorkspacesByOrganizationIdUserId = (organizationId, userId) =>
client.get(`/workspaceuser?organizationId=${organizationId}&userId=${userId}`)
const deleteWorkspaceUser = (workspaceId, userId) => client.delete(`/workspaceuser?workspaceId=${workspaceId}&userId=${userId}`)
export default {
getUserById,
updateUser,
getAllUsersByOrganizationId,
getUserByUserIdOrganizationId,
getOrganizationsByUserId,
getAllUsersByWorkspaceId,
getUserByRoleId,
getUserByUserIdWorkspaceId,
getWorkspacesByUserId,
getWorkspacesByOrganizationIdUserId,
updateOrganizationUser,
deleteWorkspaceUser,
getAdditionalSeatsQuantity,
getCustomerDefaultSource,
getAdditionalSeatsProration,
updateAdditionalSeats,
getPlanProration,
updateSubscriptionPlan,
getCurrentUsage,
deleteOrganizationUser
}
+30
View File
@@ -0,0 +1,30 @@
import client from './client'
const getAllWorkspacesByOrganizationId = (organizationId) => client.get(`/workspace?organizationId=${organizationId}`)
const getWorkspaceById = (id) => client.get(`/workspace?id=${id}`)
const unlinkUsers = (id, body) => client.post(`/workspace/unlink-users/${id}`, body)
const linkUsers = (id, body) => client.post(`/workspace/link-users/${id}`, body)
const switchWorkspace = (id) => client.post(`/workspace/switch?id=${id}`)
const createWorkspace = (body) => client.post(`/workspace`, body)
const updateWorkspace = (body) => client.put(`/workspace`, body)
const deleteWorkspace = (id) => client.delete(`/workspace/${id}`)
const getSharedWorkspacesForItem = (id) => client.get(`/workspace/shared/${id}`)
const setSharedWorkspacesForItem = (id, body) => client.post(`/workspace/shared/${id}`, body)
export default {
getAllWorkspacesByOrganizationId,
getWorkspaceById,
createWorkspace,
updateWorkspace,
deleteWorkspace,
unlinkUsers,
linkUsers,
switchWorkspace,
getSharedWorkspacesForItem,
setSharedWorkspacesForItem
}