app.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 type AppListResponse = {
  56. data: App[]
  57. has_more: boolean
  58. limit: number
  59. page: number
  60. total: number
  61. }
  62. export type AppDetailResponse = App
  63. export type AppSSOResponse = { enabled: AppSSO['enable_sso'] }
  64. export type AppTemplatesResponse = {
  65. data: AppTemplate[]
  66. }
  67. export type CreateAppResponse = App
  68. export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
  69. export type AppDailyMessagesResponse = {
  70. data: Array<{ date: string; message_count: number }>
  71. }
  72. export type AppDailyConversationsResponse = {
  73. data: Array<{ date: string; conversation_count: number }>
  74. }
  75. export type WorkflowDailyConversationsResponse = {
  76. data: Array<{ date: string; runs: number }>
  77. }
  78. export type AppStatisticsResponse = {
  79. data: Array<{ date: string }>
  80. }
  81. export type AppDailyEndUsersResponse = {
  82. data: Array<{ date: string; terminal_count: number }>
  83. }
  84. export type AppTokenCostsResponse = {
  85. data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
  86. }
  87. export type UpdateAppModelConfigResponse = { result: string }
  88. export type ApiKeyItemResponse = {
  89. id: string
  90. token: string
  91. last_used_at: string
  92. created_at: string
  93. }
  94. export type ApiKeysListResponse = {
  95. data: ApiKeyItemResponse[]
  96. }
  97. export type CreateApiKeyResponse = {
  98. id: string
  99. token: string
  100. created_at: string
  101. }
  102. export type ValidateOpenAIKeyResponse = {
  103. result: string
  104. error?: string
  105. }
  106. export type UpdateOpenAIKeyResponse = ValidateOpenAIKeyResponse
  107. export type GenerationIntroductionResponse = {
  108. introduction: string
  109. }
  110. export type AppVoicesListResponse = [{
  111. name: string
  112. value: string
  113. }]
  114. export type TracingStatus = {
  115. enabled: boolean
  116. tracing_provider: TracingProvider | null
  117. }
  118. export type TracingConfig = {
  119. tracing_provider: TracingProvider
  120. tracing_config: LangSmithConfig | LangFuseConfig
  121. }