common.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. export type CommonResponse = {
  2. result: 'success' | 'fail'
  3. }
  4. export type OauthResponse = {
  5. redirect_url: string
  6. }
  7. export type SetupStatusResponse = {
  8. step: 'finished' | 'not_started'
  9. setup_at?: Date
  10. }
  11. export type UserProfileResponse = {
  12. id: string
  13. name: string
  14. email: string
  15. avatar: string
  16. is_password_set: boolean
  17. interface_language?: string
  18. interface_theme?: string
  19. timezone?: string
  20. last_login_at?: string
  21. last_login_ip?: string
  22. created_at?: string
  23. }
  24. export type UserProfileOriginResponse = {
  25. json: () => Promise<UserProfileResponse>
  26. bodyUsed: boolean
  27. headers: any
  28. }
  29. export type LangGeniusVersionResponse = {
  30. current_version: string
  31. latest_version: string
  32. version: string
  33. release_date: string
  34. release_notes: string
  35. can_auto_update: boolean
  36. current_env: string
  37. }
  38. export type TenantInfoResponse = {
  39. name: string
  40. created_at: string
  41. providers: Array<{
  42. provider: string
  43. provider_name: string
  44. token_is_set: boolean
  45. is_valid: boolean
  46. token_is_valid: boolean
  47. }>
  48. in_trail: boolean
  49. trial_end_reason: null | 'trial_exceeded' | 'using_custom'
  50. }
  51. export type Member = Pick<UserProfileResponse, 'id' | 'name' | 'email' | 'last_login_at' | 'created_at'> & {
  52. avatar: string
  53. status: 'pending' | 'active' | 'banned' | 'closed'
  54. role: 'owner' | 'admin' | 'normal'
  55. }
  56. export enum ProviderName {
  57. OPENAI = 'openai',
  58. AZURE_OPENAI = 'azure_openai',
  59. ANTHROPIC = 'anthropic',
  60. }
  61. export type ProviderAzureToken = {
  62. openai_api_base?: string
  63. openai_api_key?: string
  64. }
  65. export type ProviderAnthropicToken = {
  66. anthropic_api_key?: string
  67. }
  68. export type ProviderTokenType = {
  69. [ProviderName.OPENAI]: string
  70. [ProviderName.AZURE_OPENAI]: ProviderAzureToken
  71. [ProviderName.ANTHROPIC]: ProviderAnthropicToken
  72. }
  73. export type Provider = {
  74. [Name in ProviderName]: {
  75. provider_name: Name
  76. } & {
  77. provider_type: 'custom' | 'system'
  78. is_valid: boolean
  79. is_enabled: boolean
  80. last_used: string
  81. token?: ProviderTokenType[Name]
  82. }
  83. }[ProviderName]
  84. export type ProviderHosted = Provider & {
  85. quota_type: string
  86. quota_limit: number
  87. quota_used: number
  88. }
  89. export type AccountIntegrate = {
  90. provider: 'google' | 'github'
  91. created_at: number
  92. is_bound: boolean
  93. link: string
  94. }
  95. export type IWorkspace = {
  96. id: string
  97. name: string
  98. plan: string
  99. status: string
  100. created_at: number
  101. current: boolean
  102. }
  103. export type DataSourceNotionPage = {
  104. page_icon: null | {
  105. type: string | null
  106. url: string | null
  107. emoji: string | null
  108. }
  109. page_id: string
  110. page_name: string
  111. parent_id: string
  112. type: string
  113. is_bound: boolean
  114. }
  115. export type DataSourceNotionPageMap = Record<string, DataSourceNotionPage & { workspace_id: string }>
  116. export type DataSourceNotionWorkspace = {
  117. workspace_name: string
  118. workspace_id: string
  119. workspace_icon: string | null
  120. total?: number
  121. pages: DataSourceNotionPage[]
  122. }
  123. export type DataSourceNotionWorkspaceMap = Record<string, DataSourceNotionWorkspace>
  124. export type DataSourceNotion = {
  125. id: string
  126. provider: string
  127. is_bound: boolean
  128. source_info: DataSourceNotionWorkspace
  129. }
  130. export type GithubRepo = {
  131. stargazers_count: number
  132. }
  133. export type PluginProvider = {
  134. tool_name: string
  135. is_enabled: boolean
  136. credentials: {
  137. api_key: string
  138. } | null
  139. }