@eka-care/ekascribe-ts-sdk 1.4.14 → 1.4.15
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/templates/cook-v1-medai-ai-create-template.d.ts +3 -0
- package/dist/api/templates/cook-v1-medai-ai-create-template.js +29 -0
- package/dist/constants/types.d.ts +6 -1
- package/dist/fetch-client/helper.d.ts +1 -0
- package/dist/fetch-client/helper.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_COOK_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function cookV1MediaAiCreateTemplate(formData) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers,
|
|
11
|
+
body: formData,
|
|
12
|
+
};
|
|
13
|
+
const response = await fetchWrapper(`${GET_COOK_HOST_V1()}/medai/ai-create-template`, options);
|
|
14
|
+
let res = await response.json();
|
|
15
|
+
res = {
|
|
16
|
+
...res,
|
|
17
|
+
code: response.status,
|
|
18
|
+
};
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.log('%c postV1Template -> error', 'color:#f5ce50', error);
|
|
23
|
+
return {
|
|
24
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
25
|
+
message: `Something went wrong! ${error}`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export default cookV1MediaAiCreateTemplate;
|
|
@@ -254,6 +254,11 @@ export interface TGetV1TemplatesResponse {
|
|
|
254
254
|
message: string;
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
+
export type TPostCookV1MediaAiCreateTemplateResponse = {
|
|
258
|
+
title: string;
|
|
259
|
+
desc: string;
|
|
260
|
+
sections: TSection[];
|
|
261
|
+
};
|
|
257
262
|
export interface TPostV1TemplateSectionRequest {
|
|
258
263
|
title: string;
|
|
259
264
|
desc?: string;
|
|
@@ -278,7 +283,7 @@ export interface TSection {
|
|
|
278
283
|
desc: string;
|
|
279
284
|
format: 'P' | 'B';
|
|
280
285
|
example: string;
|
|
281
|
-
default
|
|
286
|
+
default?: boolean;
|
|
282
287
|
parent_section_id?: string;
|
|
283
288
|
}
|
|
284
289
|
export interface TGetV1TemplateSectionsResponse {
|
|
@@ -9,4 +9,5 @@ export declare const GET_AUTH_TOKEN: () => string;
|
|
|
9
9
|
export declare const GET_EKA_VOICE_HOST_V1: () => string;
|
|
10
10
|
export declare const GET_EKA_VOICE_HOST_V2: () => string;
|
|
11
11
|
export declare const GET_EKA_VOICE_HOST_V3: () => string;
|
|
12
|
+
export declare const GET_COOK_HOST_V1: () => string;
|
|
12
13
|
export default setEnv;
|
|
@@ -3,12 +3,14 @@ const DEV = {
|
|
|
3
3
|
EKA_VOICE_HOST_V1: 'https://v2rxbe.dev.eka.care/voice/api/v1',
|
|
4
4
|
EKA_VOICE_HOST_V2: 'https://v2rxbe.dev.eka.care/voice/api/v2',
|
|
5
5
|
EKA_VOICE_HOST_V3: 'https://v2rxbe.dev.eka.care/voice/api/v3',
|
|
6
|
+
COOK_V1: ' https://deepthought-genai.dev.eka.care/api/v1',
|
|
6
7
|
};
|
|
7
8
|
const PROD = {
|
|
8
9
|
EKA_HOST: 'https://api.eka.care',
|
|
9
10
|
EKA_VOICE_HOST_V1: 'https://api.eka.care/voice/api/v1',
|
|
10
11
|
EKA_VOICE_HOST_V2: 'https://api.eka.care/voice/api/v2',
|
|
11
12
|
EKA_VOICE_HOST_V3: 'https://api.eka.care/voice/api/v3',
|
|
13
|
+
COOK_V1: ' https://cook.eka.care/api/v1',
|
|
12
14
|
};
|
|
13
15
|
let envVar = PROD;
|
|
14
16
|
let client_id = 'doc-web';
|
|
@@ -30,4 +32,5 @@ export const GET_AUTH_TOKEN = () => auth;
|
|
|
30
32
|
export const GET_EKA_VOICE_HOST_V1 = () => envVar.EKA_VOICE_HOST_V1;
|
|
31
33
|
export const GET_EKA_VOICE_HOST_V2 = () => envVar.EKA_VOICE_HOST_V2;
|
|
32
34
|
export const GET_EKA_VOICE_HOST_V3 = () => envVar.EKA_VOICE_HOST_V3;
|
|
35
|
+
export const GET_COOK_HOST_V1 = () => envVar.COOK_V1;
|
|
33
36
|
export default setEnv;
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare class EkaScribe {
|
|
|
55
55
|
createTemplate(template: TPostV1TemplateRequest): Promise<import("./constants/types").TPostV1TemplateResponse>;
|
|
56
56
|
updateTemplate(template: TPostV1TemplateRequest): Promise<import("./constants/types").TPostV1TemplateResponse>;
|
|
57
57
|
deleteTemplate(template_id: string): Promise<import("./constants/types").TPostV1TemplateResponse>;
|
|
58
|
+
aiGenerateTemplate(formData: FormData): Promise<import("./constants/types").TPostV1TemplateResponse>;
|
|
58
59
|
updateConfig(request: TPatchVoiceApiV2ConfigRequest): Promise<any>;
|
|
59
60
|
getAllTemplateSections(): Promise<import("./constants/types").TGetV1TemplateSectionsResponse>;
|
|
60
61
|
createTemplateSection(templateSection: TPostV1TemplateSectionRequest): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import postV1TemplateSection from './api/template-sections/post-v1-template-sect
|
|
|
26
26
|
import patchV1TemplateSection from './api/template-sections/patch-v1-template-section';
|
|
27
27
|
import deleteV1TemplateSection from './api/template-sections/delete-v1-template-section';
|
|
28
28
|
import patchVoiceApiV2Config from './api/config/patch-voice-api-v2-config';
|
|
29
|
+
import cookV1MediaAiCreateTemplate from './api/templates/cook-v1-medai-ai-create-template';
|
|
29
30
|
class EkaScribe {
|
|
30
31
|
// Private constructor to prevent direct instantiation
|
|
31
32
|
constructor() {
|
|
@@ -281,6 +282,10 @@ class EkaScribe {
|
|
|
281
282
|
const templatesResponse = await deleteV1Template(template_id);
|
|
282
283
|
return templatesResponse;
|
|
283
284
|
}
|
|
285
|
+
async aiGenerateTemplate(formData) {
|
|
286
|
+
const templatesResponse = await cookV1MediaAiCreateTemplate(formData);
|
|
287
|
+
return templatesResponse;
|
|
288
|
+
}
|
|
284
289
|
async updateConfig(request) {
|
|
285
290
|
const configResponse = await patchVoiceApiV2Config(request);
|
|
286
291
|
return configResponse;
|