app.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. import type { LangFuseConfig, LangSmithConfig, OpikConfig, TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
  2. import type { App, AppMode, 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_mode: AppMode
  78. app_id?: string
  79. current_dsl_version?: string
  80. imported_dsl_version?: string
  81. error: string
  82. leaked_dependencies: Dependency[]
  83. }
  84. export type AppSSOResponse = { enabled: AppSSO['enable_sso'] }
  85. export type AppTemplatesResponse = {
  86. data: AppTemplate[]
  87. }
  88. export type CreateAppResponse = App
  89. export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
  90. export type AppDailyMessagesResponse = {
  91. data: Array<{ date: string; message_count: number }>
  92. }
  93. export type AppDailyConversationsResponse = {
  94. data: Array<{ date: string; conversation_count: number }>
  95. }
  96. export type WorkflowDailyConversationsResponse = {
  97. data: Array<{ date: string; runs: number }>
  98. }
  99. export type AppStatisticsResponse = {
  100. data: Array<{ date: string }>
  101. }
  102. export type AppDailyEndUsersResponse = {
  103. data: Array<{ date: string; terminal_count: number }>
  104. }
  105. export type AppTokenCostsResponse = {
  106. data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
  107. }
  108. export type UpdateAppModelConfigResponse = { result: string }
  109. export type ApiKeyItemResponse = {
  110. id: string
  111. token: string
  112. last_used_at: string
  113. created_at: string
  114. }
  115. export type ApiKeysListResponse = {
  116. data: ApiKeyItemResponse[]
  117. }
  118. export type CreateApiKeyResponse = {
  119. id: string
  120. token: string
  121. created_at: string
  122. }
  123. export type ValidateOpenAIKeyResponse = {
  124. result: string
  125. error?: string
  126. }
  127. export type UpdateOpenAIKeyResponse = ValidateOpenAIKeyResponse
  128. export type GenerationIntroductionResponse = {
  129. introduction: string
  130. }
  131. export type AppVoicesListResponse = [{
  132. name: string
  133. value: string
  134. }]
  135. export type TracingStatus = {
  136. enabled: boolean
  137. tracing_provider: TracingProvider | null
  138. }
  139. export type TracingConfig = {
  140. tracing_provider: TracingProvider
  141. tracing_config: LangSmithConfig | LangFuseConfig | OpikConfig
  142. }