mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-06-27 18:04:15 +08:00
improve claude web error prompt
This commit is contained in:
+14
-2
@@ -188,7 +188,7 @@ export class Claude {
|
||||
async init() {
|
||||
const organizations = await this.getOrganizations()
|
||||
if (organizations.error) {
|
||||
throw new Error(JSON.stringify(organizations, null, 2))
|
||||
throw new Error(organizations.error)
|
||||
}
|
||||
this.organizationId = organizations[0].uuid
|
||||
this.recent_conversations = await this.getConversations()
|
||||
@@ -222,7 +222,19 @@ export class Claude {
|
||||
cookie: `sessionKey=${this.sessionKey}`,
|
||||
},
|
||||
})
|
||||
return await response.json().catch(errorHandle('getOrganizations'))
|
||||
const responseText = await response.text()
|
||||
if (responseText.includes('available in certain regions'))
|
||||
return {
|
||||
error: 'Claude.ai is not available in your region',
|
||||
}
|
||||
try {
|
||||
return JSON.parse(responseText)
|
||||
} catch (e) {
|
||||
errorHandle('getOrganizations')(e)
|
||||
return {
|
||||
error: 'failed to parse response',
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Delete all conversations
|
||||
|
||||
Reference in New Issue
Block a user