thread-relation.ts 923 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import type { HasObjectId, IUser, Ref } from '@growi/core';
  2. import type { PaginateResult } from 'mongoose';
  3. import type { AiAssistant, AiAssistantHasId } from './ai-assistant';
  4. export const ThreadType = {
  5. KNOWLEDGE: 'knowledge',
  6. EDITOR: 'editor',
  7. } as const;
  8. export type ThreadType = (typeof ThreadType)[keyof typeof ThreadType];
  9. export interface IThreadRelation {
  10. userId: Ref<IUser>;
  11. aiAssistant?: Ref<AiAssistant>;
  12. threadId: string;
  13. title?: string;
  14. type: ThreadType;
  15. expiredAt: Date;
  16. isActive: boolean;
  17. }
  18. export type IThreadRelationHasId = IThreadRelation & HasObjectId;
  19. export type IThreadRelationPopulated = Omit<
  20. IThreadRelationHasId,
  21. 'aiAssistant'
  22. > & { aiAssistant: AiAssistantHasId };
  23. export type IThreadRelationPaginate = {
  24. paginateResult: PaginateResult<IThreadRelationPopulated>;
  25. };
  26. export type IApiv3DeleteThreadParams = {
  27. aiAssistantId: string;
  28. threadRelationId: string;
  29. };