@nu-art/ts-openai-frontend 0.400.2
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/ATS_OpenAI/ATS_OpenAI.d.ts +33 -0
- package/ATS_OpenAI/ATS_OpenAI.js +54 -0
- package/ATS_OpenAI/ATS_OpenAI.js.map +1 -0
- package/ATS_OpenAI/ATS_OpenAI.scss +2 -0
- package/ATS_OpenAI/index.d.ts +1 -0
- package/ATS_OpenAI/index.js +2 -0
- package/ATS_OpenAI/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/modules/ModuleFE_OpenAI.d.ts +11 -0
- package/modules/ModuleFE_OpenAI.js +16 -0
- package/modules/ModuleFE_OpenAI.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AppToolsScreen, ComponentSync } from '@nu-art/thunderstorm/frontend/index';
|
|
2
|
+
type ATS_OpenAI_Props = {};
|
|
3
|
+
type ATS_OpenAI_State = {
|
|
4
|
+
directive: string;
|
|
5
|
+
input: string;
|
|
6
|
+
output?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* in this example the backend config should be something of this sort:
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* {
|
|
13
|
+
* directives: {
|
|
14
|
+
* 'address-resolver': 'You are a Typescript address resolving assistant, you return a JSON with the following props: city, streetName, houseNumber, entrance (single letter), floor, apartmentNumber, country and additionalInfo. The JSON props must remain in english whereas the values need to be translated to valid addresses in Hebrew. unavailable props should be omitted from the JSON\'s props',
|
|
15
|
+
* },
|
|
16
|
+
* defaultModel: 'gpt-4',
|
|
17
|
+
* apiKey: 'YourAPI-Key',
|
|
18
|
+
* orgId: 'YourORG-Id'
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class ATS_OpenAI extends ComponentSync<ATS_OpenAI_Props, ATS_OpenAI_State> {
|
|
23
|
+
static screen: AppToolsScreen;
|
|
24
|
+
static defaultProps: {
|
|
25
|
+
modules: never[];
|
|
26
|
+
pageTitle: () => string;
|
|
27
|
+
};
|
|
28
|
+
protected deriveStateFromProps(nextProps: ATS_OpenAI_Props, state?: ATS_OpenAI_State): ATS_OpenAI_State;
|
|
29
|
+
constructor(p: ATS_OpenAI_Props);
|
|
30
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
private sendRequest;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ATS_3rd_Party, Button, ComponentSync, LL_H_C, LL_H_T, LL_V_L } from '@nu-art/thunderstorm/frontend/index';
|
|
3
|
+
import { TS_TextAreaV2 } from '@nu-art/thunderstorm/frontend/components/TS_V2_TextArea/index';
|
|
4
|
+
import { ModuleFE_OpenAI } from '../modules/ModuleFE_OpenAI.js';
|
|
5
|
+
import { __stringify } from '@nu-art/ts-common';
|
|
6
|
+
/**
|
|
7
|
+
* in this example the backend config should be something of this sort:
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* directives: {
|
|
12
|
+
* 'address-resolver': 'You are a Typescript address resolving assistant, you return a JSON with the following props: city, streetName, houseNumber, entrance (single letter), floor, apartmentNumber, country and additionalInfo. The JSON props must remain in english whereas the values need to be translated to valid addresses in Hebrew. unavailable props should be omitted from the JSON\'s props',
|
|
13
|
+
* },
|
|
14
|
+
* defaultModel: 'gpt-4',
|
|
15
|
+
* apiKey: 'YourAPI-Key',
|
|
16
|
+
* orgId: 'YourORG-Id'
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export class ATS_OpenAI extends ComponentSync {
|
|
21
|
+
static screen = { name: `OpenAI`, renderer: this, group: ATS_3rd_Party };
|
|
22
|
+
static defaultProps = {
|
|
23
|
+
modules: [],
|
|
24
|
+
pageTitle: () => this.screen.name
|
|
25
|
+
};
|
|
26
|
+
deriveStateFromProps(nextProps, state = {}) {
|
|
27
|
+
return { output: undefined, input: '', directive: '' };
|
|
28
|
+
}
|
|
29
|
+
constructor(p) {
|
|
30
|
+
super(p);
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
let value = this.state.output;
|
|
34
|
+
try {
|
|
35
|
+
if (value)
|
|
36
|
+
value = __stringify(JSON.parse(value), true);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
// not a pure json response
|
|
40
|
+
}
|
|
41
|
+
this.logInfo(value);
|
|
42
|
+
return _jsxs(LL_H_T, { children: [_jsxs(LL_V_L, { children: ["App dev screen for OpenAI", _jsx(Button, { onClick: this.sendRequest, children: "Test" })] }), _jsxs(LL_V_L, { children: [_jsx(TS_TextAreaV2, { className: 'ts-textarea', style: { width: 1008, height: 200, marginBottom: 8, fontFamily: 'monospace', fontSize: 15 }, value: this.state.directive, onChange: (value) => this.setState({ directive: value }) }), _jsxs(LL_H_C, { children: [_jsx(TS_TextAreaV2, { className: 'ts-textarea', style: { width: 500, height: 500, marginRight: 8, fontFamily: 'monospace', fontSize: 15 }, value: this.state.input, onChange: (value) => this.setState({ input: value }) }), _jsx(TS_TextAreaV2, { className: 'ts-textarea', style: { width: 500, height: 500, fontFamily: 'monospace', fontSize: 15 }, disabled: true, value: value })] })] })] });
|
|
43
|
+
}
|
|
44
|
+
sendRequest = async (e) => {
|
|
45
|
+
this.setState({ output: undefined });
|
|
46
|
+
const response = await ModuleFE_OpenAI.v1.test({
|
|
47
|
+
directive: this.state.directive,
|
|
48
|
+
message: this.state.input
|
|
49
|
+
}).executeSync();
|
|
50
|
+
this.logWarning(response);
|
|
51
|
+
this.setState({ output: response.response });
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ATS_OpenAI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AC,CAAC;QACnC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,EAAE,CAAC,IAAI,CAAC;YAC9C,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;YAC/B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;SACzB,CAAC,CAAC,WAAW,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAC,CAAC,CAAC;IAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ATS_OpenAI.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-agents/openai/frontend/src/main/","sources":["ATS_OpenAI/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modules/ModuleFE_OpenAI.js';
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-agents/openai/frontend/src/main/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Module } from '@nu-art/ts-common';
|
|
2
|
+
import { ApiDefCaller } from '@nu-art/thunderstorm';
|
|
3
|
+
import { ApiStruct_OpenAI } from '@nu-art/ts-openai-shared/api-def';
|
|
4
|
+
type Config = {};
|
|
5
|
+
export declare class ModuleFE_OpenAI_Class extends Module<Config> {
|
|
6
|
+
readonly v1: ApiDefCaller<ApiStruct_OpenAI>['v1'];
|
|
7
|
+
constructor();
|
|
8
|
+
init(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const ModuleFE_OpenAI: ModuleFE_OpenAI_Class;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Module } from '@nu-art/ts-common';
|
|
2
|
+
import { apiWithBody } from '@nu-art/thunderstorm/frontend/index';
|
|
3
|
+
import { ApiDef_OpenAI } from '@nu-art/ts-openai-shared/api-def';
|
|
4
|
+
export class ModuleFE_OpenAI_Class extends Module {
|
|
5
|
+
v1;
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.v1 = {
|
|
9
|
+
test: apiWithBody(ApiDef_OpenAI.v1.test),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
init() {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export const ModuleFE_OpenAI = new ModuleFE_OpenAI_Class();
|
|
16
|
+
//# sourceMappingURL=ModuleFE_OpenAI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleFE_OpenAI.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-agents/openai/frontend/src/main/","sources":["modules/ModuleFE_OpenAI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,WAAW,EAAC,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAC,aAAa,EAAmB,MAAM,kCAAkC,CAAC;AAOjF,MAAM,OAAO,qBACZ,SAAQ,MAAc;IAEb,EAAE,CAAuC;IAElD;QACC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,EAAE,GAAG;YACT,IAAI,EAAE,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC;SACxC,CAAC;IACH,CAAC;IAED,IAAI;IACJ,CAAC;CACD;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nu-art/ts-openai-frontend",
|
|
3
|
+
"version": "0.400.2",
|
|
4
|
+
"description": "ts-openai - Express & Typescript based backend framework",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"TacB0sS",
|
|
7
|
+
"infra",
|
|
8
|
+
"nu-art",
|
|
9
|
+
"thunderstorm",
|
|
10
|
+
"typescript",
|
|
11
|
+
"ts-openai"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/nu-art-js/thunderstorm",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/nu-art-js/thunderstorm/issues"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"directory": "dist",
|
|
19
|
+
"linkDirectory": true
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+ssh://git@github.com:nu-art-js/thunderstorm.git"
|
|
24
|
+
},
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"author": "TacB0sS",
|
|
27
|
+
"files": [
|
|
28
|
+
"**/*"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@nu-art/ts-common": "0.400.2",
|
|
35
|
+
"@nu-art/thunderstorm": "0.400.2",
|
|
36
|
+
"@nu-art/ts-openai-shared": "0.400.2",
|
|
37
|
+
"openai": "^6.7.0",
|
|
38
|
+
"firebase": "^11.9.0",
|
|
39
|
+
"firebase-admin": "13.4.0",
|
|
40
|
+
"firebase-functions": "6.3.2",
|
|
41
|
+
"react": "^18.0.0",
|
|
42
|
+
"sinon": "^20.0.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/react": "^18.0.0",
|
|
46
|
+
"@types/chai": "^4.3.4",
|
|
47
|
+
"@types/mocha": "^10.0.1",
|
|
48
|
+
"@types/sinon": "^17.0.0"
|
|
49
|
+
},
|
|
50
|
+
"unitConfig": {
|
|
51
|
+
"type": "typescript-lib"
|
|
52
|
+
},
|
|
53
|
+
"type": "module",
|
|
54
|
+
"exports": {
|
|
55
|
+
".": {
|
|
56
|
+
"types": "./index.d.ts",
|
|
57
|
+
"import": "./index.js"
|
|
58
|
+
},
|
|
59
|
+
"./*": {
|
|
60
|
+
"types": "./*.d.ts",
|
|
61
|
+
"import": "./*.js"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|