Fix Qwen OAuth and Ollama models listing

- Add generateUXDesignerPrompt method to QwenOAuthService
- Fix Ollama Cloud listModels to handle multiple response formats
- Improve Ollama models parsing with array/different response structures
- All providers now support UX Designer Prompt feature
This commit is contained in:
Gemini AI
2025-12-25 23:17:55 +04:00
Unverified
parent f510683e18
commit 07dbe552f7
10 changed files with 735 additions and 100 deletions

View File

@@ -0,0 +1,38 @@
import { NextRequest, NextResponse } from "next/server";
import { QWEN_OAUTH_BASE_URL } from "../constants";
export async function GET(request: NextRequest) {
try {
const authorization = request.headers.get("authorization");
if (!authorization || !authorization.startsWith("Bearer ")) {
return NextResponse.json(
{ error: "Authorization required" },
{ status: 401 }
);
}
const token = authorization.slice(7);
const userResponse = await fetch(`${QWEN_OAUTH_BASE_URL}/api/v1/user`, {
headers: {
Authorization: `Bearer ${token}`,
},
});
if (!userResponse.ok) {
const errorText = await userResponse.text();
return NextResponse.json(
{ error: "Failed to fetch user info", details: errorText },
{ status: userResponse.status }
);
}
const userData = await userResponse.json();
return NextResponse.json({ user: userData });
} catch (error) {
console.error("Qwen user info failed", error);
return NextResponse.json(
{ error: "Failed to fetch user info" },
{ status: 500 }
);
}
}