app.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import type { LangFuseConfig, LangSmithConfig, TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
  2. import type { App, AppTemplate, SiteConfig } from '@/types/app'
  3. /* export type App = {
  4. id: string
  5. name: string
  6. decription: 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 AppTemplatesResponse = {
  64. data: AppTemplate[]
  65. }
  66. export type CreateAppResponse = App
  67. export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
  68. export type AppDailyConversationsResponse = {
  69. data: Array<{ date: string; conversation_count: number }>
  70. }
  71. export type WorkflowDailyConversationsResponse = {
  72. data: Array<{ date: string; runs: number }>
  73. }
  74. export type AppStatisticsResponse = {
  75. data: Array<{ date: string }>
  76. }
  77. export type AppDailyEndUsersResponse = {
  78. data: Array<{ date: string; terminal_count: number }>
  79. }
  80. export type AppTokenCostsResponse = {
  81. data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
  82. }
  83. export type UpdateAppModelConfigResponse = { result: string }
  84. export type ApikeyItemResponse = {
  85. id: string
  86. token: string
  87. last_used_at: string
  88. created_at: string
  89. }
  90. export type ApikeysListResponse = {
  91. data: ApikeyItemResponse[]
  92. }
  93. export type CreateApiKeyResponse = {
  94. id: string
  95. token: string
  96. created_at: string
  97. }
  98. export type ValidateOpenAIKeyResponse = {
  99. result: string
  100. error?: string
  101. }
  102. export type UpdateOpenAIKeyResponse = ValidateOpenAIKeyResponse
  103. export type GenerationIntroductionResponse = {
  104. introduction: string
  105. }
  106. export type AppVoicesListResponse = [{
  107. name: string
  108. value: string
  109. }]
  110. export type TracingStatus = {
  111. enabled: boolean
  112. tracing_provider: TracingProvider | null
  113. }
  114. export type TracingConfig = {
  115. tracing_provider: TracingProvider
  116. tracing_config: LangSmithConfig | LangFuseConfig
  117. }