Skip to content

Commit 438d10b

Browse files
a-klosgithub-actions[bot]Copilot
authored
feat: add Confluence integration with configurable parameters to admin-frontend (#19)
* feat: add Confluence integration with configurable parameters for document loading * chore: update submodules to latest main * feat: enable MinIO feature in Helm chart configuration and remove default max pages limit in document upload * feat: add pytest configuration and update testing setup across multiple components * Update frontend/libs/i18n/admin/en.json Co-authored-by: Copilot <[email protected]> * feat: enhance Confluence upload form with additional input fields and labels --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
1 parent e3e1fcc commit 438d10b

File tree

16 files changed

+125
-33
lines changed

16 files changed

+125
-33
lines changed

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"name": "Debug Pytest (current file)",
6+
"type": "python",
7+
"request": "launch",
8+
"python": "${command:python.interpreterPath}",
9+
// run pytest as a module
10+
"module": "pytest",
11+
"args": [
12+
"--maxfail=1",
13+
"--disable-warnings",
14+
"-q",
15+
"${file}"
16+
],
17+
"console": "integratedTerminal",
18+
"justMyCode": false,
19+
},
420
{
521
"name": "rag_backend",
622
"type": "python",

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
"./rag-core-library/rag-core-api/src",
77
"./rag-core-library/rag-core-lib/src",
88
"./rag-core-library/extractor-api-lib/src",
9+
"./admin-backend",
10+
"./rag-backend",
11+
"./document-extractor"
912
],
1013
"[yaml]": {
1114
"editor.tabSize": 2,
1215
"editor.insertSpaces": true,
1316
"editor.formatOnType": true,
1417
"editor.autoIndent": "advanced"
1518
},
19+
"python.testing.pytestEnabled": true,
20+
"python.testing.unittestEnabled": false,
21+
"python.testing.pytestArgs": ["--import-mode","importlib"],
22+
"python.testing.autoTestDiscoverOnSaveEnabled": true,
23+
"python.envFile": "${workspaceFolder}/.env",
24+
"python-envs.defaultEnvManager": "ms-python.python:conda",
25+
"python-envs.defaultPackageManager": "ms-python.python:conda",
26+
"python-envs.pythonProjects": [],
1627
}

admin-backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ COPY admin-backend/pyproject.toml admin-backend/poetry.lock ./
1919
RUN mkdir log && chmod 700 log
2020
RUN touch /app/admin-backend/log/logfile.log && chmod 600 /app/admin-backend/log/logfile.log
2121

22-
RUN poetry config virtualenvs.create false &&\
22+
RUN poetry config virtualenvs.create false && \
2323
if [ "$dev" = "1" ]; then \
2424
poetry install --no-interaction --no-ansi --no-root --with dev; \
2525
else \

admin-backend/poetry.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
import os
3+
from pathlib import Path
4+
5+
# Add project root and specific directories to Python path
6+
project_root = Path(__file__).parent
7+
sys.path.insert(0, str(project_root))
8+
sys.path.insert(0, str(project_root / "admin-backend"))
9+
sys.path.insert(0, str(project_root / "rag-backend"))
10+
sys.path.insert(0, str(project_root / "document-extractor"))
11+
12+
# point at each rag-core library's src folder so their packages (admin_api_lib, rag_core_api, etc.) are importable
13+
lib_root = project_root / "rag-core-library"
14+
for lib in ["admin-api-lib", "rag-core-api", "rag-core-lib", "extractor-api-lib"]:
15+
sys.path.insert(0, str(lib_root / lib / "src"))

document-extractor/poetry.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

frontend/libs/admin-app/data-access/+state/documents.store.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ref } from 'vue';
33
import { DocumentModel } from "../../models/document.model.ts";
44
import { ErrorType } from "../../models/error-type";
55
import { UploadedDocument, mapToUploadDocument } from "../../models/uploaded-document.model";
6-
import { DocumentAPI } from "../document.api";
6+
import { DocumentAPI, ConfluenceConfig } from "../document.api";
77

88
export const useDocumentsStore = defineStore('chat', () => {
99
const uploadedDocuments = ref<UploadedDocument[]>([]);
@@ -52,11 +52,12 @@ export const useDocumentsStore = defineStore('chat', () => {
5252
}
5353
};
5454

55-
const loadConfluence = async () => {
55+
const loadConfluence = async (config: ConfluenceConfig) => {
5656
isLoadingConfluence.value = true;
5757
error.value = null;
5858
try {
59-
await DocumentAPI.loadConfluence();
59+
// provide confluence configuration from frontend
60+
await DocumentAPI.loadConfluence(config);
6061
await loadDocuments(); // Refresh the document list after uploading
6162
} catch(err) {
6263
if (err.response && err.response.status === 501) {

frontend/libs/admin-app/data-access/document.api.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ axios.defaults.auth = {
77
password: import.meta.env.VITE_AUTH_PASSWORD
88
};
99

10+
// confluence configuration interface
11+
export interface ConfluenceConfig {
12+
spaceKey: string;
13+
token: string;
14+
url: string;
15+
maxPages: number;
16+
name: string;
17+
}
18+
1019
export class DocumentAPI {
1120
static async loadDocuments(): Promise<DocumentModel[]> {
1221
try {
@@ -20,9 +29,9 @@ export class DocumentAPI {
2029
static async uploadDocument(file: File, onUploadProgress: (progressEvent: AxiosProgressEvent) => void): Promise<null> {
2130
try {
2231
const formData = new FormData();
23-
formData.append('body', file);
32+
formData.append('file', file);
2433

25-
const response = await axios.post<null>('/upload_documents', formData, {
34+
const response = await axios.post<null>('/upload_file', formData, {
2635
headers: {
2736
'Content-Type': 'multipart/form-data'
2837
},
@@ -35,9 +44,19 @@ export class DocumentAPI {
3544
}
3645
}
3746

38-
static async loadConfluence(): Promise<void> {
47+
static async loadConfluence(config: ConfluenceConfig): Promise<void> {
3948
try {
40-
await axios.post<void>('/load_confluence');
49+
// convert config to list of key/value items for backend
50+
const payload = [
51+
{ key: 'url', value: config.url },
52+
{ key: 'token', value: config.token },
53+
{ key: 'space_key', value: config.spaceKey },
54+
{ key: 'max_pages', value: String(config.maxPages) }
55+
];
56+
// include required query parameters
57+
await axios.post<void>('/upload_source', payload, {
58+
params: { source_type: 'confluence', name: config.name }
59+
});
4160
} catch(error) {
4261
this.handleError(error);
4362
}

0 commit comments

Comments
 (0)