Hermes Agent commited on
Commit
ea55af8
·
1 Parent(s): 1d5262c

perf(openwebui): switch rag embedding engine to lightweight openai api mode via omniroute

Browse files
Files changed (1) hide show
  1. entrypoint.sh +10 -9
entrypoint.sh CHANGED
@@ -405,7 +405,7 @@ if command -v open-webui >/dev/null 2>&1; then
405
  echo "[PERSISTENCE] Restored Open WebUI database snapshot ($(wc -c < /data/open-webui/webui.db | tr -d ' ') bytes)."
406
  fi
407
 
408
- # Clean up legacy RAG embedding model 'none' or empty from webui.db if present
409
  python3 -c "
410
  import sqlite3, json
411
  for path in ['/root/.open-webui/webui.db', '/root/.open-webui/data/webui.db', '/data/open-webui/webui.db']:
@@ -416,13 +416,12 @@ for path in ['/root/.open-webui/webui.db', '/root/.open-webui/data/webui.db', '/
416
  row = cursor.fetchone()
417
  if row:
418
  data = json.loads(row[1])
419
- if data.get('embedding_model') in ('none', '', None):
420
- data['embedding_model'] = 'all-MiniLM-L6-v2'
421
- if data.get('embedding_engine') in ('none', '', None):
422
- data['embedding_engine'] = 'sentence_transformers'
423
  cursor.execute('UPDATE config SET data = ? WHERE id = \"rag\"', (json.dumps(data),))
424
  conn.commit()
425
- print(f'[FIX] Cleaned RAG config in {path}')
426
  conn.close()
427
  except Exception:
428
  pass
@@ -453,9 +452,11 @@ for path in ['/root/.open-webui/webui.db', '/root/.open-webui/data/webui.db', '/
453
  export WEBSOCKET_REDIS_URL="redis://127.0.0.1:6379/1"
454
  export WEBUI_WORKERS=1
455
  export BYPASS_EMBEDDING_AND_RETRIEVAL="true"
456
- export RAG_EMBEDDING_ENGINE="sentence_transformers"
457
- export RAG_EMBEDDING_MODEL="sentence-transformers/all-MiniLM-L6-v2"
458
- export VECTOR_DB_EMBEDDING_FUNCTION="sentence_transformers"
 
 
459
  export RAG_RERANKING_MODEL=""
460
  export ENABLE_RAG_HYBRID_SEARCH="false"
461
  export ENABLE_RAG_LOCAL_WEB_FETCH="false"
 
405
  echo "[PERSISTENCE] Restored Open WebUI database snapshot ($(wc -c < /data/open-webui/webui.db | tr -d ' ') bytes)."
406
  fi
407
 
408
+ # Configure lightweight OpenAI API RAG embedding engine in webui.db
409
  python3 -c "
410
  import sqlite3, json
411
  for path in ['/root/.open-webui/webui.db', '/root/.open-webui/data/webui.db', '/data/open-webui/webui.db']:
 
416
  row = cursor.fetchone()
417
  if row:
418
  data = json.loads(row[1])
419
+ data['embedding_engine'] = 'openai'
420
+ data['embedding_model'] = 'text-embedding-3-small'
421
+ data['openai_config'] = {'url': 'http://127.0.0.1:20128/v1', 'key': 'sk-omniroute'}
 
422
  cursor.execute('UPDATE config SET data = ? WHERE id = \"rag\"', (json.dumps(data),))
423
  conn.commit()
424
+ print(f'[LIGHTWEIGHT] Pinned OpenAI API RAG config in {path}')
425
  conn.close()
426
  except Exception:
427
  pass
 
452
  export WEBSOCKET_REDIS_URL="redis://127.0.0.1:6379/1"
453
  export WEBUI_WORKERS=1
454
  export BYPASS_EMBEDDING_AND_RETRIEVAL="true"
455
+ export RAG_EMBEDDING_ENGINE="openai"
456
+ export RAG_OPENAI_API_BASE_URL="http://127.0.0.1:20128/v1"
457
+ export RAG_OPENAI_API_KEY="sk-omniroute"
458
+ export RAG_EMBEDDING_MODEL="text-embedding-3-small"
459
+ export VECTOR_DB_EMBEDDING_FUNCTION="openai"
460
  export RAG_RERANKING_MODEL=""
461
  export ENABLE_RAG_HYBRID_SEARCH="false"
462
  export ENABLE_RAG_LOCAL_WEB_FETCH="false"