@eka-care/ekascribe-ts-sdk 1.4.14 → 1.4.18
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/template-sections/patch-v1-template-section.d.ts +1 -1
- package/dist/api/template-sections/patch-v1-template-section.js +1 -4
- 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 +9 -2
- 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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TPostV1TemplateSectionRequest, TPostV1TemplateSectionResponse } from '../../constants/types';
|
|
2
|
-
declare function patchV1TemplateSection({ section_id,
|
|
2
|
+
declare function patchV1TemplateSection({ section_id, title, desc, format, example, }: TPostV1TemplateSectionRequest): Promise<TPostV1TemplateSectionResponse>;
|
|
3
3
|
export default patchV1TemplateSection;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
2
|
import fetchWrapper from '../../fetch-client';
|
|
3
3
|
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
-
async function patchV1TemplateSection({ section_id,
|
|
4
|
+
async function patchV1TemplateSection({ section_id, title, desc, format, example, }) {
|
|
5
5
|
try {
|
|
6
6
|
const headers = new Headers();
|
|
7
7
|
headers.append('Content-Type', 'application/json');
|
|
8
|
-
if (template_id) {
|
|
9
|
-
headers.append('template-id', template_id);
|
|
10
|
-
}
|
|
11
8
|
const raw = {
|
|
12
9
|
title,
|
|
13
10
|
desc,
|
|
@@ -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;
|
|
@@ -13,6 +13,7 @@ export type TGetConfigV2Response = {
|
|
|
13
13
|
settings?: TConfigSettings;
|
|
14
14
|
model?: string;
|
|
15
15
|
my_templates?: string[];
|
|
16
|
+
wid?: string;
|
|
16
17
|
};
|
|
17
18
|
message?: string;
|
|
18
19
|
code?: number;
|
|
@@ -254,12 +255,18 @@ export interface TGetV1TemplatesResponse {
|
|
|
254
255
|
message: string;
|
|
255
256
|
};
|
|
256
257
|
}
|
|
258
|
+
export type TPostCookV1MediaAiCreateTemplateResponse = {
|
|
259
|
+
title: string;
|
|
260
|
+
desc: string;
|
|
261
|
+
sections: TSection[];
|
|
262
|
+
code: number;
|
|
263
|
+
message: string;
|
|
264
|
+
};
|
|
257
265
|
export interface TPostV1TemplateSectionRequest {
|
|
258
266
|
title: string;
|
|
259
267
|
desc?: string;
|
|
260
268
|
format?: 'P' | 'B';
|
|
261
269
|
example?: string;
|
|
262
|
-
template_id?: string;
|
|
263
270
|
section_id?: string;
|
|
264
271
|
}
|
|
265
272
|
export interface TPostV1TemplateSectionResponse {
|
|
@@ -278,7 +285,7 @@ export interface TSection {
|
|
|
278
285
|
desc: string;
|
|
279
286
|
format: 'P' | 'B';
|
|
280
287
|
example: string;
|
|
281
|
-
default
|
|
288
|
+
default?: boolean;
|
|
282
289
|
parent_section_id?: string;
|
|
283
290
|
}
|
|
284
291
|
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").TPostCookV1MediaAiCreateTemplateResponse>;
|
|
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;
|