mirror of
https://github.com/severian-dev/sucker.severian.dev.git
synced 2025-10-28 04:35:45 +00:00
fix non-streaming
This commit is contained in:
@@ -312,11 +312,7 @@ export async function POST(request: NextRequest) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
|
const isStreamingRequest = body.stream === true;
|
||||||
// Check if this is a streaming request (JanitorAI expects SSE)
|
|
||||||
const acceptHeader = request.headers.get("accept");
|
|
||||||
const isStreamingRequest =
|
|
||||||
acceptHeader?.includes("text/event-stream") || body.stream === true;
|
|
||||||
|
|
||||||
if (!body.messages || body.messages.length < 2) {
|
if (!body.messages || body.messages.length < 2) {
|
||||||
if (isStreamingRequest) {
|
if (isStreamingRequest) {
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ export default function Home() {
|
|||||||
Record<string, number>
|
Record<string, number>
|
||||||
>({});
|
>({});
|
||||||
|
|
||||||
|
const [proxyUrl, setProxyUrl] = useState("https://sucker.severian.dev/api/proxy");
|
||||||
|
|
||||||
const fetchCards = async () => {
|
const fetchCards = async () => {
|
||||||
try {
|
try {
|
||||||
setIsRefreshing(true);
|
setIsRefreshing(true);
|
||||||
@@ -107,6 +109,13 @@ export default function Home() {
|
|||||||
fetchCards();
|
fetchCards();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
const origin = window.location.origin;
|
||||||
|
setProxyUrl(`${origin}/api/proxy`);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const downloadJson = (card: Card) => {
|
const downloadJson = (card: Card) => {
|
||||||
// Use initial version for download, or current version if no initial version available
|
// Use initial version for download, or current version if no initial version available
|
||||||
const chosen = card.initialVersion || card.data;
|
const chosen = card.initialVersion || card.data;
|
||||||
@@ -382,7 +391,7 @@ export default function Home() {
|
|||||||
</p>
|
</p>
|
||||||
<ol className="list-decimal list-inside">
|
<ol className="list-decimal list-inside">
|
||||||
<li className="mb-2">
|
<li className="mb-2">
|
||||||
Put <code>https://sucker.severian.dev/api/proxy</code> in your
|
Put <code>{proxyUrl}</code> in your
|
||||||
API settings, any value for model and key.
|
API settings, any value for model and key.
|
||||||
</li>
|
</li>
|
||||||
<li className="mb-2">
|
<li className="mb-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user