types.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. import type { TypeWithI18N } from '../header/account-setting/model-provider-page/declarations'
  2. export enum LOC {
  3. tools = 'tools',
  4. app = 'app',
  5. }
  6. export enum AuthType {
  7. none = 'none',
  8. apiKey = 'api_key',
  9. }
  10. export enum AuthHeaderPrefix {
  11. basic = 'basic',
  12. bearer = 'bearer',
  13. custom = 'custom',
  14. }
  15. export type Credential = {
  16. 'auth_type': AuthType
  17. 'api_key_header'?: string
  18. 'api_key_value'?: string
  19. 'api_key_header_prefix'?: AuthHeaderPrefix
  20. }
  21. export enum CollectionType {
  22. all = 'all',
  23. builtIn = 'builtin',
  24. custom = 'api',
  25. model = 'model',
  26. workflow = 'workflow',
  27. }
  28. export type Emoji = {
  29. background: string
  30. content: string
  31. }
  32. export type Collection = {
  33. id: string
  34. name: string
  35. author: string
  36. description: TypeWithI18N
  37. icon: string | Emoji
  38. label: TypeWithI18N
  39. type: CollectionType
  40. team_credentials: Record<string, any>
  41. is_team_authorization: boolean
  42. allow_delete: boolean
  43. labels: string[]
  44. }
  45. export type ToolParameter = {
  46. name: string
  47. label: TypeWithI18N
  48. human_description: TypeWithI18N
  49. type: string
  50. form: string
  51. llm_description: string
  52. required: boolean
  53. default: string
  54. options?: {
  55. label: TypeWithI18N
  56. value: string
  57. }[]
  58. min?: number
  59. max?: number
  60. }
  61. export type Tool = {
  62. name: string
  63. author: string
  64. label: TypeWithI18N
  65. description: any
  66. parameters: ToolParameter[]
  67. labels: string[]
  68. }
  69. export type ToolCredential = {
  70. name: string
  71. label: TypeWithI18N
  72. help: TypeWithI18N
  73. placeholder: TypeWithI18N
  74. type: string
  75. required: boolean
  76. default: string
  77. options?: {
  78. label: TypeWithI18N
  79. value: string
  80. }[]
  81. }
  82. export type CustomCollectionBackend = {
  83. provider: string
  84. original_provider?: string
  85. credentials: Credential
  86. icon: Emoji
  87. schema_type: string
  88. schema: string
  89. privacy_policy: string
  90. custom_disclaimer: string
  91. tools?: ParamItem[]
  92. id: string
  93. labels: string[]
  94. }
  95. export type ParamItem = {
  96. name: string
  97. label: TypeWithI18N
  98. human_description: TypeWithI18N
  99. llm_description: string
  100. type: string
  101. form: string
  102. required: boolean
  103. default: string
  104. min?: number
  105. max?: number
  106. options?: {
  107. label: TypeWithI18N
  108. value: string
  109. }[]
  110. }
  111. export type CustomParamSchema = {
  112. operation_id: string // name
  113. summary: string
  114. server_url: string
  115. method: string
  116. parameters: ParamItem[]
  117. }
  118. export type WorkflowToolProviderParameter = {
  119. name: string
  120. form: string
  121. description: string
  122. required?: boolean
  123. type?: string
  124. }
  125. export type WorkflowToolProviderRequest = {
  126. name: string
  127. icon: Emoji
  128. description: string
  129. parameters: WorkflowToolProviderParameter[]
  130. labels: string[]
  131. privacy_policy: string
  132. }
  133. export type WorkflowToolProviderResponse = {
  134. workflow_app_id: string
  135. workflow_tool_id: string
  136. label: string
  137. name: string
  138. icon: Emoji
  139. description: string
  140. synced: boolean
  141. tool: {
  142. author: string
  143. name: string
  144. label: TypeWithI18N
  145. description: TypeWithI18N
  146. labels: string[]
  147. parameters: ParamItem[]
  148. }
  149. privacy_policy: string
  150. }