mirror of
https://github.com/langgenius/dify.git
synced 2026-10-29 18:07:39 +08:00
Merge branch 'feat/collaboration2' into feat/support-agent-sandbox
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { type } from '@orpc/contract'
|
||||
import { base } from '../base'
|
||||
|
||||
export const accountAvatarContract = base
|
||||
.route({
|
||||
path: '/account/avatar',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
query: {
|
||||
avatar: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ avatar_url: string }>())
|
||||
@@ -0,0 +1,15 @@
|
||||
import type { WorkflowOnlineUsersResponse } from '@/models/app'
|
||||
import { type } from '@orpc/contract'
|
||||
import { base } from '../base'
|
||||
|
||||
export const workflowOnlineUsersContract = base
|
||||
.route({
|
||||
path: '/apps/workflows/online-users',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
query: {
|
||||
workflow_ids: string
|
||||
}
|
||||
}>())
|
||||
.output(type<WorkflowOnlineUsersResponse>())
|
||||
@@ -0,0 +1,259 @@
|
||||
import type { CommonResponse } from '@/models/common'
|
||||
import { type } from '@orpc/contract'
|
||||
import { base } from '../base'
|
||||
|
||||
export type UserProfile = {
|
||||
id: string
|
||||
name: string
|
||||
email: string
|
||||
avatar_url?: string
|
||||
}
|
||||
|
||||
export type WorkflowCommentList = {
|
||||
id: string
|
||||
position_x: number
|
||||
position_y: number
|
||||
content: string
|
||||
created_by: string
|
||||
created_by_account: UserProfile
|
||||
created_at: number
|
||||
updated_at: number
|
||||
resolved: boolean
|
||||
resolved_by?: string
|
||||
resolved_by_account?: UserProfile
|
||||
resolved_at?: number
|
||||
mention_count: number
|
||||
reply_count: number
|
||||
participants: UserProfile[]
|
||||
}
|
||||
|
||||
export type WorkflowCommentDetailMention = {
|
||||
mentioned_user_id: string
|
||||
mentioned_user_account?: UserProfile | null
|
||||
reply_id: string | null
|
||||
}
|
||||
|
||||
export type WorkflowCommentDetailReply = {
|
||||
id: string
|
||||
content: string
|
||||
created_by: string
|
||||
created_by_account?: UserProfile | null
|
||||
created_at: number
|
||||
}
|
||||
|
||||
export type WorkflowCommentDetail = {
|
||||
id: string
|
||||
position_x: number
|
||||
position_y: number
|
||||
content: string
|
||||
created_by: string
|
||||
created_by_account: UserProfile
|
||||
created_at: number
|
||||
updated_at: number
|
||||
resolved: boolean
|
||||
resolved_by?: string
|
||||
resolved_by_account?: UserProfile
|
||||
resolved_at?: number
|
||||
replies: WorkflowCommentDetailReply[]
|
||||
mentions: WorkflowCommentDetailMention[]
|
||||
}
|
||||
|
||||
export type WorkflowCommentCreateRes = {
|
||||
id: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export type WorkflowCommentUpdateRes = {
|
||||
id: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export type WorkflowCommentResolveRes = {
|
||||
id: string
|
||||
resolved: boolean
|
||||
resolved_by: string
|
||||
resolved_at: number
|
||||
}
|
||||
|
||||
export type WorkflowCommentReply = {
|
||||
id: string
|
||||
comment_id: string
|
||||
content: string
|
||||
created_by: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
mentioned_user_ids: string[]
|
||||
author: {
|
||||
id: string
|
||||
name: string
|
||||
email: string
|
||||
avatar?: string
|
||||
}
|
||||
}
|
||||
|
||||
export type CreateCommentParams = {
|
||||
position_x: number
|
||||
position_y: number
|
||||
content: string
|
||||
mentioned_user_ids?: string[]
|
||||
}
|
||||
|
||||
export type UpdateCommentParams = {
|
||||
content: string
|
||||
position_x?: number
|
||||
position_y?: number
|
||||
mentioned_user_ids?: string[]
|
||||
}
|
||||
|
||||
export type CreateReplyParams = {
|
||||
content: string
|
||||
mentioned_user_ids?: string[]
|
||||
}
|
||||
|
||||
export const workflowCommentListContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ data: WorkflowCommentList[] }>())
|
||||
|
||||
export const workflowCommentCreateContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
body: CreateCommentParams
|
||||
}>())
|
||||
.output(type<WorkflowCommentCreateRes>())
|
||||
|
||||
export const workflowCommentDetailContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<WorkflowCommentDetail>())
|
||||
|
||||
export const workflowCommentUpdateContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}',
|
||||
method: 'PUT',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
}
|
||||
body: UpdateCommentParams
|
||||
}>())
|
||||
.output(type<WorkflowCommentUpdateRes>())
|
||||
|
||||
export const workflowCommentDeleteContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}',
|
||||
method: 'DELETE',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<CommonResponse>())
|
||||
|
||||
export const workflowCommentResolveContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}/resolve',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<WorkflowCommentResolveRes>())
|
||||
|
||||
export const workflowCommentReplyCreateContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}/replies',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
}
|
||||
body: CreateReplyParams
|
||||
}>())
|
||||
.output(type<WorkflowCommentReply>())
|
||||
|
||||
export const workflowCommentReplyUpdateContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}/replies/{replyId}',
|
||||
method: 'PUT',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
replyId: string
|
||||
}
|
||||
body: CreateReplyParams
|
||||
}>())
|
||||
.output(type<WorkflowCommentReply>())
|
||||
|
||||
export const workflowCommentReplyDeleteContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/{commentId}/replies/{replyId}',
|
||||
method: 'DELETE',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
commentId: string
|
||||
replyId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<CommonResponse>())
|
||||
|
||||
export const workflowCommentMentionUsersContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflow/comments/mention-users',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ users: UserProfile[] }>())
|
||||
|
||||
export const workflowCommentContracts = {
|
||||
list: workflowCommentListContract,
|
||||
create: workflowCommentCreateContract,
|
||||
detail: workflowCommentDetailContract,
|
||||
update: workflowCommentUpdateContract,
|
||||
delete: workflowCommentDeleteContract,
|
||||
resolve: workflowCommentResolveContract,
|
||||
mentionUsers: workflowCommentMentionUsersContract,
|
||||
replies: {
|
||||
create: workflowCommentReplyCreateContract,
|
||||
update: workflowCommentReplyUpdateContract,
|
||||
delete: workflowCommentReplyDeleteContract,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import type {
|
||||
FileUpload,
|
||||
RetrieverResource,
|
||||
SensitiveWordAvoidance,
|
||||
SpeechToText,
|
||||
SuggestedQuestionsAfterAnswer,
|
||||
TextToSpeech,
|
||||
} from '@/app/components/base/features/types'
|
||||
import type { ConversationVariable, EnvironmentVariable } from '@/app/components/workflow/types'
|
||||
import type { CommonResponse } from '@/models/common'
|
||||
import { type } from '@orpc/contract'
|
||||
import { base } from '../base'
|
||||
|
||||
export type WorkflowDraftFeaturesPayload = {
|
||||
opening_statement: string
|
||||
suggested_questions: string[]
|
||||
suggested_questions_after_answer?: SuggestedQuestionsAfterAnswer
|
||||
text_to_speech?: TextToSpeech
|
||||
speech_to_text?: SpeechToText
|
||||
retriever_resource?: RetrieverResource
|
||||
sensitive_word_avoidance?: SensitiveWordAvoidance
|
||||
file_upload?: FileUpload
|
||||
}
|
||||
|
||||
export const workflowDraftEnvironmentVariablesContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflows/draft/environment-variables',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ items: EnvironmentVariable[] }>())
|
||||
|
||||
export const workflowDraftUpdateEnvironmentVariablesContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflows/draft/environment-variables',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
body: {
|
||||
environment_variables: EnvironmentVariable[]
|
||||
}
|
||||
}>())
|
||||
.output(type<CommonResponse>())
|
||||
|
||||
export const workflowDraftUpdateConversationVariablesContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflows/draft/conversation-variables',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
body: {
|
||||
conversation_variables: ConversationVariable[]
|
||||
}
|
||||
}>())
|
||||
.output(type<CommonResponse>())
|
||||
|
||||
export const workflowDraftUpdateFeaturesContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/workflows/draft/features',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
body: {
|
||||
features: WorkflowDraftFeaturesPayload
|
||||
}
|
||||
}>())
|
||||
.output(type<CommonResponse>())
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { InferContractRouterInputs } from '@orpc/contract'
|
||||
import { accountAvatarContract } from './console/account'
|
||||
import {
|
||||
batchUploadContract,
|
||||
createFolderContract,
|
||||
@@ -13,6 +14,7 @@ import {
|
||||
treeContract,
|
||||
updateFileContentContract,
|
||||
} from './console/app-asset'
|
||||
import { workflowOnlineUsersContract } from './console/apps'
|
||||
import { bindPartnerStackContract, invoicesContract } from './console/billing'
|
||||
import {
|
||||
activateSandboxProviderContract,
|
||||
@@ -22,6 +24,13 @@ import {
|
||||
} from './console/sandbox-provider'
|
||||
import { systemFeaturesContract } from './console/system'
|
||||
import { trialAppDatasetsContract, trialAppInfoContract, trialAppParametersContract, trialAppWorkflowsContract } from './console/try-app'
|
||||
import {
|
||||
workflowDraftEnvironmentVariablesContract,
|
||||
workflowDraftUpdateConversationVariablesContract,
|
||||
workflowDraftUpdateEnvironmentVariablesContract,
|
||||
workflowDraftUpdateFeaturesContract,
|
||||
} from './console/workflow'
|
||||
import { workflowCommentContracts } from './console/workflow-comment'
|
||||
import { collectionPluginsContract, collectionsContract, searchAdvancedContract } from './marketplace'
|
||||
|
||||
export const marketplaceRouterContract = {
|
||||
@@ -33,6 +42,9 @@ export const marketplaceRouterContract = {
|
||||
export type MarketPlaceInputs = InferContractRouterInputs<typeof marketplaceRouterContract>
|
||||
|
||||
export const consoleRouterContract = {
|
||||
account: {
|
||||
avatar: accountAvatarContract,
|
||||
},
|
||||
systemFeatures: systemFeaturesContract,
|
||||
trialApps: {
|
||||
info: trialAppInfoContract,
|
||||
@@ -64,6 +76,16 @@ export const consoleRouterContract = {
|
||||
getFileUploadUrl: getFileUploadUrlContract,
|
||||
batchUpload: batchUploadContract,
|
||||
},
|
||||
apps: {
|
||||
workflowOnlineUsers: workflowOnlineUsersContract,
|
||||
},
|
||||
workflowDraft: {
|
||||
environmentVariables: workflowDraftEnvironmentVariablesContract,
|
||||
updateEnvironmentVariables: workflowDraftUpdateEnvironmentVariablesContract,
|
||||
updateConversationVariables: workflowDraftUpdateConversationVariablesContract,
|
||||
updateFeatures: workflowDraftUpdateFeaturesContract,
|
||||
},
|
||||
workflowComments: workflowCommentContracts,
|
||||
}
|
||||
|
||||
export type ConsoleInputs = InferContractRouterInputs<typeof consoleRouterContract>
|
||||
|
||||
Reference in New Issue
Block a user