config.ts 791 B

123456789101112131415161718192021222324252627282930313233
  1. import Curd from '@/api/curd'
  2. import type { ChatComplicationMessage } from '@/api/openai'
  3. import http from '@/lib/http'
  4. export interface Config {
  5. name: string
  6. content: string
  7. chatgpt_messages: ChatComplicationMessage[]
  8. filepath: string
  9. modified_at: string
  10. }
  11. class ConfigCurd extends Curd<Config> {
  12. constructor() {
  13. super('/config')
  14. }
  15. get_base_path() {
  16. return http.get('/config_base_path')
  17. }
  18. mkdir(basePath: string, name: string) {
  19. return http.post('/config_mkdir', { base_path: basePath, folder_name: name })
  20. }
  21. rename(basePath: string, origName: string, newName: string) {
  22. return http.post('/config_rename', { base_path: basePath, orig_name: origName, new_name: newName })
  23. }
  24. }
  25. const config: ConfigCurd = new ConfigCurd()
  26. export default config