app.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. import type { LangFuseConfig, LangSmithConfig, OpikConfig, TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
  2. import type { App, AppSSO, AppTemplate, SiteConfig } from '@/types/app'
  3. import type { Dependency } from '@/app/components/plugins/types'
  4. /* export type App = {
  5. id: string
  6. name: string
  7. description: string
  8. mode: AppMode
  9. enable_site: boolean
  10. enable_api: boolean
  11. api_rpm: number
  12. api_rph: number
  13. is_demo: boolean
  14. model_config: AppModelConfig
  15. providers: Array<{ provider: string; token_is_set: boolean }>
  16. site: SiteConfig
  17. created_at: string
  18. }
  19. export type AppModelConfig = {
  20. provider: string
  21. model_id: string
  22. configs: {
  23. prompt_template: string
  24. prompt_variables: Array<PromptVariable>
  25. completion_params: CompletionParam
  26. }
  27. }
  28. export type PromptVariable = {
  29. key: string
  30. name: string
  31. description: string
  32. type: string | number
  33. default: string
  34. options: string[]
  35. }
  36. export type CompletionParam = {
  37. max_tokens: number
  38. temperature: number
  39. top_p: number
  40. echo: boolean
  41. stop: string[]
  42. presence_penalty: number
  43. frequency_penalty: number
  44. }
  45. export type SiteConfig = {
  46. access_token: string
  47. title: string
  48. author: string
  49. support_email: string
  50. default_language: string
  51. customize_domain: string
  52. theme: string
  53. customize_token_strategy: 'must' | 'allow' | 'not_allow'
  54. prompt_public: boolean
  55. } */
  56. export enum DSLImportMode {
  57. YAML_CONTENT = 'yaml-content',
  58. YAML_URL = 'yaml-url',
  59. }
  60. export enum DSLImportStatus {
  61. COMPLETED = 'completed',
  62. COMPLETED_WITH_WARNINGS = 'completed-with-warnings',
  63. PENDING = 'pending',
  64. FAILED = 'failed',
  65. }
  66. export type AppListResponse = {
  67. data: App[]
  68. has_more: boolean
  69. limit: number
  70. page: number
  71. total: number
  72. }
  73. export type AppDetailResponse = App
  74. export type DSLImportResponse = {
  75. id: string
  76. status: DSLImportStatus
  77. app_id?: string
  78. current_dsl_version?: string
  79. imported_dsl_version?: string
  80. error: string
  81. leaked_dependencies: Dependency[]
  82. }
  83. export type AppSSOResponse = { enabled: AppSSO['enable_sso'] }
  84. export type AppTemplatesResponse = {
  85. data: AppTemplate[]
  86. }
  87. export type CreateAppResponse = App
  88. export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
  89. export type AppDailyMessagesResponse = {
  90. data: Array<{ date: string; message_count: number }>
  91. }
  92. export type AppDailyConversationsResponse = {
  93. data: Array<{ date: string; conversation_count: number }>
  94. }
  95. export type WorkflowDailyConversationsResponse = {
  96. data: Array<{ date: string; runs: number }>
  97. }
  98. export type AppStatisticsResponse = {
  99. data: Array<{ date: string }>
  100. }
  101. export type AppDailyEndUsersResponse = {
  102. data: Array<{ date: string; terminal_count: number }>
  103. }
  104. export type AppTokenCostsResponse = {
  105. data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
  106. }
  107. export type UpdateAppModelConfigResponse = { result: string }
  108. export type ApiKeyItemResponse = {
  109. id: string
  110. token: string
  111. last_used_at: string
  112. created_at: string
  113. }
  114. export type ApiKeysListResponse = {
  115. data: ApiKeyItemResponse[]
  116. }
  117. export type CreateApiKeyResponse = {
  118. id: string
  119. token: string
  120. created_at: string
  121. }
  122. export type ValidateOpenAIKeyResponse = {
  123. result: string
  124. error?: string
  125. }
  126. export type UpdateOpenAIKeyResponse = ValidateOpenAIKeyResponse
  127. export type GenerationIntroductionResponse = {
  128. introduction: string
  129. }
  130. export type AppVoicesListResponse = [{
  131. name: string
  132. value: string
  133. }]
  134. export type TracingStatus = {
  135. enabled: boolean
  136. tracing_provider: TracingProvider | null
  137. }
  138. export type TracingConfig = {
  139. tracing_provider: TracingProvider
  140. tracing_config: LangSmithConfig | LangFuseConfig | OpikConfig
  141. }