@flashbacktech/flashbackclient 0.2.15 → 0.2.17
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.
package/dist/api/client.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { UserUpdateRequest, UserUpdateResponse } from './types/platform/user';
|
|
|
18
18
|
import { CreateRepoAiApiKeyRequest, CreateRepoAiApiKeyResponse, DeleteRepoAiApiKeyResponse, GetRepoAiApiKeysResponse, UpdateRepoAiApiKeyRequest, UpdateRepoAiApiKeyResponse } from './types/ai/aiapikey';
|
|
19
19
|
import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLlmResponse, GetAiLlmsResponse, UpdateAiLlmRequest, UpdateAiLlmResponse, ValidateAiLlmResponse } from './types/ai/aillm';
|
|
20
20
|
import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, PolicyDTO, UpdatePolicyRequest } from './types/ai/policy';
|
|
21
|
+
import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse } from './types/ai/conversation';
|
|
21
22
|
interface ErrorResponse {
|
|
22
23
|
message?: string;
|
|
23
24
|
[key: string]: any;
|
|
@@ -230,6 +231,10 @@ export declare class ApiClient implements IApiClient {
|
|
|
230
231
|
getRepoAiApiKeys: (repoId: string) => Promise<GetRepoAiApiKeysResponse>;
|
|
231
232
|
updateRepoAiApiKey: (repoId: string, apikeyId: string, data: UpdateRepoAiApiKeyRequest) => Promise<UpdateRepoAiApiKeyResponse>;
|
|
232
233
|
deleteRepoAiApiKey: (repoId: string, apikeyId: string) => Promise<DeleteRepoAiApiKeyResponse>;
|
|
234
|
+
createConversation: (data: CreateConversationRequest) => Promise<CreateConversationResponse>;
|
|
235
|
+
sendPrompt: (conversationId: string, data: SendPromptRequest) => Promise<SendPromptResponse>;
|
|
236
|
+
getConversations: (query: GetConversationsRequest) => Promise<GetConversationsResponse>;
|
|
237
|
+
getConversationMessages: (conversationId: string) => Promise<GetConversationMessagesResponse>;
|
|
233
238
|
createPolicy: (data: CreatePolicyRequest) => Promise<{
|
|
234
239
|
success: boolean;
|
|
235
240
|
policy: PolicyDTO;
|
package/dist/api/client.js
CHANGED
|
@@ -539,6 +539,41 @@ class ApiClient {
|
|
|
539
539
|
this.deleteRepoAiApiKey = async (repoId, apikeyId) => {
|
|
540
540
|
return this.makeRequest(`repo/${repoId}/ai/apikey/${apikeyId}`, 'DELETE', null);
|
|
541
541
|
};
|
|
542
|
+
////// Conversation API calls
|
|
543
|
+
this.createConversation = async (data) => {
|
|
544
|
+
return this.makeRequest('conversation', 'POST', data);
|
|
545
|
+
};
|
|
546
|
+
this.sendPrompt = async (conversationId, data) => {
|
|
547
|
+
return this.makeRequest(`conversation/${conversationId}/prompt`, 'POST', data);
|
|
548
|
+
};
|
|
549
|
+
this.getConversations = async (query) => {
|
|
550
|
+
const queryParams = new URLSearchParams();
|
|
551
|
+
if (query.take !== undefined) {
|
|
552
|
+
queryParams.append('take', query.take.toString());
|
|
553
|
+
}
|
|
554
|
+
if (query.skip !== undefined) {
|
|
555
|
+
queryParams.append('skip', query.skip.toString());
|
|
556
|
+
}
|
|
557
|
+
if (query.from) {
|
|
558
|
+
queryParams.append('from', query.from);
|
|
559
|
+
}
|
|
560
|
+
if (query.to) {
|
|
561
|
+
queryParams.append('to', query.to);
|
|
562
|
+
}
|
|
563
|
+
if (query.userId) {
|
|
564
|
+
queryParams.append('userId', query.userId);
|
|
565
|
+
}
|
|
566
|
+
if (query.workspaceId) {
|
|
567
|
+
queryParams.append('workspaceId', query.workspaceId);
|
|
568
|
+
}
|
|
569
|
+
if (query.repoId) {
|
|
570
|
+
queryParams.append('repoId', query.repoId);
|
|
571
|
+
}
|
|
572
|
+
return this.makeRequest(`conversation?${queryParams.toString()}`, 'GET', null);
|
|
573
|
+
};
|
|
574
|
+
this.getConversationMessages = async (conversationId) => {
|
|
575
|
+
return this.makeRequest(`conversation/${conversationId}/messages`, 'GET', null);
|
|
576
|
+
};
|
|
542
577
|
////// Policy API calls
|
|
543
578
|
this.createPolicy = async (data) => {
|
|
544
579
|
return this.makeRequest('policy', 'POST', data);
|
package/dist/api/index.d.ts
CHANGED
|
@@ -19,4 +19,5 @@ import * as UserTypes from './types/platform/user';
|
|
|
19
19
|
import * as AiApiKeyTypes from './types/ai/aiapikey';
|
|
20
20
|
import * as AiLlmTypes from './types/ai/aillm';
|
|
21
21
|
import * as PolicyTypes from './types/ai/policy';
|
|
22
|
-
|
|
22
|
+
import * as ConversationTypes from './types/ai/conversation';
|
|
23
|
+
export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes, AiApiKeyTypes, AiLlmTypes, PolicyTypes, ConversationTypes };
|
package/dist/api/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.PolicyTypes = exports.AiLlmTypes = exports.AiApiKeyTypes = exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
36
|
+
exports.ConversationTypes = exports.PolicyTypes = exports.AiLlmTypes = exports.AiApiKeyTypes = exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
37
37
|
const client_1 = require("./client");
|
|
38
38
|
Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
|
|
39
39
|
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return client_1.HttpError; } });
|
|
@@ -77,3 +77,5 @@ const AiLlmTypes = __importStar(require("./types/ai/aillm"));
|
|
|
77
77
|
exports.AiLlmTypes = AiLlmTypes;
|
|
78
78
|
const PolicyTypes = __importStar(require("./types/ai/policy"));
|
|
79
79
|
exports.PolicyTypes = PolicyTypes;
|
|
80
|
+
const ConversationTypes = __importStar(require("./types/ai/conversation"));
|
|
81
|
+
exports.ConversationTypes = ConversationTypes;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface CreateConversationRequest {
|
|
2
|
+
repoId: string;
|
|
3
|
+
}
|
|
4
|
+
export interface CreateConversationResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
message?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SendPromptRequest {
|
|
10
|
+
prompt: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SendPromptResponse {
|
|
13
|
+
success: boolean;
|
|
14
|
+
message?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GetConversationsRequest {
|
|
17
|
+
take?: number;
|
|
18
|
+
skip?: number;
|
|
19
|
+
from?: string;
|
|
20
|
+
to?: string;
|
|
21
|
+
userId?: string;
|
|
22
|
+
workspaceId?: string;
|
|
23
|
+
repoId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ConversationDTO {
|
|
26
|
+
id: string;
|
|
27
|
+
orgId: string;
|
|
28
|
+
createdBy: string;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
lastUpdatedAt: string;
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
repoId: string;
|
|
33
|
+
tokensIn: string;
|
|
34
|
+
tokensOut: string;
|
|
35
|
+
creator?: {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
lastName: string;
|
|
39
|
+
email: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface GetConversationsResponse {
|
|
43
|
+
success: boolean;
|
|
44
|
+
conversations: ConversationDTO[];
|
|
45
|
+
total: number;
|
|
46
|
+
message?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface MessageDTO {
|
|
49
|
+
id: string;
|
|
50
|
+
conversationId: string;
|
|
51
|
+
role: string;
|
|
52
|
+
content: string;
|
|
53
|
+
tokenCount?: number;
|
|
54
|
+
model?: string;
|
|
55
|
+
metadata?: Record<string, unknown>;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
}
|
|
58
|
+
export interface GetConversationMessagesResponse {
|
|
59
|
+
success: boolean;
|
|
60
|
+
messages: MessageDTO[];
|
|
61
|
+
message?: string;
|
|
62
|
+
}
|