Skip to content

Commit a388289

Browse files
committed
fix: sdk
1 parent c4e5aa7 commit a388289

File tree

5 files changed

+3
-19
lines changed

5 files changed

+3
-19
lines changed

sdk/browser/src/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ export async function requestUniTokenOpenAI(options: UniTokenOptions): Promise<U
7070
const serverUrl = `http://localhost:${port}/`
7171
const baseUrl = `${serverUrl}openai/`
7272

73-
const abortController = new AbortController()
74-
setTimeout(() => {
75-
abortController.abort()
76-
}, 10000) // 10 seconds timeout
77-
7873
const response = await fetch(`${serverUrl}app/register`, {
7974
method: 'POST',
8075
headers: { 'Content-Type': 'application/json' },
@@ -83,7 +78,6 @@ export async function requestUniTokenOpenAI(options: UniTokenOptions): Promise<U
8378
description: options.description,
8479
uid: options.savedApiKey,
8580
}),
86-
signal: abortController.signal,
8781
})
8882

8983
if (response.status === 403) {

sdk/go/lib.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ func startService(rootPath string) (string, error) {
135135
return "", fmt.Errorf("failed to start service: %w", err)
136136
}
137137

138-
// Wait a moment for the service to start and write the URL file
139-
time.Sleep(2 * time.Second)
140-
141138
serverURL, err := detectRunningURLFromFile(rootPath)
142139
if err != nil || serverURL == "" {
143140
return "", fmt.Errorf("service started but URL not detected")
@@ -211,7 +208,7 @@ func RequestUniTokenOpenAI(options UniTokenOptions) (UniTokenResult, error) {
211208
return UniTokenResult{}, fmt.Errorf("failed to marshal request: %w", err)
212209
}
213210

214-
client := &http.Client{Timeout: 30 * time.Second}
211+
client := &http.Client{}
215212
resp, err := client.Post(
216213
fmt.Sprintf("%sapp/register", serverURL),
217214
"application/json",

sdk/node/src/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function startService(rootPath: string): Promise<string> {
5555
await downloadService(execPath)
5656
}
5757

58-
const result = spawnSync(execPath, ['start'], {
58+
const result = spawnSync(execPath, ['setup'], {
5959
stdio: 'inherit',
6060
timeout: 10000,
6161
encoding: 'utf8',
@@ -140,11 +140,6 @@ export async function requestUniTokenOpenAI(options: UniTokenOptions): Promise<U
140140
const serverUrl = await detectRunningUrlFromFile(rootPath) || await startService(rootPath)
141141
const baseURL = `${serverUrl}openai/`
142142

143-
const abortController = new AbortController()
144-
setTimeout(() => {
145-
abortController.abort()
146-
}, 100000) // 100 seconds timeout
147-
148143
const response = await fetch(`${serverUrl}app/register`, {
149144
method: 'POST',
150145
headers: { 'Content-Type': 'application/json' },
@@ -153,7 +148,6 @@ export async function requestUniTokenOpenAI(options: UniTokenOptions): Promise<U
153148
description: options.description,
154149
uid: options.savedApiKey,
155150
}),
156-
signal: abortController.signal,
157151
})
158152

159153
if (response.status === 403) {

sdk/python/unitoken/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def start_service(self):
5353
self.download_service(exec_path)
5454

5555
subprocess.run(
56-
[exec_path, "sudo", "setup"],
56+
[exec_path, "setup"],
5757
check=True,
5858
)
5959

sdk/python/unitoken/openai_adapter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def request_unitoken_openai(
4040
"description": description,
4141
"uid": saved_api_key,
4242
},
43-
timeout=10 * 60, # 10 minutes
4443
)
4544

4645
if response.status_code == 403:

0 commit comments

Comments
 (0)