Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api-server/rhelai-install/rhelai-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ if [ -d "/tmp/api-server" ]; then
fi

mkdir -p /tmp/api-server
cd /tmp/ui/api-server
wget https://instructlab-ui.s3.us-east-1.amazonaws.com/apiserver/apiserver-linux-amd64.tar.gz
tar -xzf apiserver-linux-amd64.tar.gz
mv apiserver-linux-amd64/ilab-apiserver /usr/local/sbin
rm -rf apiserver-linux-amd64 apiserver-linux-amd64.tar.gz
cd /tmp/api-server
curl -sLO https://instructlab-ui.s3.us-east-1.amazonaws.com/apiserver/apiserver-linux-amd64.tar.gz
tar -xzf apiserver-linux-amd64.tar.gz
mv apiserver-linux-amd64/ilab-apiserver $HOME/.local/bin
rm -rf apiserver-linux-amd64 apiserver-linux-amd64.tar.gz /tmp/api-server

CUDA_FLAG=""

Expand Down
33 changes: 26 additions & 7 deletions src/app/api/playground/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export async function POST(req: NextRequest) {
const { question, systemRole } = await req.json();
const apiURL = req.nextUrl.searchParams.get('apiURL');
const modelName = req.nextUrl.searchParams.get('modelName');
const apiKey = req.nextUrl.searchParams.get('apiKey')

if (!apiURL || !modelName) {
return new NextResponse('Missing API URL or Model Name', { status: 400 });
Expand All @@ -26,16 +27,34 @@ export async function POST(req: NextRequest) {
stream: true
};

const agent = new https.Agent({
rejectUnauthorized: false
});
let agent: https.Agent
if (apiKey && apiKey != "" ) {
agent = new https.Agent({
rejectUnauthorized: true
});
} else {
agent = new https.Agent({
rejectUnauthorized: false
});
}

var headers: HeadersInit
if (apiKey && apiKey != "" ) {
headers = {
'Content-Type': 'application/json',
'Accept': 'text/event-stream',
'Authorization': `Bearer: ${apiKey}`
}
} else {
headers = {
'Content-Type': 'application/json',
'Accept': 'text/event-stream'
}
}

const chatResponse = await fetch(`${apiURL}/v1/chat/completions`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
accept: 'application/json'
},
headers: headers,
body: JSON.stringify(requestData),
agent: apiURL.startsWith('https') ? agent : undefined
});
Expand Down
5 changes: 5 additions & 0 deletions src/app/playground/endpoints/endpointPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.disabled-endpoint {
opacity: 0.4; /* Faded look */
background-color: #f5f5f5; /* Light gray background (optional) */
color: #6a6e73; /* PatternFly disabled text color */
}
Loading