Open SAnBlog opened 2 days ago
👀 @SAnBlog
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
To resolve the 405 error and the "Unexpected end of JSON input" SyntaxError in the createShareGPTUrl
function, try the following:
405 Error (Method Not Allowed):
https://sharegpt.com/api/conversations
supports the POST
method. If not, use the correct HTTP method."Unexpected end of JSON input" SyntaxError:
Here's a code snippet to handle the response and avoid the SyntaxError:
const res = await fetch(SHARE_GPT_URL, {
body: JSON.stringify({ ...conversation, items }),
headers: {
'Content-Type': 'application/json',
},
method: 'POST',
});
if (!res.ok) {
throw new Error(`HTTP error! status: ${res.status}`);
}
const data = await res.json();
if (!data.id) throw new Error('Failed to create ShareGPT URL');
return `https://shareg.pt/${data.id}`;
This checks if the response is OK before parsing the JSON, helping diagnose request issues [1][2][3].
To continue talking to Dosu, mention @dosu.
ShareGPT 挂了,正在想替代方案
📦 Environment
Docker
📌 Version
v1.21.8
💻 Operating System
macOS
🌐 Browser
Chrome
🐛 Bug Description
📷 Recurrence Steps
No response
🚦 Expected Behavior
No response
📝 Additional Information
No response