app.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import type { App, AppTemplate, SiteConfig } from '@/types/app'
  2. export type AppMode = 'chat' | 'completion'
  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 UpdateAppNameResponse = App
  68. export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
  69. export type AppDailyConversationsResponse = {
  70. data: Array<{ date: string; conversation_count: number }>
  71. }
  72. export type AppStatisticsResponse = {
  73. data: Array<{ date: string }>
  74. }
  75. export type AppDailyEndUsersResponse = {
  76. data: Array<{ date: string; terminal_count: number }>
  77. }
  78. export type AppTokenCostsResponse = {
  79. data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
  80. }
  81. export type UpdateAppModelConfigResponse = { result: string }
  82. export type ApikeyItemResponse = {
  83. id: string
  84. token: string
  85. last_used_at: string
  86. created_at: string
  87. }
  88. export type ApikeysListResponse = {
  89. data: ApikeyItemResponse[]
  90. }
  91. export type CreateApiKeyResponse = {
  92. id: string
  93. token: string
  94. created_at: string
  95. }
  96. export type ValidateOpenAIKeyResponse = {
  97. result: string
  98. error?: string
  99. }
  100. export type UpdateOpenAIKeyResponse = ValidateOpenAIKeyResponse
  101. export type GenerationIntroductionResponse = {
  102. introduction: string
  103. }