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
3 changes: 2 additions & 1 deletion learn2rag/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def configure_logging(config_path: pathlib.Path, debug: bool) -> None:
with open('config.yml', 'r') as f:
config = yaml.safe_load(f)
except FileNotFoundError:
print('No user config file (config.yml)')
print('You can create config.yml for more configuration options')
print('https://docs.learn2rag.de/en/basic/administrator/#advanced-configuration')

args, rest = LauncherArgumentParser().parse_known_args()
module = importlib.import_module(args.module)
Expand Down
3 changes: 1 addition & 2 deletions learn2rag/compose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def init_db(con: sqlite3.Connection) -> None:
try:
cur.execute(sql)
except sqlite3.OperationalError as e:
logger.warning('Database initialization: %s', e)
logger.debug('Database initialization: %s', e)


def process_running(pid: int) -> bool:
Expand All @@ -83,7 +83,6 @@ def process_running(pid: int) -> bool:


def healthy(value: list[str]) -> bool:
print(f"len(value) is {len(value)} and value is : {' '.join(value)}")
assert len(value) == 4
assert value[0:3] == ['CMD', 'curl' ,'-f']
url = value[3]
Expand Down
22 changes: 8 additions & 14 deletions learn2rag/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def get_locale() -> str:
return translation
babel.init_app(app, locale_selector=get_locale)

app.logger.info('create_app')
app.logger.debug('cwd: %s', os.getcwd())
app.logger.debug('root_path: %s', app.root_path)
assert app.template_folder is not None
Expand Down Expand Up @@ -393,14 +392,11 @@ def pipelines_list() -> 'str | werkzeug.wrappers.response.Response':
@app.post('/pipelines')
def pipeline_create() -> 'str | werkzeug.wrappers.response.Response':
label = request.form['label']
ports = [int(port) for port in request.form.getlist("ports") if port]
name = learn2rag.data.create_entry(app.instance_path, 'pipelines', {
'label': label,
'storage_path': request.form['storage_path'],
'language_model': request.form['language_model'],
'sources': request.form.getlist('sources'),
'ports': ports,
})
data: dict[str, Any] = request.form.to_dict()
data.pop('import', None)
data['ports'] = [int(port) for port in request.form.getlist("ports") if port]
data['sources'] = request.form.getlist('sources')
name = learn2rag.data.create_entry(app.instance_path, 'pipelines', data)
flash(pgettext('flash', 'Added a new pipeline configuration: %(label)s', label=label))
if request.form.get('import'):
pipeline = learn2rag.data.get_entry(app.instance_path, 'pipelines', name)
Expand Down Expand Up @@ -542,7 +538,6 @@ def shutdown_request() -> 'str | werkzeug.wrappers.response.Response':
threading.Thread(target=shutdown).start()
return pgettext('shutdown', 'Bye!') # type: ignore[no-any-return]

app.logger.info('App creation complete')
return app


Expand Down Expand Up @@ -593,13 +588,12 @@ def main(config: dict[str, Any]) -> None:
use_https = False
if ssl_key and ssl_cert:
if os.path.exists(ssl_key) and os.path.exists(ssl_cert):
logging.info(f" SSL files defined and found at {ssl_key} or {ssl_cert}")
logging.debug('TLS enabled')
use_https = True
else:
logging.error(f"Warning: SSL files defined but not found at {ssl_key} or {ssl_cert}")
raise FileNotFoundError(f"SSL files defined but not found at {ssl_key} or {ssl_cert}")
raise FileNotFoundError(f'The configured TLS files are not found: {ssl_key}, {ssl_cert}')
else:
logging.info(f"no SSL files provided then switch to HTTP mode")
logging.debug('TLS disabled')

protocol = 'https' if use_https else 'http'
url = f"{protocol}://localhost:{port}"
Expand Down
2 changes: 1 addition & 1 deletion learn2rag/ui/templates/compose/pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ports:
- qdrant_http
- pipeline
- open_webui_pipelines
ui_url: '{{learn2rag_scheme}}://{{learn2rag_hostname}}:{{ports.ui}}/'
ui_url: '{{ pipeline.chat_proxy_url or learn2rag_scheme ~ "://" ~ learn2rag_hostname ~ ":" ~ ports.ui ~ "/" }}'
files:
- path: '{{storage_path}}/qdrant_config.yml'
content: |
Expand Down
4 changes: 4 additions & 0 deletions learn2rag/ui/templates/pipelines_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</button>
</div>
<div class="mb-3 collapse advanced-configuration">
<div class="form-floating mb-3">
<input class="form-control" name="chat_proxy_url" type="url">
<label for="ports" class="form-label">{{pgettext('form_label', 'Chat proxy URL')}}</label>
</div>
<label for="ports" class="form-label">{{pgettext('form_label', 'Ports')}}</label>
<small class="text-body-secondary">{{gettext('Optional')}}</small>
<div>
Expand Down
Loading