@fencyai/js 0.1.99 → 0.1.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/lib/api/createAgentTask.js +1 -1
  2. package/lib/api/getFileDownloadLink.d.ts +8 -0
  3. package/lib/api/getFileDownloadLink.js +33 -0
  4. package/lib/api/searchMemories.d.ts +8 -0
  5. package/lib/api/{createChatCompletion.js → searchMemories.js} +5 -9
  6. package/lib/index.d.ts +3 -3
  7. package/lib/index.js +2 -2
  8. package/lib/openapi/index.d.ts +3 -11
  9. package/lib/openapi/models/PubAgentTaskDto.d.ts +1 -1
  10. package/lib/openapi/models/PubGetFileDownloadLinkResponse.d.ts +3 -0
  11. package/lib/openapi/models/PubSearchMemoriesRequest.d.ts +4 -0
  12. package/lib/openapi/models/PubSearchMemoriesResponse.d.ts +4 -0
  13. package/lib/openapi/services/PubService.d.ts +12 -13
  14. package/lib/openapi/services/PubService.js +17 -13
  15. package/lib/types/AgentTask.d.ts +1 -1
  16. package/lib/types/GetFileDownloadLinkRequest.d.ts +3 -0
  17. package/lib/types/GetFileDownloadLinkResponse.d.ts +4 -0
  18. package/lib/types/SearchMemoriesRequest.d.ts +4 -0
  19. package/lib/types/{ListMemoriesResponse.d.ts → SearchMemoriesResponse.d.ts} +2 -3
  20. package/lib/types/index.d.ts +4 -2
  21. package/lib/utils/version.js +1 -1
  22. package/package.json +2 -2
  23. package/lib/api/createChatCompletion.d.ts +0 -7
  24. package/lib/api/listMemories.d.ts +0 -8
  25. package/lib/api/listMemories.js +0 -54
  26. package/lib/openapi/models/CreateClaudeChatCompletionDto.d.ts +0 -9
  27. package/lib/openapi/models/CreateClaudeChatCompletionMessageDto.d.ts +0 -4
  28. package/lib/openapi/models/CreateGeminiChatCompletionDto.d.ts +0 -10
  29. package/lib/openapi/models/CreateGeminiChatCompletionMessageDto.d.ts +0 -4
  30. package/lib/openapi/models/CreateOpenAiChatCompletionDto.d.ts +0 -8
  31. package/lib/openapi/models/CreateOpenAiChatCompletionMessageDto.d.ts +0 -4
  32. package/lib/openapi/models/ListMemoriesResponse.d.ts +0 -6
  33. package/lib/openapi/models/PubChatCompletionDto.d.ts +0 -9
  34. package/lib/openapi/models/PubChatCompletionDto.js +0 -1
  35. package/lib/openapi/models/PubCreateChatCompletionRequest.d.ts +0 -10
  36. package/lib/openapi/models/PubCreateChatCompletionRequest.js +0 -1
  37. package/lib/openapi/models/WebsiteHtmlContentReadyEventDto.d.ts +0 -8
  38. package/lib/openapi/models/WebsiteHtmlContentReadyEventDto.js +0 -1
  39. package/lib/openapi/models/WebsiteTextContentReadyEventDto.d.ts +0 -8
  40. package/lib/openapi/models/WebsiteTextContentReadyEventDto.js +0 -1
  41. package/lib/types/ListMemoriesRequest.d.ts +0 -8
  42. package/lib/types/ListMemoriesRequest.js +0 -1
  43. package/lib/types/ListMemoriesResponse.js +0 -1
  44. /package/lib/openapi/models/{CreateClaudeChatCompletionDto.js → PubGetFileDownloadLinkResponse.js} +0 -0
  45. /package/lib/openapi/models/{CreateClaudeChatCompletionMessageDto.js → PubSearchMemoriesRequest.js} +0 -0
  46. /package/lib/openapi/models/{CreateGeminiChatCompletionDto.js → PubSearchMemoriesResponse.js} +0 -0
  47. /package/lib/{openapi/models/CreateGeminiChatCompletionMessageDto.js → types/GetFileDownloadLinkRequest.js} +0 -0
  48. /package/lib/{openapi/models/CreateOpenAiChatCompletionDto.js → types/GetFileDownloadLinkResponse.js} +0 -0
  49. /package/lib/{openapi/models/CreateOpenAiChatCompletionMessageDto.js → types/SearchMemoriesRequest.js} +0 -0
  50. /package/lib/{openapi/models/ListMemoriesResponse.js → types/SearchMemoriesResponse.js} +0 -0
@@ -16,7 +16,7 @@ export async function createAgentTask(params) {
16
16
  id: response.id,
17
17
  createdAt: response.createdAt,
18
18
  status: response.status,
19
- response: response.response,
19
+ response: response.response ?? undefined,
20
20
  },
21
21
  };
22
22
  }
@@ -0,0 +1,8 @@
1
+ import { GetFileDownloadLinkRequest } from '../types/GetFileDownloadLinkRequest';
2
+ import { GetFileDownloadLinkResponse } from '../types/GetFileDownloadLinkResponse';
3
+ export declare function getFileDownloadLink(params: {
4
+ pk: string;
5
+ clientSecret: string;
6
+ request: GetFileDownloadLinkRequest;
7
+ baseUrl: string;
8
+ }): Promise<GetFileDownloadLinkResponse>;
@@ -0,0 +1,33 @@
1
+ import { getPackageVersion } from '../utils/version';
2
+ export async function getFileDownloadLink(params) {
3
+ try {
4
+ const response = await getFileDownloadLinkApi({
5
+ baseUrl: params.baseUrl,
6
+ pk: params.pk,
7
+ clientSecret: params.clientSecret,
8
+ fileId: params.request.fileId,
9
+ });
10
+ return {
11
+ type: 'success',
12
+ downloadLink: response.downloadLink,
13
+ };
14
+ }
15
+ catch (error) {
16
+ throw error;
17
+ }
18
+ }
19
+ async function getFileDownloadLinkApi(params) {
20
+ const response = await fetch(`${params.baseUrl}/v1/pub/files/${encodeURIComponent(params.fileId)}`, {
21
+ method: 'GET',
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ Authorization: `Bearer ${params.pk}`,
25
+ 'X-Fency-Sdk-Version': getPackageVersion(),
26
+ 'X-Fency-Client-Secret': params.clientSecret,
27
+ },
28
+ });
29
+ if (!response.ok) {
30
+ throw new Error(`Failed to get file download link: ${response.statusText}`);
31
+ }
32
+ return response.json();
33
+ }
@@ -0,0 +1,8 @@
1
+ import { SearchMemoriesRequest } from '../types/SearchMemoriesRequest';
2
+ import { SearchMemoriesResponse } from '../types/SearchMemoriesResponse';
3
+ export declare function searchMemories(params: {
4
+ pk: string;
5
+ clientSecret: string;
6
+ request: SearchMemoriesRequest;
7
+ baseUrl: string;
8
+ }): Promise<SearchMemoriesResponse>;
@@ -1,26 +1,22 @@
1
1
  import { OpenAPI, PubService } from '../openapi';
2
2
  import { getPackageVersion } from '../utils/version';
3
- export async function createChatCompletion(params) {
3
+ export async function searchMemories(params) {
4
4
  try {
5
5
  OpenAPI.BASE = params.baseUrl;
6
6
  OpenAPI.HEADERS = {
7
7
  'Content-Type': 'application/json',
8
8
  Authorization: `Bearer ${params.pk}`,
9
9
  'X-Fency-Sdk-Version': getPackageVersion(),
10
+ 'X-Fency-Client-Secret': params.clientSecret,
10
11
  };
11
- const response = await PubService.createChatCompletion(params.request);
12
+ const response = await PubService.searchMemories(params.request);
12
13
  return {
13
14
  type: 'success',
14
- completion: {
15
- id: response.id,
16
- createdAt: response.createdAt,
17
- streamId: response.streamId ?? undefined,
18
- response: response.response ?? undefined,
19
- responseIsStructured: response.responseIsStructured ?? undefined,
20
- },
15
+ items: response.items,
21
16
  };
22
17
  }
23
18
  catch (error) {
19
+ console.log('searchMemories error', error);
24
20
  return {
25
21
  type: 'error',
26
22
  error: {
package/lib/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export { loadFency } from './loadFency';
2
2
  export type { FencyInstance, FencyOptions } from './types';
3
3
  export * from './types/index';
4
- export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDto, FileUploadCompletedEventDto, NewChatCompletionStreamChunkEventDto, StreamNotFoundEventDto, StreamTimeoutEventDto, WebsiteHtmlContentReadyEventDto, WebsiteTextContentReadyEventDto, AgentTaskProgressItemUpdatedEventDto, PaginationDto, PubMemoryDto, PubMemoryTypeDto, } from './openapi';
4
+ export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDto, FileUploadCompletedEventDto, NewChatCompletionStreamChunkEventDto, StreamNotFoundEventDto, StreamTimeoutEventDto, AgentTaskProgressItemUpdatedEventDto, PaginationDto, PubMemoryDto, PubMemoryTypeDto, } from './openapi';
5
5
  export { AgentTaskProgressItemType } from './openapi';
6
6
  export { createAgentTask } from './api/createAgentTask';
7
- export { createChatCompletion } from './api/createChatCompletion';
8
7
  export { createStream } from './api/createStream';
9
8
  export { listMemoryTypes } from './api/listMemoryTypes';
10
- export { listMemories } from './api/listMemories';
9
+ export { searchMemories } from './api/searchMemories';
10
+ export { getFileDownloadLink } from './api/getFileDownloadLink';
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ export * from './types/index';
3
3
  export { AgentTaskProgressItemType } from './openapi';
4
4
  // api
5
5
  export { createAgentTask } from './api/createAgentTask';
6
- export { createChatCompletion } from './api/createChatCompletion';
7
6
  export { createStream } from './api/createStream';
8
7
  export { listMemoryTypes } from './api/listMemoryTypes';
9
- export { listMemories } from './api/listMemories';
8
+ export { searchMemories } from './api/searchMemories';
9
+ export { getFileDownloadLink } from './api/getFileDownloadLink';
@@ -7,29 +7,21 @@ export type { AgentTaskProgressItemUpdatedEventDto } from './models/AgentTaskPro
7
7
  export { AgentTaskStatusDto } from './models/AgentTaskStatusDto';
8
8
  export { ApiDtoType } from './models/ApiDtoType';
9
9
  export type { ChatCompletionStreamCompletedEventDto } from './models/ChatCompletionStreamCompletedEventDto';
10
- export type { CreateClaudeChatCompletionDto } from './models/CreateClaudeChatCompletionDto';
11
- export type { CreateClaudeChatCompletionMessageDto } from './models/CreateClaudeChatCompletionMessageDto';
12
- export type { CreateGeminiChatCompletionDto } from './models/CreateGeminiChatCompletionDto';
13
- export type { CreateGeminiChatCompletionMessageDto } from './models/CreateGeminiChatCompletionMessageDto';
14
- export type { CreateOpenAiChatCompletionDto } from './models/CreateOpenAiChatCompletionDto';
15
- export type { CreateOpenAiChatCompletionMessageDto } from './models/CreateOpenAiChatCompletionMessageDto';
16
10
  export type { FileSearchIndexReadyEventDto } from './models/FileSearchIndexReadyEventDto';
17
11
  export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
18
12
  export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
19
- export type { ListMemoriesResponse } from './models/ListMemoriesResponse';
20
13
  export type { ListMemoryTypesResponse } from './models/ListMemoryTypesResponse';
21
14
  export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
22
15
  export type { PaginationDto } from './models/PaginationDto';
23
16
  export type { PubAgentTaskDto } from './models/PubAgentTaskDto';
24
- export type { PubChatCompletionDto } from './models/PubChatCompletionDto';
25
17
  export type { PubCreateAgentTaskRequest } from './models/PubCreateAgentTaskRequest';
26
- export type { PubCreateChatCompletionRequest } from './models/PubCreateChatCompletionRequest';
18
+ export type { PubGetFileDownloadLinkResponse } from './models/PubGetFileDownloadLinkResponse';
27
19
  export type { PubMemoryDto } from './models/PubMemoryDto';
28
20
  export type { PubMemoryTypeDto } from './models/PubMemoryTypeDto';
21
+ export type { PubSearchMemoriesRequest } from './models/PubSearchMemoriesRequest';
22
+ export type { PubSearchMemoriesResponse } from './models/PubSearchMemoriesResponse';
29
23
  export type { StreamDto } from './models/StreamDto';
30
24
  export { StreamEventType } from './models/StreamEventType';
31
25
  export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
32
26
  export type { StreamTimeoutEventDto } from './models/StreamTimeoutEventDto';
33
- export type { WebsiteHtmlContentReadyEventDto } from './models/WebsiteHtmlContentReadyEventDto';
34
- export type { WebsiteTextContentReadyEventDto } from './models/WebsiteTextContentReadyEventDto';
35
27
  export { PubService } from './services/PubService';
@@ -3,5 +3,5 @@ export type PubAgentTaskDto = {
3
3
  id: string;
4
4
  createdAt: string;
5
5
  status: AgentTaskStatusDto;
6
- response?: Record<string, any>;
6
+ response?: string | null;
7
7
  };
@@ -0,0 +1,3 @@
1
+ export type PubGetFileDownloadLinkResponse = {
2
+ downloadLink: string;
3
+ };
@@ -0,0 +1,4 @@
1
+ export type PubSearchMemoriesRequest = {
2
+ title?: string | null;
3
+ memoryTypeId?: string | null;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { PubMemoryDto } from './PubMemoryDto';
2
+ export type PubSearchMemoriesResponse = {
3
+ items: Array<PubMemoryDto>;
4
+ };
@@ -3,18 +3,16 @@ import type { ChatCompletionStreamCompletedEventDto } from '../models/ChatComple
3
3
  import type { FileSearchIndexReadyEventDto } from '../models/FileSearchIndexReadyEventDto';
4
4
  import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
5
5
  import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
6
- import type { ListMemoriesResponse } from '../models/ListMemoriesResponse';
7
6
  import type { ListMemoryTypesResponse } from '../models/ListMemoryTypesResponse';
8
7
  import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
9
8
  import type { PubAgentTaskDto } from '../models/PubAgentTaskDto';
10
- import type { PubChatCompletionDto } from '../models/PubChatCompletionDto';
11
9
  import type { PubCreateAgentTaskRequest } from '../models/PubCreateAgentTaskRequest';
12
- import type { PubCreateChatCompletionRequest } from '../models/PubCreateChatCompletionRequest';
10
+ import type { PubGetFileDownloadLinkResponse } from '../models/PubGetFileDownloadLinkResponse';
11
+ import type { PubSearchMemoriesRequest } from '../models/PubSearchMemoriesRequest';
12
+ import type { PubSearchMemoriesResponse } from '../models/PubSearchMemoriesResponse';
13
13
  import type { StreamDto } from '../models/StreamDto';
14
14
  import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
15
15
  import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
16
- import type { WebsiteHtmlContentReadyEventDto } from '../models/WebsiteHtmlContentReadyEventDto';
17
- import type { WebsiteTextContentReadyEventDto } from '../models/WebsiteTextContentReadyEventDto';
18
16
  import type { CancelablePromise } from '../core/CancelablePromise';
19
17
  export declare class PubService {
20
18
  /**
@@ -25,21 +23,22 @@ export declare class PubService {
25
23
  */
26
24
  static createAgentTask(requestBody: PubCreateAgentTaskRequest): CancelablePromise<PubAgentTaskDto>;
27
25
  /**
28
- * Create ChatCompletion
29
- * @param requestBody
30
- * @returns PubChatCompletionDto OK
26
+ * Get File Download Link
27
+ * @param fileId
28
+ * @returns PubGetFileDownloadLinkResponse OK
31
29
  * @throws ApiError
32
30
  */
33
- static createChatCompletion(requestBody: PubCreateChatCompletionRequest): CancelablePromise<PubChatCompletionDto>;
31
+ static getFileDownloadLink(fileId: string): CancelablePromise<PubGetFileDownloadLinkResponse>;
34
32
  /**
35
- * List Memories
33
+ * Search Memories
34
+ * @param requestBody
36
35
  * @param nextPageToken
37
36
  * @param previousPageToken
38
37
  * @param limit
39
- * @returns ListMemoriesResponse OK
38
+ * @returns PubSearchMemoriesResponse OK
40
39
  * @throws ApiError
41
40
  */
42
- static listMemories(nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<ListMemoriesResponse>;
41
+ static searchMemories(requestBody: PubSearchMemoriesRequest, nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<PubSearchMemoriesResponse>;
43
42
  /**
44
43
  * List Memory Types
45
44
  * @param nextPageToken
@@ -60,5 +59,5 @@ export declare class PubService {
60
59
  * @returns any OK
61
60
  * @throws ApiError
62
61
  */
63
- static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | WebsiteHtmlContentReadyEventDto | WebsiteTextContentReadyEventDto | FileSearchIndexReadyEventDto | AgentTaskProgressItemUpdatedEventDto)>;
62
+ static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | FileSearchIndexReadyEventDto | AgentTaskProgressItemUpdatedEventDto)>;
64
63
  }
@@ -16,36 +16,40 @@ export class PubService {
16
16
  });
17
17
  }
18
18
  /**
19
- * Create ChatCompletion
20
- * @param requestBody
21
- * @returns PubChatCompletionDto OK
19
+ * Get File Download Link
20
+ * @param fileId
21
+ * @returns PubGetFileDownloadLinkResponse OK
22
22
  * @throws ApiError
23
23
  */
24
- static createChatCompletion(requestBody) {
24
+ static getFileDownloadLink(fileId) {
25
25
  return __request(OpenAPI, {
26
- method: 'POST',
27
- url: '/v1/pub/chat-completions',
28
- body: requestBody,
29
- mediaType: 'application/json',
26
+ method: 'GET',
27
+ url: '/v1/pub/files/{fileId}',
28
+ path: {
29
+ 'fileId': fileId,
30
+ },
30
31
  });
31
32
  }
32
33
  /**
33
- * List Memories
34
+ * Search Memories
35
+ * @param requestBody
34
36
  * @param nextPageToken
35
37
  * @param previousPageToken
36
38
  * @param limit
37
- * @returns ListMemoriesResponse OK
39
+ * @returns PubSearchMemoriesResponse OK
38
40
  * @throws ApiError
39
41
  */
40
- static listMemories(nextPageToken, previousPageToken, limit) {
42
+ static searchMemories(requestBody, nextPageToken, previousPageToken, limit) {
41
43
  return __request(OpenAPI, {
42
- method: 'GET',
43
- url: '/v1/pub/memories',
44
+ method: 'POST',
45
+ url: '/v1/pub/memories/search',
44
46
  query: {
45
47
  'nextPageToken': nextPageToken,
46
48
  'previousPageToken': previousPageToken,
47
49
  'limit': limit,
48
50
  },
51
+ body: requestBody,
52
+ mediaType: 'application/json',
49
53
  });
50
54
  }
51
55
  /**
@@ -2,7 +2,7 @@ import { AgentTaskStatusDto } from "../openapi";
2
2
  export type AgentTask = {
3
3
  id: string;
4
4
  status: AgentTaskStatusDto;
5
- response?: Record<string, any>;
5
+ response?: string;
6
6
  createdAt: string;
7
7
  };
8
8
  export declare const isAgentTask: (data: any) => data is AgentTask;
@@ -0,0 +1,3 @@
1
+ export interface GetFileDownloadLinkRequest {
2
+ fileId: string;
3
+ }
@@ -0,0 +1,4 @@
1
+ export interface GetFileDownloadLinkResponse {
2
+ type: 'success';
3
+ downloadLink: string;
4
+ }
@@ -0,0 +1,4 @@
1
+ export interface SearchMemoriesRequest {
2
+ memoryTypeId?: string;
3
+ title?: string;
4
+ }
@@ -1,9 +1,8 @@
1
- import { PaginationDto, PubMemoryDto } from '../openapi';
1
+ import { PubMemoryDto } from '../openapi';
2
2
  import { ApiError } from './ApiError';
3
- export type ListMemoriesResponse = {
3
+ export type SearchMemoriesResponse = {
4
4
  type: 'success';
5
5
  items: PubMemoryDto[];
6
- pagination: PaginationDto;
7
6
  } | {
8
7
  type: 'error';
9
8
  error: ApiError;
@@ -22,5 +22,7 @@ export type { ListMemoryTypesResponse } from './ListMemoryTypesResponse';
22
22
  export type { CreateChatCompletionResponse } from './CreateChatCompletionResponse';
23
23
  export type { FencyInstance } from './FencyInstance';
24
24
  export type { FencyOptions } from './FencyOptions';
25
- export type { ListMemoriesResponse } from './ListMemoriesResponse';
26
- export type { ListMemoriesRequest } from './ListMemoriesRequest';
25
+ export type { SearchMemoriesResponse } from './SearchMemoriesResponse';
26
+ export type { SearchMemoriesRequest } from './SearchMemoriesRequest';
27
+ export type { GetFileDownloadLinkRequest } from './GetFileDownloadLinkRequest';
28
+ export type { GetFileDownloadLinkResponse } from './GetFileDownloadLinkResponse';
@@ -1,7 +1,7 @@
1
1
  // Browser-compatible version utility
2
2
  // The version is set at build time and can be overridden if needed
3
3
  // Build-time version constant - this should be updated during the build process
4
- const SDK_VERSION = '0.1.97';
4
+ const SDK_VERSION = '0.1.99';
5
5
  // Allow runtime override if needed
6
6
  let versionOverride = null;
7
7
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/js",
3
- "version": "0.1.99",
3
+ "version": "0.1.101",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -42,5 +42,5 @@
42
42
  "ts-jest": "^29.1.1",
43
43
  "typescript": "^5.3.3"
44
44
  },
45
- "gitHead": "982cdf11451b24fd0b968fdc83e0f7df296d3989"
45
+ "gitHead": "96ee2d5073669fa2a1a677648b2724230547dd80"
46
46
  }
@@ -1,7 +0,0 @@
1
- import { CreateChatCompletionResponse } from '..';
2
- import { CreateChatCompletionRequest } from '../types/CreateChatCompletionRequest';
3
- export declare function createChatCompletion(params: {
4
- pk: string;
5
- request: CreateChatCompletionRequest;
6
- baseUrl: string;
7
- }): Promise<CreateChatCompletionResponse>;
@@ -1,8 +0,0 @@
1
- import { ListMemoriesRequest } from '../types/ListMemoriesRequest';
2
- import { ListMemoriesResponse } from '../types/ListMemoriesResponse';
3
- export declare function listMemories(params: {
4
- pk: string;
5
- clientSecret: string;
6
- request: ListMemoriesRequest;
7
- baseUrl: string;
8
- }): Promise<ListMemoriesResponse>;
@@ -1,54 +0,0 @@
1
- import { getPackageVersion } from '../utils/version';
2
- export async function listMemories(params) {
3
- try {
4
- const response = await listMemoriesApi({
5
- baseUrl: params.baseUrl,
6
- pk: params.pk,
7
- clientSecret: params.clientSecret,
8
- nextPageToken: params.request.nextPageToken,
9
- previousPageToken: params.request.previousPageToken,
10
- limit: params.request.limit,
11
- typeId: params.request.typeId,
12
- title: params.request.title,
13
- meta: params.request.meta,
14
- });
15
- return {
16
- type: 'success',
17
- items: response.items,
18
- pagination: response.pagination,
19
- };
20
- }
21
- catch (error) {
22
- throw error;
23
- }
24
- }
25
- async function listMemoriesApi(params) {
26
- const queryParams = new URLSearchParams();
27
- if (params.nextPageToken)
28
- queryParams.append('nextPageToken', params.nextPageToken);
29
- if (params.previousPageToken)
30
- queryParams.append('previousPageToken', params.previousPageToken);
31
- if (params.limit !== undefined)
32
- queryParams.append('limit', params.limit.toString());
33
- if (params.typeId)
34
- queryParams.append('typeId', encodeURIComponent(params.typeId));
35
- if (params.title)
36
- queryParams.append('title', encodeURIComponent(params.title));
37
- // Handle meta object - encode as key-value pairs
38
- if (params.meta && Object.keys(params.meta).length > 0) {
39
- Object.entries(params.meta).forEach(([key, value]) => {
40
- queryParams.append(`meta_${encodeURIComponent(key)}`, value);
41
- });
42
- }
43
- const queryString = queryParams.toString();
44
- const response = await fetch(`${params.baseUrl}/v1/pub/memories?${queryString}`, {
45
- method: 'GET',
46
- headers: {
47
- 'Content-Type': 'application/json',
48
- Authorization: `Bearer ${params.pk}`,
49
- 'X-Fency-Sdk-Version': getPackageVersion(),
50
- 'X-Fency-Client-Secret': params.clientSecret,
51
- },
52
- });
53
- return response.json();
54
- }
@@ -1,9 +0,0 @@
1
- import type { CreateClaudeChatCompletionMessageDto } from './CreateClaudeChatCompletionMessageDto';
2
- export type CreateClaudeChatCompletionDto = {
3
- model: string;
4
- temperature?: number | null;
5
- topP?: number | null;
6
- topK?: number | null;
7
- messages: Array<CreateClaudeChatCompletionMessageDto>;
8
- systemPrompt?: string | null;
9
- };
@@ -1,4 +0,0 @@
1
- export type CreateClaudeChatCompletionMessageDto = {
2
- role: string;
3
- content: string;
4
- };
@@ -1,10 +0,0 @@
1
- import type { CreateGeminiChatCompletionMessageDto } from './CreateGeminiChatCompletionMessageDto';
2
- export type CreateGeminiChatCompletionDto = {
3
- model: string;
4
- temperature?: number | null;
5
- topP?: number | null;
6
- topK?: number | null;
7
- responseJsonSchema?: string | null;
8
- messages: Array<CreateGeminiChatCompletionMessageDto>;
9
- systemPrompt?: string | null;
10
- };
@@ -1,4 +0,0 @@
1
- export type CreateGeminiChatCompletionMessageDto = {
2
- role: string;
3
- content: string;
4
- };
@@ -1,8 +0,0 @@
1
- import type { CreateOpenAiChatCompletionMessageDto } from './CreateOpenAiChatCompletionMessageDto';
2
- export type CreateOpenAiChatCompletionDto = {
3
- model: string;
4
- temperature?: number | null;
5
- topP?: number | null;
6
- responseJsonSchema?: string | null;
7
- messages: Array<CreateOpenAiChatCompletionMessageDto>;
8
- };
@@ -1,4 +0,0 @@
1
- export type CreateOpenAiChatCompletionMessageDto = {
2
- role: string;
3
- content: string;
4
- };
@@ -1,6 +0,0 @@
1
- import type { PaginationDto } from './PaginationDto';
2
- import type { PubMemoryDto } from './PubMemoryDto';
3
- export type ListMemoriesResponse = {
4
- items: Array<PubMemoryDto>;
5
- pagination: PaginationDto;
6
- };
@@ -1,9 +0,0 @@
1
- import type { ApiDtoType } from './ApiDtoType';
2
- export type PubChatCompletionDto = {
3
- id: string;
4
- createdAt: string;
5
- type: ApiDtoType;
6
- streamId?: string | null;
7
- response?: string | null;
8
- responseIsStructured?: boolean | null;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import type { CreateClaudeChatCompletionDto } from './CreateClaudeChatCompletionDto';
2
- import type { CreateGeminiChatCompletionDto } from './CreateGeminiChatCompletionDto';
3
- import type { CreateOpenAiChatCompletionDto } from './CreateOpenAiChatCompletionDto';
4
- export type PubCreateChatCompletionRequest = {
5
- streamId?: string | null;
6
- sessionClientSecret?: string | null;
7
- openai?: CreateOpenAiChatCompletionDto;
8
- gemini?: CreateGeminiChatCompletionDto;
9
- claude?: CreateClaudeChatCompletionDto;
10
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import type { StreamEventType } from './StreamEventType';
2
- export type WebsiteHtmlContentReadyEventDto = {
3
- type: StreamEventType;
4
- streamId: string;
5
- websiteId: string;
6
- htmlContent: string;
7
- timestamp: string;
8
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import type { StreamEventType } from './StreamEventType';
2
- export type WebsiteTextContentReadyEventDto = {
3
- type: StreamEventType;
4
- streamId: string;
5
- websiteId: string;
6
- textContent: string;
7
- timestamp: string;
8
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface ListMemoriesRequest {
2
- typeId?: string;
3
- title?: string;
4
- meta: Record<string, string>;
5
- nextPageToken?: string;
6
- previousPageToken?: string;
7
- limit?: number;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};