ai.ts 1.9 KB

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