epam / epam/statgpt-backend

Add DIAL file upload endpoint to Admin API

Open
#96 0 comments 0 reactions 1 assignee Claimed by @kryachkow View on GitHub
enhancement
Dominant language
Python
Stars
26
Forks
1
Avg merge
1d 17h
Merged PRs (30d)
25

Description

### StatGPT Backend version

0.2.0

### What is the problem this feature will solve?

Currently, the CLI module (`statgpt/cli/commands/content.py`) directly uploads files to DIAL storage using the `dial_core_factory` utility. This creates a direct dependency between the CLI and DIAL Core API, requiring:

- DIAL credentials (`STATGPT_CLI_DIAL_URL`, `STATGPT_CLI_DIAL_API_KEY`) to be configured in the CLI environment.
- The CLI to have network access to the DIAL API.
- Duplicated DIAL integration logic between CLI and the main application.
- Use the same credential as for the application to ensure it has access to the uploaded files.

Current implementation location: `statgpt/cli/commands/content.py:270-311` (`_upload_dial_files` function)

### What is the proposed feature or solution?

Add a new endpoint to the Admin API that accepts file uploads and stores them in DIAL storage. The CLI will then use this endpoint instead of connecting to DIAL directly.

#### Implementation details

1. Create new router in `statgpt/admin/routers/`
2. Use existing `dial_core_factory` from `statgpt/common/utils/dial/core.py`
3. Require OIDC authentication (same as other admin endpoints)
4. The admin backend already has DIAL credentials configured (`DIAL_URL`, `DIAL_API_KEY`)

#### CLI changes

1. Update `_upload_dial_files` in `statgpt/cli/commands/content.py` to:
- Call the new admin endpoint for each file (single file upload, CLI iterates)
- Remove direct `dial_core_factory` usage
- Remove `STATGPT_CLI_DIAL_URL` and `STATGPT_CLI_DIAL_API_KEY` settings

### What alternatives have you considered?

1. Keep current implementation - CLI continues to upload directly to DIAL. Rejected because it requires CLI to have DIAL credentials and network access.
2. Batch upload endpoint - Accept multiple files in one request. Could be added later if performance becomes an issue, but single-file upload is simpler and matches current iteration pattern.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.