voldt-api 1.0.4 → 1.0.5

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.
@@ -0,0 +1,2 @@
1
+ export * from './lib/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from './lib/index.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function chatgpt(prompt: string): Promise<{
2
+ success: boolean;
3
+ result: string;
4
+ message?: undefined;
5
+ } | {
6
+ success: boolean;
7
+ message: any;
8
+ result?: undefined;
9
+ }>;
10
+ //# sourceMappingURL=chatgpt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatgpt.d.ts","sourceRoot":"","sources":["../../src/lib/chatgpt.ts"],"names":[],"mappings":"AAsCA,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM;;;;;;;;GAyD3C"}
@@ -81,3 +81,4 @@ export async function chatgpt(prompt) {
81
81
  };
82
82
  }
83
83
  }
84
+ //# sourceMappingURL=chatgpt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatgpt.js","sourceRoot":"","sources":["../../src/lib/chatgpt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IACzC,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;SAC9C,OAAO,CAAC,KAAK,EAAE,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oBAAE,SAAS;gBAEvB,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBACnC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;wBAChB,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC;oBACxB,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC,CAAA,CAAC;YACZ,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM;SACP,CAAC;IAEJ,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,OAAO;SACvC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './chatgpt.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
package/dist/lib/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from './chatgpt.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voldt-api",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,26 +0,0 @@
1
- name: Publish Package
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - uses: actions/checkout@v4
14
-
15
- - uses: actions/setup-node@v4
16
- with:
17
- node-version: 22
18
- registry-url: https://registry.npmjs.org
19
-
20
- - run: npm ci
21
-
22
- - run: npm run build
23
-
24
- - run: npm publish --access public
25
- env:
26
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './lib';
@@ -1,96 +0,0 @@
1
- import axios from 'axios';
2
- import crypto from 'crypto';
3
-
4
- const generateRandomHash = (len: number) => {
5
- return crypto.randomBytes(len).toString('base64')
6
- .replace(/\+/g, '-')
7
- .replace(/\//g, '_')
8
- .replace(/=/g, '');
9
- };
10
-
11
- function generateCookies() {
12
- const now = Date.now();
13
-
14
- const anonymous_user_id = crypto.randomUUID();
15
-
16
- const sboxRaw = `${now}|${crypto.randomBytes(4).toString('hex')}`;
17
- const sbox_guid = Buffer.from(sboxRaw).toString('base64');
18
-
19
- const crispId = crypto.randomUUID();
20
- const sessionId = `session_${crypto.randomUUID()}`;
21
-
22
- const g_state = {
23
- i_l: 0,
24
- i_ll: now + Math.floor(Math.random() * 5000),
25
- i_b: generateRandomHash(32),
26
- i_e: {
27
- enable_itp_optimization: 0
28
- }
29
- };
30
-
31
- return [
32
- `anonymous_user_id=${anonymous_user_id}`,
33
- `sbox-guid=${sbox_guid}`,
34
- `crisp-client/session/${crispId}=${sessionId}`,
35
- `g_state=${JSON.stringify(g_state)}`
36
- ].join('; ');
37
- }
38
-
39
- export async function chatgpt(prompt: string) {
40
- try {
41
- if (!prompt) throw new Error('Parameter prompt is required');
42
-
43
- const cookies = generateCookies();
44
- const ip = `${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}`;
45
-
46
- const payload = {
47
- 'message': prompt,
48
- 'language': 'auto',
49
- 'model': 'gpt-5-mini',
50
- 'tone': 'default',
51
- 'length': 'moderate',
52
- 'conversation_id': crypto.randomUUID(),
53
- 'image_urls': [],
54
- 'chat_mode': 'standard'
55
- };
56
-
57
- const res = await axios.post('https://notegpt.io/api/v2/chat/stream', payload, {
58
- headers: {
59
- 'cookie': cookies,
60
- 'x-forwarded-for': ip
61
- }
62
- });
63
-
64
- if (!res.data) throw new Error('Response data is empty');
65
-
66
- const raw = res.data;
67
- const lines = raw.split('\n');
68
- let result = '';
69
-
70
- for (const line of lines) {
71
- if (line.startsWith('data:')) {
72
- const jsonStr = line.replace('data: ', '').trim();
73
-
74
- if (!jsonStr) continue;
75
-
76
- try {
77
- const parsed = JSON.parse(jsonStr);
78
- if (parsed.text) {
79
- result += parsed.text;
80
- }
81
- } catch {}
82
- }
83
- }
84
-
85
- return {
86
- success: true,
87
- result
88
- };
89
-
90
- } catch (e: any) {
91
- return {
92
- success: false,
93
- message: e.response?.data || e.message
94
- };
95
- }
96
- }
package/src/lib/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './chatgpt';