ai.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import type { IStudio, IUser } from "./Auth";
  2. export type TPrivacy = "private" | "public" | "disable";
  3. export interface IKimiResponse {
  4. id: string;
  5. object: string;
  6. created: number;
  7. model: string;
  8. choices: AiChoice[];
  9. usage: AiUsage;
  10. }
  11. export interface AiUsage {
  12. prompt_tokens: number;
  13. completion_tokens: number;
  14. total_tokens: number;
  15. }
  16. export interface AiChoice {
  17. index: number;
  18. message: AiMessage;
  19. logprobs?: string | null; //volcengine
  20. finish_reason: string;
  21. }
  22. export interface AiMessage {
  23. role: string;
  24. content: string;
  25. }
  26. export interface IAiTranslateRequest {
  27. origin: string;
  28. }
  29. export interface IAiTranslateResponse {
  30. ok: boolean;
  31. message: string;
  32. data: IKimiResponse;
  33. }
  34. export interface IAiModel {
  35. uid: string;
  36. name: string;
  37. description?: string | null;
  38. url?: string | null;
  39. model?: string;
  40. key?: string;
  41. privacy: TPrivacy;
  42. owner: IStudio;
  43. editor: IUser;
  44. user: IUser;
  45. created_at: string;
  46. updated_at: string;
  47. }
  48. export interface IAiModelRequest {
  49. name: string;
  50. description?: string | null;
  51. system_prompt?: string | null;
  52. url?: string | null;
  53. model?: string;
  54. key?: string;
  55. privacy: TPrivacy;
  56. studio_name?: string;
  57. }
  58. export interface IAiModelListResponse {
  59. ok: boolean;
  60. message: string;
  61. data: { rows: IAiModel[]; total: number };
  62. }
  63. export interface IAiModelResponse {
  64. ok: boolean;
  65. message: string;
  66. data: IAiModel;
  67. }
  68. export interface IAiModelLogData {
  69. id: string;
  70. uid: string;
  71. model_id: string;
  72. request_headers: string;
  73. request_data: string;
  74. response_headers?: string | null;
  75. response_data?: string | null;
  76. status: number;
  77. success: boolean;
  78. request_at: string;
  79. created_at: string;
  80. updated_at: string;
  81. }
  82. export interface IAiModelLogListResponse {
  83. ok: boolean;
  84. message: string;
  85. data: { rows: IAiModelLogData[]; total: number };
  86. }
  87. export interface IAiModelSystem {
  88. view: string;
  89. models: string[];
  90. }