Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. import type { I18nText } from '@/i18n/language'
  2. import type { Model } from '@/types/app'
  3. export type CommonResponse = {
  4. result: 'success' | 'fail'
  5. }
  6. export type OauthResponse = {
  7. redirect_url: string
  8. }
  9. export type SetupStatusResponse = {
  10. step: 'finished' | 'not_started'
  11. setup_at?: Date
  12. }
  13. export type InitValidateStatusResponse = {
  14. status: 'finished' | 'not_started'
  15. }
  16. export type UserProfileResponse = {
  17. id: string
  18. name: string
  19. email: string
  20. avatar: string
  21. avatar_url: string | null
  22. is_password_set: boolean
  23. interface_language?: string
  24. interface_theme?: string
  25. timezone?: string
  26. last_login_at?: string
  27. last_active_at?: string
  28. last_login_ip?: string
  29. created_at?: string
  30. }
  31. export type UserProfileOriginResponse = {
  32. json: () => Promise<UserProfileResponse>
  33. bodyUsed: boolean
  34. headers: any
  35. }
  36. export type LangGeniusVersionResponse = {
  37. current_version: string
  38. latest_version: string
  39. version: string
  40. release_date: string
  41. release_notes: string
  42. can_auto_update: boolean
  43. current_env: string
  44. }
  45. export type TenantInfoResponse = {
  46. name: string
  47. created_at: string
  48. providers: Array<{
  49. provider: string
  50. provider_name: string
  51. token_is_set: boolean
  52. is_valid: boolean
  53. token_is_valid: boolean
  54. }>
  55. in_trail: boolean
  56. trial_end_reason: null | 'trial_exceeded' | 'using_custom'
  57. }
  58. export type Member = Pick<UserProfileResponse, 'id' | 'name' | 'email' | 'last_login_at' | 'last_active_at' | 'created_at' | 'avatar_url'> & {
  59. avatar: string
  60. status: 'pending' | 'active' | 'banned' | 'closed'
  61. role: 'owner' | 'admin' | 'editor' | 'normal' | 'dataset_operator'
  62. }
  63. export enum ProviderName {
  64. OPENAI = 'openai',
  65. AZURE_OPENAI = 'azure_openai',
  66. ANTHROPIC = 'anthropic',
  67. Replicate = 'replicate',
  68. HuggingfaceHub = 'huggingface_hub',
  69. MiniMax = 'minimax',
  70. Spark = 'spark',
  71. Tongyi = 'tongyi',
  72. ChatGLM = 'chatglm',
  73. }
  74. export type ProviderAzureToken = {
  75. openai_api_base?: string
  76. openai_api_key?: string
  77. }
  78. export type ProviderAnthropicToken = {
  79. anthropic_api_key?: string
  80. }
  81. export type ProviderTokenType = {
  82. [ProviderName.OPENAI]: string
  83. [ProviderName.AZURE_OPENAI]: ProviderAzureToken
  84. [ProviderName.ANTHROPIC]: ProviderAnthropicToken
  85. }
  86. export type Provider = {
  87. [Name in ProviderName]: {
  88. provider_name: Name
  89. } & {
  90. provider_type: 'custom' | 'system'
  91. is_valid: boolean
  92. is_enabled: boolean
  93. last_used: string
  94. token?: string | ProviderAzureToken | ProviderAnthropicToken
  95. }
  96. }[ProviderName]
  97. export type ProviderHosted = Provider & {
  98. quota_type: string
  99. quota_limit: number
  100. quota_used: number
  101. }
  102. export type AccountIntegrate = {
  103. provider: 'google' | 'github'
  104. created_at: number
  105. is_bound: boolean
  106. link: string
  107. }
  108. export type IWorkspace = {
  109. id: string
  110. name: string
  111. plan: string
  112. status: string
  113. created_at: number
  114. current: boolean
  115. }
  116. export type ICurrentWorkspace = Omit<IWorkspace, 'current'> & {
  117. role: 'owner' | 'admin' | 'editor' | 'dataset_operator' | 'normal'
  118. providers: Provider[]
  119. trial_end_reason?: string
  120. custom_config?: {
  121. remove_webapp_brand?: boolean
  122. replace_webapp_logo?: string
  123. }
  124. }
  125. export type DataSourceNotionPage = {
  126. page_icon: null | {
  127. type: string | null
  128. url: string | null
  129. emoji: string | null
  130. }
  131. page_id: string
  132. page_name: string
  133. parent_id: string
  134. type: string
  135. is_bound: boolean
  136. }
  137. export type NotionPage = DataSourceNotionPage & {
  138. workspace_id: string
  139. }
  140. export type DataSourceNotionPageMap = Record<string, DataSourceNotionPage & { workspace_id: string }>
  141. export type DataSourceNotionWorkspace = {
  142. workspace_name: string
  143. workspace_id: string
  144. workspace_icon: string | null
  145. total?: number
  146. pages: DataSourceNotionPage[]
  147. }
  148. export type DataSourceNotionWorkspaceMap = Record<string, DataSourceNotionWorkspace>
  149. export type DataSourceNotion = {
  150. id: string
  151. provider: string
  152. is_bound: boolean
  153. source_info: DataSourceNotionWorkspace
  154. }
  155. export enum DataSourceCategory {
  156. website = 'website',
  157. }
  158. export enum DataSourceProvider {
  159. fireCrawl = 'firecrawl',
  160. jinaReader = 'jinareader',
  161. waterCrawl = 'watercrawl',
  162. }
  163. export type FirecrawlConfig = {
  164. api_key: string
  165. base_url: string
  166. }
  167. export type WatercrawlConfig = {
  168. api_key: string
  169. base_url: string
  170. }
  171. export type DataSourceItem = {
  172. id: string
  173. category: DataSourceCategory
  174. provider: DataSourceProvider
  175. disabled: boolean
  176. created_at: number
  177. updated_at: number
  178. }
  179. export type DataSources = {
  180. sources: DataSourceItem[]
  181. }
  182. export type GithubRepo = {
  183. stargazers_count: number
  184. }
  185. export type PluginProvider = {
  186. tool_name: string
  187. is_enabled: boolean
  188. credentials: {
  189. api_key: string
  190. } | null
  191. }
  192. export type FileUploadConfigResponse = {
  193. batch_count_limit: number
  194. image_file_size_limit?: number | string // default is 10MB
  195. file_size_limit: number // default is 15MB
  196. audio_file_size_limit?: number // default is 50MB
  197. video_file_size_limit?: number // default is 100MB
  198. workflow_file_upload_limit?: number // default is 10
  199. }
  200. export type InvitationResult = {
  201. status: 'success'
  202. email: string
  203. url: string
  204. } | {
  205. status: 'failed'
  206. email: string
  207. message: string
  208. }
  209. export type InvitationResponse = CommonResponse & {
  210. invitation_results: InvitationResult[]
  211. }
  212. export type ApiBasedExtension = {
  213. id?: string
  214. name?: string
  215. api_endpoint?: string
  216. api_key?: string
  217. }
  218. export type CodeBasedExtensionForm = {
  219. type: string
  220. label: I18nText
  221. variable: string
  222. required: boolean
  223. options: { label: I18nText; value: string }[]
  224. default: string
  225. placeholder: string
  226. max_length?: number
  227. }
  228. export type CodeBasedExtensionItem = {
  229. name: string
  230. label: any
  231. form_schema: CodeBasedExtensionForm[]
  232. }
  233. export type CodeBasedExtension = {
  234. module: string
  235. data: CodeBasedExtensionItem[]
  236. }
  237. export type ExternalDataTool = {
  238. type?: string
  239. label?: string
  240. icon?: string
  241. icon_background?: string
  242. variable?: string
  243. enabled?: boolean
  244. config?: {
  245. api_based_extension_id?: string
  246. } & Partial<Record<string, any>>
  247. }
  248. export type ModerateResponse = {
  249. flagged: boolean
  250. text: string
  251. }
  252. export type ModerationService = (
  253. url: string,
  254. body: {
  255. app_id: string
  256. text: string
  257. }
  258. ) => Promise<ModerateResponse>
  259. export type StructuredOutputRulesRequestBody = {
  260. instruction: string
  261. model_config: Model
  262. }
  263. export type StructuredOutputRulesResponse = {
  264. output: string
  265. error?: string
  266. }