app.ts 3.5 KB

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