Skip to content
Merged
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
4 changes: 2 additions & 2 deletions api-server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,8 @@ func (srv *ILabServer) serveModelHandler(modelPath, port string, w http.Response
}

cmdArgs := []string{
"serve", "model",
"--model", modelPath,
"serve",
"--model-path", modelPath,
"--host", "0.0.0.0",
"--port", port,
}
Expand Down
5 changes: 5 additions & 0 deletions deploy/podman/native/instructlab-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ spec:
secretKeyRef:
name: ui-env
key: IL_ENABLE_DEV_MODE
- name: NEXT_PUBLIC_API_SERVER
valueFrom:
secretKeyRef:
name: ui-env
key: NEXT_PUBLIC_API_SERVER
ports:
- containerPort: 3000
hostPort: 3000
Expand Down
2 changes: 2 additions & 0 deletions deploy/podman/native/secret.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ data:
NEXT_PUBLIC_TAXONOMY_ROOT_DIR: <TAXONOMY_ROOT_DIR>
NEXTAUTH_URL: <AUTH_URL>
NEXTAUTH_SECRET: <AUTH_SECRET>
NEXT_PUBLIC_API_SERVER: <API_SERVER_URL>

kind: Secret
metadata:
creationTimestamp: null
Expand Down
9 changes: 7 additions & 2 deletions installers/podman/ilab-ui-native-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ declare AUTH_SECRET="your_super_secret_random_string"
declare DEV_MODE="false"
declare EXPERIMENTAL_FEATURES=""
declare PYENV_DIR=""
declare API_SERVER_URL=""

BINARY_INSTALL_DIR=./
IS_ILAB_INSTALLED="true"
Expand Down Expand Up @@ -350,6 +351,8 @@ if [[ "$COMMAND" == "install" ]]; then
EXPERIMENTAL_FEATURES_B64=$(echo -n "false" | base64)
fi

API_SERVER_URL_B64=$(echo -n "$API_SERVER_URL" | base64)

# Download secret.yaml file
echo -e "${green}Downloading the secret.yaml sample file...${reset}\n"
curl -o secret.yaml https://raw.githubusercontent.com/instructlab/ui/main/deploy/podman/native/secret.yaml.example
Expand All @@ -370,6 +373,7 @@ if [[ "$COMMAND" == "install" ]]; then
sed -i "" "s|<AUTH_SECRET>|$AUTH_SECRET_B64|g" secret.yaml
sed -i "" "s|<DEV_MODE>|$DEV_MODE_B64|g" secret.yaml
sed -i "" "s|<EXPERIMENTAL_FEATURES>|$EXPERIMENTAL_FEATURES_B64|g" secret.yaml
sed -i "" "s|<API_SERVER_URL>|$API_SERVER_URL_B64|g" secret.yaml
else
sed -i "s|<UI_DEPLOYMENT>|$UI_DEPLOYMENT_B64|g" secret.yaml
sed -i "s|<USERNAME>|$USERNAME_B64|g" secret.yaml
Expand All @@ -379,6 +383,7 @@ if [[ "$COMMAND" == "install" ]]; then
sed -i "s|<AUTH_SECRET>|$AUTH_SECRET_B64|g" secret.yaml
sed -i "s|<DEV_MODE>|$DEV_MODE_B64|g" secret.yaml
sed -i "s|<EXPERIMENTAL_FEATURES>|$EXPERIMENTAL_FEATURES_B64|g" secret.yaml
sed -i "s|<API_SERVER_URL>|$API_SERVER_URL_B64|g" secret.yaml
fi

if [[ "$IS_ILAB_INSTALLED" == "true" ]]; then
Expand Down Expand Up @@ -420,7 +425,7 @@ if [[ "$COMMAND" == "install" ]]; then
# Check if VARIANT_ID is "rhel_ai"
if [ "$VARIANT_ID" == "rhel_ai" ]; then
echo -e "${green}Starting API server on OS: RHEL AI running on arch $ARCH ${reset}\n"
nohup ./ilab-apiserver --taxonomy-path "$SELECTED_TAXONOMY_DIR" --rhelai "$CUDA_FLAG" >$ILAB_APISERVER_LOG_FILE 2>&1 &
nohup ./ilab-apiserver --taxonomy-path "$SELECTED_TAXONOMY_DIR" --rhelai --vllm "$CUDA_FLAG" >$ILAB_APISERVER_LOG_FILE 2>&1 &
else
echo -e "${green}Starting API server on OS: $OS running on arch $ARCH ${reset}\n"
nohup ./ilab-apiserver --base-dir "$DISCOVERED_PYENV_DIR" --taxonomy-path "$SELECTED_TAXONOMY_DIR" "$CUDA_FLAG" >$ILAB_APISERVER_LOG_FILE 2>&1 &
Expand Down Expand Up @@ -479,7 +484,7 @@ elif [[ "$COMMAND" == "uninstall" ]]; then

read -r -p "Are you sure you want to uninstall the InstructLab UI stack? (yes/no): " CONFIRM
if [[ "$CONFIRM" != "yes" && "$CONFIRM" != "y" ]]; then
echo -e "${green}Uninstallation aborted.${reset}\n"
echo -e "${red}Uninstallation aborted.${reset}\n"
exit 0
fi

Expand Down
4 changes: 3 additions & 1 deletion src/app/api/envConfig/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export async function GET() {
ENABLE_DEV_MODE: process.env.IL_ENABLE_DEV_MODE || 'false',
EXPERIMENTAL_FEATURES: process.env.NEXT_PUBLIC_EXPERIMENTAL_FEATURES || '',
TAXONOMY_ROOT_DIR: process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '',
TAXONOMY_KNOWLEDGE_DOCUMENT_REPO: process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs'
TAXONOMY_KNOWLEDGE_DOCUMENT_REPO:
process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'https://github.com/instructlab-public/taxonomy-knowledge-docs',
API_SERVER: process.env.NEXT_PUBLIC_API_SERVER
};

return NextResponse.json(envConfig);
Expand Down
28 changes: 27 additions & 1 deletion src/app/api/fine-tune/git/branches/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import fs from 'fs';
import path from 'path';

const REMOTE_TAXONOMY_ROOT_DIR = process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '';
const REMOTE_TAXONOMY_REPO_CONTAINER_MOUNT_DIR = '/tmp/.instructlab-ui';

export async function GET() {
const REPO_DIR = path.join(REMOTE_TAXONOMY_ROOT_DIR, '/taxonomy');
const REPO_DIR = findTaxonomyRepoPath();
try {
console.log(`Checking local taxonomy directory for branches: ${REPO_DIR}`);

Expand Down Expand Up @@ -63,3 +64,28 @@ export async function GET() {
return NextResponse.json({ error: 'Failed to list branches from local taxonomy (fine-tune)' }, { status: 500 });
}
}

function findTaxonomyRepoPath(): string {
let remoteTaxonomyRepoDirFinal: string = '';

const remoteTaxonomyRepoContainerMountDir = path.join(REMOTE_TAXONOMY_REPO_CONTAINER_MOUNT_DIR, '/taxonomy');
const remoteTaxonomyRepoDir = path.join(REMOTE_TAXONOMY_ROOT_DIR, '/taxonomy');

// Check if there is taxonomy repository mounted in the container
if (fs.existsSync(remoteTaxonomyRepoContainerMountDir) && fs.readdirSync(remoteTaxonomyRepoContainerMountDir).length !== 0) {
remoteTaxonomyRepoDirFinal = remoteTaxonomyRepoContainerMountDir;
console.log('Remote taxonomy repository ', remoteTaxonomyRepoDir, ' is mounted at:', remoteTaxonomyRepoDirFinal);
} else {
// If remote taxonomy is not mounted, it means it's local deployment and we can directly use the paths
if (fs.existsSync(remoteTaxonomyRepoDir) && fs.readdirSync(remoteTaxonomyRepoDir).length !== 0) {
remoteTaxonomyRepoDirFinal = remoteTaxonomyRepoDir;
}
}
if (remoteTaxonomyRepoDirFinal === '') {
console.warn('Remote taxonomy repository path does not exist.');
return remoteTaxonomyRepoDirFinal;
}

console.log('Remote taxonomy repository path:', remoteTaxonomyRepoDirFinal);
return remoteTaxonomyRepoDirFinal;
}
2 changes: 1 addition & 1 deletion src/app/api/github/knowledge-files/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getToken } from 'next-auth/jwt';

const GITHUB_API_URL = 'https://api.github.com';
const TAXONOMY_DOCUMENTS_REPO = process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs';
const TAXONOMY_DOCUMENTS_REPO = process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'https://github.com/instructlab-public/taxonomy-knowledge-docs';
const BASE_BRANCH = 'main';

// Interface for the response
Expand Down
7 changes: 4 additions & 3 deletions src/app/api/native/git/knowledge-files/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import http from 'isomorphic-git/http/node';
// Constants for repository paths
const TAXONOMY_DOCS_ROOT_DIR = process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '';
const TAXONOMY_DOCS_CONTAINER_MOUNT_DIR = '/tmp/.instructlab-ui';
const TAXONOMY_KNOWLEDGE_DOCS_REPO_URL = process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs';
const TAXONOMY_KNOWLEDGE_DOCS_REPO_URL =
process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'https://github.com/instructlab-public/taxonomy-knowledge-docs';
const BASE_BRANCH = 'main';

// Interface for the response
Expand Down Expand Up @@ -223,10 +224,10 @@ async function cloneTaxonomyDocsRepo() {
const taxonomyDocsDirectoryPath = path.join(remoteTaxonomyRepoDirFinal, '/taxonomy-knowledge-docs');

if (fs.existsSync(taxonomyDocsDirectoryPath)) {
console.log(`Using existing taxonomy knowledge docs repository at ${remoteTaxonomyRepoDir}/taxonomy-knowledge-docs.`);
console.log(`Using existing taxonomy knowledge docs repository at ${TAXONOMY_DOCS_ROOT_DIR}/taxonomy-knowledge-docs.`);
return taxonomyDocsDirectoryPath;
} else {
console.log(`Taxonomy knowledge docs repository not found at ${taxonomyDocsDirectoryPath}. Cloning...`);
console.log(`Taxonomy knowledge docs repository not found at ${TAXONOMY_DOCS_ROOT_DIR}/taxonomy-knowledge-docs. Cloning...`);
}

try {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/playground/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function POST(req: NextRequest) {

const requestData = {
model: modelName,
messages,
messages: messages,
stream: true
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ const DocumentInformation: React.FC<Props> = ({
if (response.status === 201) {
const result = await response.json();
console.log('Files uploaded result:', result);
setKnowledgeDocumentRepositoryUrl(result.repoUrl);
setKnowledgeDocumentCommit(result.commitSha);
setDocumentName(result.documentNames.join(', ')); // Populate the patterns field

const alertInfo: AlertInfo = {
type: 'success',
Expand Down
Loading
Loading