feat: Enable dual-GPU in RAG modelfile and add API key to upload script
This commit is contained in:
@@ -3,6 +3,10 @@ FROM gpt-oss:20b
|
||||
# Set the system prompt
|
||||
SYSTEM """You are a specialized assistant for the rushg.me knowledge base. Your goal is to answer questions based *only* on the context provided to you. If the information needed to answer the question is not in the context, you must state that you do not have enough information to answer. Do not use any of your prior knowledge or external information."""
|
||||
|
||||
# --- GPU Splitting Configuration ---
|
||||
# This parameter tells Ollama how many layers to put on each GPU.
|
||||
PARAMETER num_gpu 2
|
||||
|
||||
# Set the template for how the prompt will be structured
|
||||
TEMPLATE """{{- if .System }}
|
||||
### System:
|
||||
|
||||
39
scripts/upload_to_openwebui.py
Normal file
39
scripts/upload_to_openwebui.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import os
|
||||
import requests
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
# Configuration
|
||||
OPENWEBUI_URL = "http://192.168.1.2:31028" # From AGENTS.full.md, the port is 31028
|
||||
API_KEY = "sk-609c9c4e941b487389a12b675742e288" # Placeholder
|
||||
SOURCE_DIRECTORY = "/mnt/storage.rushg.me/data/z5/rushg.me"
|
||||
|
||||
async def upload_files():
|
||||
"""
|
||||
Uploads all files from the source directory to OpenWebUI.
|
||||
"""
|
||||
headers = {"Authorization": f"Bearer {API_KEY}"}
|
||||
files_to_upload = []
|
||||
for root, _, files in os.walk(SOURCE_DIRECTORY):
|
||||
for file in files:
|
||||
files_to_upload.append(os.path.join(root, file))
|
||||
|
||||
for file_path in files_to_upload:
|
||||
try:
|
||||
with open(file_path, "rb") as f:
|
||||
files = {"file": (os.path.basename(file_path), f)}
|
||||
response = requests.post(f"{OPENWEBUI_URL}/api/v1/files", headers=headers, files=files)
|
||||
response.raise_for_status()
|
||||
print(f"Successfully uploaded {file_path}")
|
||||
except Exception as e:
|
||||
print(f"Failed to upload {file_path}: {e}")
|
||||
|
||||
async def main():
|
||||
print("This script requires an OpenWebUI API key.")
|
||||
# I will need the user to provide this.
|
||||
# For now, I will not run this script, but I'm creating it as part of the plan.
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
# asyncio.run(main())
|
||||
pass
|
||||
Reference in New Issue
Block a user