Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat(oss): add OSS configuration UI and connectivity test

bingxiang.cheng43704a1eeb01
diff --git a/frontend/src/views/settings/StorageEngineSettings.vue b/frontend/src/views/settings/StorageEngineSettings.vue
index 405b74ce7..97ece2df4 100644
--- a/frontend/src/views/settings/StorageEngineSettings.vue
+++ b/frontend/src/views/settings/StorageEngineSettings.vue
@@ -34,6 +34,7 @@
<t-option value="cos" :label="$t('settings.storage.engineCos')" />
<t-option value="tos" :label="$t('settings.storage.engineTos')" />
<t-option value="s3" label="AWS S3" />
+ <t-option value="oss" label="阿里云 OSS" />
</t-select>
</div>
</div>
@@ -422,6 +423,80 @@
</div>
</div>
+ <!-- OSS -->
+ <div class="engine-section" data-model-type="oss">
+ <div class="engine-header">
+ <div class="engine-header-info">
+ <div class="engine-title-row">
+ <h3>阿里云 OSS</h3>
+ <t-tag theme="success" variant="light" size="small">{{ $t('settings.storage.configurable') }}</t-tag>
+ </div>
+ <p>
+ 阿里云对象存储服务
+ <a class="engine-link" href="https://oss.console.aliyun.com/" target="_blank" rel="noopener">控制台</a>
+ <a class="engine-link" href="https://help.aliyun.com/zh/oss/" target="_blank" rel="noopener">文档</a>
+ </p>
+ </div>
+ </div>
+ <div class="engine-form">
+ <div class="form-field">
+ <label>Endpoint</label>
+ <t-input
+ v-model="config.oss.endpoint"
+ placeholder="e.g. https://oss-cn-hangzhou.aliyuncs.com"
+ clearable
+ />
+ </div>
+ <div class="form-field">
+ <label>Region</label>
+ <t-input
+ v-model="config.oss.region"
+ placeholder="e.g. cn-hangzhou"
+ clearable
+ />
+ </div>
+ <div class="form-field">
+ <label>Access Key</label>
+ <t-input
+ v-model="config.oss.access_key"
+ :placeholder="$t('settings.storage.tosAccessKeyPlaceholder')"
+ clearable
+ />
+ </div>
+ <div class="form-field">
+ <label>Secret Key</label>
+ <t-input
+ v-model="config.oss.secret_key"
+ type="password"
+ :placeholder="$t('settings.storage.tosSecretKeyPlaceholder')"
+ clearable
+ />
+ </div>
+ <div class="form-field">
+ <label>{{ $t('settings.storage.bucketName') }}</label>
+ <t-input
+ v-model="config.oss.bucket_name"
+ :placeholder="$t('settings.storage.bucketPlaceholder')"
+ clearable
+ />
+ </div>
+ <div class="form-field">
+ <label>{{ $t('settings.storage.pathPrefix') }}</label>
+ <t-input
+ v-model="config.oss.path_prefix"
+ :placeholder="$t('settings.storage.prefixPlaceholder')"
+ clearable
+ />
+ </div>
+ </div>
+ <div class="test-bar">
+ <t-button size="small" variant="outline" :loading="checkingOss" @click="onCheckOss">{{ $t('settings.storage.testConnection') }}</t-button>
+ <span v-if="ossCheckResult" :class="['test-msg', ossCheckResult.ok ? 'success' : 'error']">
+ {{ ossCheckResult.message }}
+ </span>
+ </div>
+ </div>
+
<!-- Save -->
<div class="save-bar">
<t-button theme="primary" :loading="saving" @click="onSave">{{ $t('settings.storage.saveConfig') }}</t-button>
@@ -476,6 +551,17 @@ const defaultConfig = (): StorageEngineConfig => ({
bucket_name: '',
path_prefix: '',
},
+ oss: {
+ endpoint: '',
+ region: '',
+ access_key: '',
+ secret_key: '',
+ bucket_name: '',
+ path_prefix: '',
+ use_temp_bucket: false,
+ temp_bucket_name: '',
+ temp_region: '',
+ },
})
const loading = ref(true)
@@ -501,6 +587,8 @@ const checkingTos = ref(false)
const tosCheckResult = ref<{ ok: boolean; message: string } | null>(null)
const checkingS3 = ref(false)
const s3CheckResult = ref<{ ok: boolean; message: string } | null>(null)
+const checkingOss = ref(false)
+const ossCheckResult = ref<{ ok: boolean; message: string } | null>(null)
const minioAvailable = computed(() => {
if (config.value.minio?.mode === 'remote') {
@@ -558,6 +646,19 @@ async function loadConfig() {
path_prefix: d.s3.path_prefix || '',
}
: defaultConfig().s3!,
+ oss: d.oss
+ ? {
+ endpoint: d.oss.endpoint || '',
+ region: d.oss.region || '',
+ access_key: d.oss.access_key || '',
+ secret_key: d.oss.secret_key || '',
+ bucket_name: d.oss.bucket_name || '',
+ path_prefix: d.oss.path_prefix || '',
+ use_temp_bucket: d.oss.use_temp_bucket ?? false,
+ temp_bucket_name: d.oss.temp_bucket_name || '',
+ temp_region: d.oss.temp_region || '',
+ }
+ : defaultConfig().oss!,
}
}
} catch {
@@ -649,6 +750,17 @@ function buildPayload(): StorageEngineConfig {
bucket_name: (config.value.s3?.bucket_name || '').trim(),
path_prefix: (config.value.s3?.path_prefix || '').trim(),
},
+ oss: {
+ endpoint: (config.value.oss?.endpoint || '').trim(),
+ region: (config.value.oss?.region || '').trim(),
+ access_key: (config.value.oss?.access_key || '').trim(),
+ secret_key: (config.value.oss?.secret_key || '').trim(),
+ bucket_name: (config.value.oss?.bucket_name || '').trim(),
+ path_prefix: (config.value.oss?.path_prefix || '').trim(),
+ use_temp_bucket: config.value.oss?.use_temp_bucket ?? false,
+ temp_bucket_name: (config.value.oss?.temp_bucket_name || '').trim(),
+ temp_region: (config.value.oss?.temp_region || '').trim(),
+ },
}
}
@@ -728,6 +840,20 @@ async function onCheckS3() {
}
}
+async function onCheckOss() {
+ checkingOss.value = true
+ ossCheckResult.value = null
+ try {
+ const payload = buildPayload()
+ const res = await checkStorageEngine({ provider: 'oss', oss: payload.oss })
+ ossCheckResult.value = res?.data ?? { ok: false, message: t('settings.storage.unknownError') }
+ } catch (e: unknown) {
+ ossCheckResult.value = { ok: false, message: e instanceof Error ? e.message : t('settings.storage.requestFailed') }
+ } finally {
+ checkingOss.value = false
+ }
+}
+
onMounted(loadAll)
</script>