Core AI
    正在准备搜索索引...
    索引

    方法

    • 新建对话

      • applicationId 必传,因为对话总是归属于某个应用程序。
      • title 是可选的。如果不传,则服务端会暂时将其置空,待产生第一条消息时,会自动生成一条短标题。

      参数

      • body: { applicationId: string; title?: null | string }

      返回 Promise<
          {
              data: {
                  applicationId: string;
                  createdAt: string;
                  id: string;
                  participants: {
                      banExpires: null
                      | string;
                      banned: null | boolean;
                      banReason: null | string;
                      createdAt: string;
                      email: string;
                      emailVerified: boolean;
                      id: string;
                      image: null | string;
                      name: string;
                      role: null | string;
                      updatedAt: string;
                  }[];
                  title: null
                  | string;
                  updatedAt: string;
              };
          },
      >

      创建一个新的对话

      await = client.thread.create({ applicationId: "an application id" })
      
    • 删除指定对话

      参数

      • id: string

      返回 Promise<{ data: { id: string } }>

    • 获取指定对话的详情

      参数

      • threadId: string

      返回 Promise<
          {
              data: {
                  applicationId: string;
                  createdAt: string;
                  id: string;
                  participants: {
                      banExpires: null
                      | string;
                      banned: null | boolean;
                      banReason: null | string;
                      createdAt: string;
                      email: string;
                      emailVerified: boolean;
                      id: string;
                      image: null | string;
                      name: string;
                      role: null | string;
                      updatedAt: string;
                  }[];
                  title: null
                  | string;
                  updatedAt: string;
              };
          },
      >

    • 列出当前应用程序下的所有对话(以最近更新顺序)

      参数

      • applicationId: string

      返回 Promise<
          {
              data: {
                  applicationId: string;
                  createdAt: string;
                  id: string;
                  title: null
                  | string;
                  updatedAt: string;
              }[];
          },
      >

    • 更新指定对话

      参数

      • id: string
      • body: { title: null | string }

      返回 Promise<
          {
              data: {
                  applicationId: string;
                  createdAt: string;
                  id: string;
                  participants: {
                      banExpires: null
                      | string;
                      banned: null | boolean;
                      banReason: null | string;
                      createdAt: string;
                      email: string;
                      emailVerified: boolean;
                      id: string;
                      image: null | string;
                      name: string;
                      role: null | string;
                      updatedAt: string;
                  }[];
                  title: null
                  | string;
                  updatedAt: string;
              };
          },
      >

      const { data: updatedThread } = await client.thread.update({
      id,
      title: "Updated Title",
      })