app.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import type { App, AppTemplate, SiteConfig } from '@/types/app'
  2. /* export type App = {
  3. id: string
  4. name: string
  5. decription: string
  6. mode: AppMode
  7. enable_site: boolean
  8. enable_api: boolean
  9. api_rpm: number
  10. api_rph: number
  11. is_demo: boolean
  12. model_config: AppModelConfig
  13. providers: Array<{ provider: string; token_is_set: boolean }>
  14. site: SiteConfig
  15. created_at: string
  16. }
  17. export type AppModelConfig = {
  18. provider: string
  19. model_id: string
  20. configs: {
  21. prompt_template: string
  22. prompt_variables: Array<PromptVariable>
  23. completion_params: CompletionParam
  24. }
  25. }
  26. export type PromptVariable = {
  27. key: string
  28. name: string
  29. description: string
  30. type: string | number
  31. default: string
  32. options: string[]
  33. }
  34. export type CompletionParam = {
  35. max_tokens: number
  36. temperature: number
  37. top_p: number
  38. echo: boolean
  39. stop: string[]
  40. presence_penalty: number
  41. frequency_penalty: number
  42. }
  43. export type SiteConfig = {
  44. access_token: string
  45. title: string
  46. author: string
  47. support_email: string
  48. default_language: string
  49. customize_domain: string
  50. theme: string
  51. customize_token_strategy: 'must' | 'allow' | 'not_allow'
  52. prompt_public: boolean
  53. } */
  54. export type AppListResponse = {
  55. data: App[]
  56. has_more: boolean
  57. limit: number
  58. page: number
  59. total: number
  60. }
  61. export type AppDetailResponse = App
  62. export type AppTemplatesResponse = {
  63. data: AppTemplate[]
  64. }
  65. export type CreateAppResponse = App
  66. export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
  67. export type AppDailyConversationsResponse = {
  68. data: Array<{ date: string; conversation_count: number }>
  69. }
  70. export type WorkflowDailyConversationsResponse = {
  71. data: Array<{ date: string; runs: number }>
  72. }
  73. export type AppStatisticsResponse = {
  74. data: Array<{ date: string }>
  75. }
  76. export type AppDailyEndUsersResponse = {
  77. data: Array<{ date: string; terminal_count: number }>
  78. }
  79. export type AppTokenCostsResponse = {
  80. data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
  81. }
  82. export type UpdateAppModelConfigResponse = { result: string }
  83. export type ApikeyItemResponse = {
  84. id: string
  85. token: string
  86. last_used_at: string
  87. created_at: string
  88. }
  89. export type ApikeysListResponse = {
  90. data: ApikeyItemResponse[]
  91. }
  92. export type CreateApiKeyResponse = {
  93. id: string
  94. token: string
  95. created_at: string
  96. }
  97. export type ValidateOpenAIKeyResponse = {
  98. result: string
  99. error?: string
  100. }
  101. export type UpdateOpenAIKeyResponse = ValidateOpenAIKeyResponse
  102. export type GenerationIntroductionResponse = {
  103. introduction: string
  104. }
  105. export type AppVoicesListResponse = [{
  106. name: string
  107. value: string
  108. }]