Merge upstream main and resolve conflicts
This commit is contained in:
+46
-1
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted } from 'vue'
|
||||
import { computed, nextTick, onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import ManualKnowledgeEditor from '@/components/manual-knowledge-editor.vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useSettingsStore } from '@/stores/settings'
|
||||
import { getCurrentUser } from '@/api/auth'
|
||||
|
||||
// TDesign locale configs
|
||||
@@ -16,6 +17,7 @@ import ruRUConfig from 'tdesign-vue-next/esm/locale/ru_RU'
|
||||
const { locale } = useI18n()
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const tdLocaleMap: Record<string, object> = {
|
||||
'en-US': enUSConfig,
|
||||
@@ -132,9 +134,40 @@ const handleGlobalOIDCCallback = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
let updateCheckTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
onMounted(() => {
|
||||
handleGlobalOIDCCallback()
|
||||
|
||||
// Auto check for updates on startup
|
||||
setTimeout(() => {
|
||||
if (settingsStore.isAutoCheckUpdateEnabled) {
|
||||
// @ts-ignore
|
||||
if (window.go && window.go.main && window.go.main.App && window.go.main.App.AutoCheckForUpdates) {
|
||||
// @ts-ignore
|
||||
window.go.main.App.AutoCheckForUpdates()
|
||||
}
|
||||
}
|
||||
}, 2000)
|
||||
|
||||
// Periodically check for updates (every 4 hours)
|
||||
updateCheckTimer = setInterval(() => {
|
||||
if (settingsStore.isAutoCheckUpdateEnabled) {
|
||||
// @ts-ignore
|
||||
if (window.go && window.go.main && window.go.main.App && window.go.main.App.AutoCheckForUpdates) {
|
||||
// @ts-ignore
|
||||
window.go.main.App.AutoCheckForUpdates()
|
||||
}
|
||||
}
|
||||
}, 4 * 60 * 60 * 1000)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (updateCheckTimer) {
|
||||
clearInterval(updateCheckTimer)
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<t-config-provider :globalConfig="tdGlobalConfig">
|
||||
@@ -145,6 +178,11 @@ onMounted(() => {
|
||||
</t-config-provider>
|
||||
</template>
|
||||
<style>
|
||||
html {
|
||||
/* 提示 UA 使用对应配色绘制滚动条等,减少主题切换时的额外重绘 */
|
||||
color-scheme: light dark;
|
||||
}
|
||||
|
||||
body,
|
||||
html,
|
||||
#app {
|
||||
@@ -160,4 +198,11 @@ html,
|
||||
background: var(--td-bg-color-page);
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
#app {
|
||||
/* 独立合成层,减轻 WebKit 全量重绘时整窗与内容的撕裂感(桌面 WebView 尤其明显) */
|
||||
isolation: isolate;
|
||||
transform: translateZ(0);
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -49,6 +49,7 @@ export interface CustomAgentConfig {
|
||||
|
||||
// ===== 网络搜索设置 =====
|
||||
web_search_enabled?: boolean;
|
||||
web_search_provider_id?: string;
|
||||
web_search_max_results?: number;
|
||||
|
||||
// ===== 多轮对话设置 =====
|
||||
@@ -184,10 +185,10 @@ export interface IMChannel {
|
||||
id: string;
|
||||
tenant_id?: number;
|
||||
agent_id: string;
|
||||
platform: 'wecom' | 'feishu' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost';
|
||||
platform: 'wecom' | 'feishu' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost' | 'wechat';
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
mode: 'webhook' | 'websocket';
|
||||
mode: 'webhook' | 'websocket' | 'longpoll';
|
||||
output_mode: 'stream' | 'full';
|
||||
session_mode?: 'user' | 'thread';
|
||||
knowledge_base_id?: string;
|
||||
@@ -238,3 +239,27 @@ export function getSuggestedQuestions(
|
||||
const qs = query.toString();
|
||||
return get<{ data: { questions: SuggestedQuestion[] } }>(`/api/v1/agents/${agentId}/suggested-questions${qs ? '?' + qs : ''}`);
|
||||
}
|
||||
// ===== WeChat QR Code Login =====
|
||||
|
||||
export interface WeChatQRCodeResult {
|
||||
qrcode_url: string;
|
||||
qrcode: string;
|
||||
}
|
||||
|
||||
export interface WeChatQRCodeStatus {
|
||||
status: 'wait' | 'scaned' | 'confirmed' | 'expired';
|
||||
credentials?: {
|
||||
bot_token: string;
|
||||
ilink_bot_id: string;
|
||||
ilink_user_id: string;
|
||||
};
|
||||
baseurl?: string;
|
||||
}
|
||||
|
||||
export function getWeChatQRCode() {
|
||||
return post<{ data: WeChatQRCodeResult }>('/api/v1/wechat/qrcode');
|
||||
}
|
||||
|
||||
export function pollWeChatQRCodeStatus(qrcode: string) {
|
||||
return post<{ data: WeChatQRCodeStatus }>('/api/v1/wechat/qrcode/status', { qrcode });
|
||||
}
|
||||
|
||||
@@ -190,6 +190,21 @@ export async function register(data: RegisterRequest): Promise<RegisterResponse>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lite 版自动初始化(创建默认用户/租户 + 签发令牌)
|
||||
*/
|
||||
export async function autoSetup(): Promise<LoginResponse> {
|
||||
try {
|
||||
const response = await post('/api/v1/auth/auto-setup', {})
|
||||
return response as unknown as LoginResponse
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
message: error.message || 'Auto-setup unavailable'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
||||
import { ref, type Ref, onUnmounted, nextTick } from 'vue'
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source';
|
||||
import { ref, onUnmounted } from 'vue';
|
||||
import { generateRandomString } from '@/utils/index';
|
||||
import i18n from '@/i18n';
|
||||
import { getApiBaseUrl } from '@/utils/api-base';
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +38,7 @@ export function useStream() {
|
||||
isLoading.value = true;
|
||||
|
||||
// 获取API配置
|
||||
const apiUrl = import.meta.env.VITE_IS_DOCKER ? "" : "http://localhost:8080";
|
||||
const apiUrl = getApiBaseUrl();
|
||||
|
||||
// 获取JWT Token
|
||||
const token = localStorage.getItem('weknora_token');
|
||||
|
||||
@@ -255,6 +255,7 @@ export function checkRemoteModel(modelConfig: {
|
||||
modelName: string;
|
||||
baseUrl: string;
|
||||
apiKey?: string;
|
||||
provider?: string;
|
||||
}): Promise<{
|
||||
available: boolean;
|
||||
message?: string;
|
||||
|
||||
@@ -126,3 +126,45 @@ export function deleteModel(id: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
export interface InitializeWeKnoraCloudRequest {
|
||||
app_id: string
|
||||
app_secret: string
|
||||
}
|
||||
|
||||
export interface InitializeWeKnoraCloudResult {
|
||||
models: Array<{
|
||||
name: string
|
||||
type: string
|
||||
action: 'created' | 'updated'
|
||||
}>
|
||||
}
|
||||
|
||||
export function initializeWeKnoraCloud(data: InitializeWeKnoraCloudRequest): Promise<InitializeWeKnoraCloudResult> {
|
||||
return post('/api/v1/models/weknoracloud/initialize', data) as Promise<InitializeWeKnoraCloudResult>
|
||||
}
|
||||
|
||||
export interface WeKnoraCloudStatusResult {
|
||||
has_models: boolean
|
||||
needs_reinit: boolean
|
||||
reason?: string
|
||||
}
|
||||
|
||||
export function getWeKnoraCloudStatus(): Promise<WeKnoraCloudStatusResult> {
|
||||
return new Promise((resolve, reject) => {
|
||||
get('/api/v1/models/weknoracloud/status')
|
||||
.then((response: any) => {
|
||||
// status 接口直接返回对象,不包在 success/data 中
|
||||
if (response && typeof response.has_models === 'boolean') {
|
||||
resolve(response)
|
||||
} else if (response?.success && response?.data) {
|
||||
resolve(response.data)
|
||||
} else {
|
||||
resolve({ has_models: false, needs_reinit: false })
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
resolve({ has_models: false, needs_reinit: false })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ export function reconnectDocReader(addr: string): Promise<ParserEnginesResponse
|
||||
// ---- 存储引擎配置(租户级,供文档/图片存储与 docreader 使用) ----
|
||||
|
||||
export interface StorageEngineConfig {
|
||||
default_provider: string // "local" | "minio" | "cos" | "tos" | "s3"
|
||||
default_provider: string // "local" | "minio" | "cos" | "tos" | "s3" | "oss"
|
||||
local?: { path_prefix: string }
|
||||
minio?: { mode: string; endpoint: string; access_key_id: string; secret_access_key: string; bucket_name: string; use_ssl: boolean; path_prefix: string }
|
||||
cos?: {
|
||||
@@ -210,6 +210,17 @@ export interface StorageEngineConfig {
|
||||
bucket_name: string
|
||||
path_prefix: string
|
||||
}
|
||||
oss?: {
|
||||
endpoint: string
|
||||
region: string
|
||||
access_key: string
|
||||
secret_key: string
|
||||
bucket_name: string
|
||||
path_prefix: string
|
||||
use_temp_bucket: boolean
|
||||
temp_bucket_name: string
|
||||
temp_region: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface StorageEngineStatusItem {
|
||||
@@ -236,11 +247,12 @@ export function getStorageEngineStatus(): Promise<{ data: GetStorageEngineStatus
|
||||
}
|
||||
|
||||
export interface StorageCheckRequest {
|
||||
provider: string // "minio" | "cos" | "tos" | "s3"
|
||||
provider: string // "minio" | "cos" | "tos" | "s3" | "oss"
|
||||
minio?: StorageEngineConfig['minio']
|
||||
cos?: StorageEngineConfig['cos']
|
||||
tos?: StorageEngineConfig['tos']
|
||||
s3?: StorageEngineConfig['s3']
|
||||
oss?: StorageEngineConfig['oss']
|
||||
}
|
||||
|
||||
export interface StorageCheckResponse {
|
||||
|
||||
@@ -5,7 +5,7 @@ export interface WebSearchProviderEntity {
|
||||
id?: string
|
||||
tenant_id?: number
|
||||
name: string
|
||||
provider: 'bing' | 'google' | 'duckduckgo' | 'tavily'
|
||||
provider: 'bing' | 'google' | 'duckduckgo' | 'tavily' | 'ollama' | 'baidu'
|
||||
description?: string
|
||||
parameters: {
|
||||
api_key?: string
|
||||
|
||||
@@ -89,13 +89,14 @@
|
||||
<!-- Platform -->
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.platform') }}</label>
|
||||
<t-radio-group v-model="formData.platform" :disabled="!!editingChannel">
|
||||
<t-radio-group v-model="formData.platform" :disabled="!!editingChannel" @change="onPlatformChange">
|
||||
<t-radio-button value="wecom">{{ $t('agentEditor.im.wecom') }}</t-radio-button>
|
||||
<t-radio-button value="feishu">{{ $t('agentEditor.im.feishu') }}</t-radio-button>
|
||||
<t-radio-button value="slack">{{ $t('agentEditor.im.slack') }}</t-radio-button>
|
||||
<t-radio-button value="telegram">{{ $t('agentEditor.im.telegram') }}</t-radio-button>
|
||||
<t-radio-button value="dingtalk">{{ $t('agentEditor.im.dingtalk') }}</t-radio-button>
|
||||
<t-radio-button value="mattermost">{{ $t('agentEditor.im.mattermost') }}</t-radio-button>
|
||||
<t-radio-button value="wechat">{{ $t('agentEditor.im.wechat') }}</t-radio-button>
|
||||
</t-radio-group>
|
||||
</div>
|
||||
|
||||
@@ -105,8 +106,8 @@
|
||||
<t-input v-model="formData.name" :placeholder="$t('agentEditor.im.channelNamePlaceholder')" />
|
||||
</div>
|
||||
|
||||
<!-- Mode -->
|
||||
<div class="form-item">
|
||||
<!-- Mode (hidden for WeChat) -->
|
||||
<div v-if="formData.platform !== 'wechat'" class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.mode') }}</label>
|
||||
<t-radio-group v-model="formData.mode">
|
||||
<t-radio-button value="websocket" :disabled="formData.platform === 'mattermost'">WebSocket</t-radio-button>
|
||||
@@ -116,8 +117,8 @@
|
||||
<p v-else class="form-hint">{{ $t('agentEditor.im.modeHint') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Output mode -->
|
||||
<div class="form-item">
|
||||
<!-- Output mode (hidden for WeChat) -->
|
||||
<div v-if="formData.platform !== 'wechat'" class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.outputMode') }}</label>
|
||||
<t-radio-group v-model="formData.output_mode">
|
||||
<t-radio-button value="stream">{{ $t('agentEditor.im.outputStream') }}</t-radio-button>
|
||||
@@ -173,6 +174,11 @@
|
||||
<label class="form-label">Bot Secret</label>
|
||||
<t-input v-model="formData.credentials.bot_secret" type="password" placeholder="Bot Secret" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">WebSocket Endpoint</label>
|
||||
<t-input v-model="formData.credentials.ws_endpoint" placeholder="wss://openws.work.weixin.qq.com" />
|
||||
<p class="form-hint">{{ $t('agentEditor.im.wecomWSEndpointHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="form-item">
|
||||
@@ -195,6 +201,11 @@
|
||||
<label class="form-label">Corp Agent ID</label>
|
||||
<t-input-number v-model="formData.credentials.corp_agent_id" placeholder="Corp Agent ID" style="width: 100%;" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">API Base URL</label>
|
||||
<t-input v-model="formData.credentials.api_base_url" placeholder="https://qyapi.weixin.qq.com" />
|
||||
<p class="form-hint">{{ $t('agentEditor.im.wecomAPIBaseURLHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -339,16 +350,62 @@
|
||||
<p class="form-hint">{{ $t('agentEditor.im.mattermostPostToMainHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<!-- WeChat credentials (QR code binding) -->
|
||||
<template v-if="formData.platform === 'wechat'">
|
||||
<p class="form-hint">{{ $t('agentEditor.im.wechatHint') }}</p>
|
||||
|
||||
<!-- Already bound state -->
|
||||
<div v-if="wechatBound" class="wechat-bound-status">
|
||||
<t-icon name="check-circle-filled" class="bound-icon" />
|
||||
<span>{{ $t('agentEditor.im.wechatBindSuccess') }}</span>
|
||||
<t-button size="small" variant="outline" theme="default" @click="startWeChatBinding">
|
||||
{{ $t('agentEditor.im.wechatRebind') }}
|
||||
</t-button>
|
||||
</div>
|
||||
|
||||
<!-- QR code binding flow -->
|
||||
<div v-else class="wechat-qr-section">
|
||||
<!-- Initial state: show bind button -->
|
||||
<div v-if="!wechatQRImgUrl" class="wechat-bind-action">
|
||||
<t-button theme="default" variant="outline" :loading="wechatLoading" @click="startWeChatBinding">
|
||||
<template #icon><t-icon name="scan" /></template>
|
||||
{{ $t('agentEditor.im.wechatScanBind') }}
|
||||
</t-button>
|
||||
</div>
|
||||
|
||||
<!-- QR code displayed -->
|
||||
<div v-else class="wechat-qr-display">
|
||||
<div class="qr-container">
|
||||
<img :src="wechatQRImgUrl" alt="WeChat QR Code" class="qr-image" />
|
||||
<div v-if="wechatQRStatus === 'expired'" class="qr-expired-overlay" @click="startWeChatBinding">
|
||||
<t-icon name="refresh" class="refresh-icon" />
|
||||
<span>{{ $t('agentEditor.im.wechatQRExpired') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="qr-hint">
|
||||
<template v-if="wechatQRStatus === 'scaned'">
|
||||
{{ $t('agentEditor.im.wechatBinding') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t('agentEditor.im.wechatScanning') }}
|
||||
</template>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</t-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { ref, onMounted, watch, onUnmounted, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { MessagePlugin } from 'tdesign-vue-next';
|
||||
import { listIMChannels, createIMChannel, updateIMChannel, deleteIMChannel, toggleIMChannel } from '@/api/agent';
|
||||
import {
|
||||
listIMChannels, createIMChannel, updateIMChannel, deleteIMChannel, toggleIMChannel,
|
||||
getWeChatQRCode, pollWeChatQRCodeStatus,
|
||||
} from '@/api/agent';
|
||||
import { listKnowledgeBases } from '@/api/knowledge-base';
|
||||
import type { IMChannel } from '@/api/agent';
|
||||
|
||||
@@ -366,12 +423,21 @@ const editingChannel = ref<IMChannel | null>(null);
|
||||
// Knowledge base options for file-to-KB feature
|
||||
const knowledgeBases = ref<{ id: string; name: string }[]>([]);
|
||||
|
||||
// WeChat QR code binding state
|
||||
const wechatQRContent = ref(''); // raw text to encode as QR code
|
||||
const wechatQRImgUrl = ref(''); // generated QR image URL
|
||||
const wechatQRCode = ref(''); // opaque token for polling status
|
||||
const wechatQRStatus = ref<string>('');
|
||||
const wechatLoading = ref(false);
|
||||
let wechatPollActive = false;
|
||||
let wechatPollTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const defaultCredentials = (): Record<string, any> => ({});
|
||||
|
||||
const formData = ref({
|
||||
platform: 'wecom' as 'wecom' | 'feishu' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost',
|
||||
platform: 'wecom' as 'wecom' | 'feishu' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost' | 'wechat',
|
||||
name: '',
|
||||
mode: 'websocket' as 'webhook' | 'websocket',
|
||||
mode: 'websocket' as 'webhook' | 'websocket' | 'longpoll',
|
||||
output_mode: 'stream' as 'stream' | 'full',
|
||||
session_mode: 'user' as 'user' | 'thread',
|
||||
knowledge_base_id: '',
|
||||
@@ -401,6 +467,101 @@ watch(
|
||||
}
|
||||
},
|
||||
);
|
||||
// Whether WeChat credentials are already bound
|
||||
const wechatBound = computed(() => {
|
||||
return formData.value.platform === 'wechat' &&
|
||||
formData.value.credentials.bot_token &&
|
||||
formData.value.credentials.ilink_bot_id;
|
||||
});
|
||||
|
||||
|
||||
function onPlatformChange(val: string | number | boolean) {
|
||||
formData.value.credentials = defaultCredentials();
|
||||
stopWeChatPolling();
|
||||
wechatQRContent.value = '';
|
||||
wechatQRImgUrl.value = '';
|
||||
wechatQRCode.value = '';
|
||||
wechatQRStatus.value = '';
|
||||
// WeChat uses fixed mode/output
|
||||
if (val === 'wechat') {
|
||||
formData.value.mode = 'longpoll';
|
||||
formData.value.output_mode = 'full';
|
||||
} else {
|
||||
formData.value.mode = 'websocket';
|
||||
formData.value.output_mode = 'stream';
|
||||
}
|
||||
}
|
||||
|
||||
async function startWeChatBinding() {
|
||||
stopWeChatPolling();
|
||||
wechatLoading.value = true;
|
||||
wechatQRContent.value = '';
|
||||
wechatQRImgUrl.value = '';
|
||||
wechatQRStatus.value = '';
|
||||
|
||||
try {
|
||||
const res = await getWeChatQRCode();
|
||||
// qrcode_url is the text content to encode as QR code (e.g. a weixin:// URL)
|
||||
wechatQRContent.value = res.data.qrcode_url;
|
||||
wechatQRCode.value = res.data.qrcode;
|
||||
wechatQRStatus.value = 'wait';
|
||||
|
||||
// Generate QR code image via public API (no extra npm dependency needed)
|
||||
wechatQRImgUrl.value = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(res.data.qrcode_url)}`;
|
||||
|
||||
// Start long-polling for scan status
|
||||
startStatusPolling();
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(e?.message || 'Failed to generate QR code');
|
||||
} finally {
|
||||
wechatLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function startStatusPolling() {
|
||||
wechatPollActive = true;
|
||||
pollOnce();
|
||||
}
|
||||
|
||||
async function pollOnce() {
|
||||
if (!wechatPollActive) return;
|
||||
try {
|
||||
const statusRes = await pollWeChatQRCodeStatus(wechatQRCode.value);
|
||||
if (!wechatPollActive) return;
|
||||
wechatQRStatus.value = statusRes.data.status;
|
||||
|
||||
if (statusRes.data.status === 'confirmed' && statusRes.data.credentials) {
|
||||
formData.value.credentials = {
|
||||
bot_token: statusRes.data.credentials.bot_token,
|
||||
ilink_bot_id: statusRes.data.credentials.ilink_bot_id,
|
||||
ilink_user_id: statusRes.data.credentials.ilink_user_id,
|
||||
};
|
||||
stopWeChatPolling();
|
||||
wechatQRContent.value = '';
|
||||
wechatQRImgUrl.value = '';
|
||||
MessagePlugin.success(t('agentEditor.im.wechatBindSuccess'));
|
||||
return;
|
||||
}
|
||||
if (statusRes.data.status === 'expired') {
|
||||
stopWeChatPolling();
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// transient error
|
||||
}
|
||||
// Schedule next poll with a short delay (the backend already long-polled ~35s)
|
||||
if (wechatPollActive) {
|
||||
wechatPollTimer = setTimeout(pollOnce, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function stopWeChatPolling() {
|
||||
wechatPollActive = false;
|
||||
if (wechatPollTimer) {
|
||||
clearTimeout(wechatPollTimer);
|
||||
wechatPollTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadChannels() {
|
||||
loading.value = true;
|
||||
@@ -419,7 +580,7 @@ async function loadChannels() {
|
||||
}
|
||||
|
||||
function getCallbackUrl(channel: IMChannel): string {
|
||||
const base = import.meta.env.VITE_IS_DOCKER ? window.location.origin : 'http://127.0.0.1:8080';
|
||||
const base = window.location.origin;
|
||||
return `${base}/api/v1/im/callback/${channel.id}`;
|
||||
}
|
||||
|
||||
@@ -461,6 +622,11 @@ function editChannel(channel: IMChannel) {
|
||||
|
||||
function resetForm() {
|
||||
editingChannel.value = null;
|
||||
stopWeChatPolling();
|
||||
wechatQRContent.value = '';
|
||||
wechatQRImgUrl.value = '';
|
||||
wechatQRCode.value = '';
|
||||
wechatQRStatus.value = '';
|
||||
formData.value = {
|
||||
platform: 'wecom',
|
||||
name: '',
|
||||
@@ -474,6 +640,12 @@ function resetForm() {
|
||||
|
||||
async function handleSave() {
|
||||
try {
|
||||
// For WeChat, validate that credentials are bound
|
||||
if (formData.value.platform === 'wechat' && !formData.value.credentials.bot_token) {
|
||||
MessagePlugin.warning(t('agentEditor.im.wechatScanBind'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (editingChannel.value) {
|
||||
await updateIMChannel(editingChannel.value.id, {
|
||||
name: formData.value.name,
|
||||
@@ -527,6 +699,10 @@ async function handleDelete(id: string) {
|
||||
onMounted(() => {
|
||||
loadChannels();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
stopWeChatPolling();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@@ -670,6 +846,11 @@ onMounted(() => {
|
||||
background: rgba(25, 42, 77, 0.08);
|
||||
color: #192a4d;
|
||||
}
|
||||
|
||||
&.wechat {
|
||||
background: rgba(7, 193, 96, 0.08);
|
||||
color: #07c160;
|
||||
}
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
@@ -815,4 +996,86 @@ onMounted(() => {
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
// --- WeChat QR code binding ---
|
||||
.wechat-bound-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
background: rgba(7, 193, 96, 0.06);
|
||||
border: 1px solid rgba(7, 193, 96, 0.2);
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
color: var(--td-text-color-primary);
|
||||
|
||||
.bound-icon {
|
||||
font-size: 18px;
|
||||
color: #07c160;
|
||||
}
|
||||
}
|
||||
|
||||
.wechat-qr-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.wechat-bind-action {
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
.wechat-qr-display {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.qr-container {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
// QR code images are always black-on-white; force white background
|
||||
// so the code remains scannable in dark mode.
|
||||
background: #fff;
|
||||
|
||||
.qr-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
.qr-expired-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
|
||||
.refresh-icon {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.qr-hint {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-secondary);
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -15,7 +15,7 @@ import AgentSelector from './AgentSelector.vue';
|
||||
import { getCaretCoordinates } from '@/utils/caret';
|
||||
import { listModels, type ModelConfig } from '@/api/model';
|
||||
import { listAgents, type CustomAgent, BUILTIN_QUICK_ANSWER_ID, BUILTIN_SMART_REASONING_ID } from '@/api/agent';
|
||||
import { getTenantWebSearchConfig } from '@/api/web-search';
|
||||
import { listWebSearchProviders, type WebSearchProviderEntity } from '@/api/web-search-provider';
|
||||
import { getConversationConfig, updateConversationConfig, type ConversationConfig } from '@/api/system';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import AttachmentUpload, { type AttachmentFile } from './AttachmentUpload.vue';
|
||||
@@ -197,6 +197,11 @@ const agentWebSearchEnabled = computed(() => {
|
||||
return currentAgentConfig.value?.web_search_enabled ?? true;
|
||||
});
|
||||
|
||||
const agentWebSearchProviderId = computed(() => {
|
||||
if (!hasAgentConfig.value) return '';
|
||||
return currentAgentConfig.value?.web_search_provider_id || '';
|
||||
});
|
||||
|
||||
// 网络搜索是否被智能体禁用(只读状态)- 只有明确设置为 false 时才禁用
|
||||
const isWebSearchDisabledByAgent = computed(() => {
|
||||
return hasAgentConfig.value && agentWebSearchEnabled.value === false;
|
||||
@@ -287,7 +292,6 @@ const isAgentEnabled = computed(() => settingsStore.isAgentEnabled);
|
||||
const isWebSearchEnabled = computed(() => settingsStore.isWebSearchEnabled);
|
||||
const selectedKbIds = computed(() => settingsStore.settings.selectedKnowledgeBases || []);
|
||||
const selectedFileIds = computed(() => settingsStore.settings.selectedFiles || []);
|
||||
const isWebSearchConfigured = ref(false);
|
||||
|
||||
// 获取已选择的知识库信息
|
||||
const knowledgeBases = ref<Array<{ id: string; name: string; type?: 'document' | 'faq'; knowledge_count?: number; chunk_count?: number }>>([]);
|
||||
@@ -526,19 +530,29 @@ watch(selectedFileIds, () => {
|
||||
loadFiles();
|
||||
}, { immediate: true });
|
||||
|
||||
const webSearchProviders = ref<WebSearchProviderEntity[]>([]);
|
||||
|
||||
const isWebSearchConfigured = computed(() => {
|
||||
const agentProviderId = agentWebSearchProviderId.value;
|
||||
if (agentProviderId) {
|
||||
return webSearchProviders.value.some(p => p.id === agentProviderId);
|
||||
}
|
||||
|
||||
return webSearchProviders.value.some(p => p.is_default);
|
||||
});
|
||||
|
||||
const loadWebSearchConfig = async () => {
|
||||
try {
|
||||
const response: any = await getTenantWebSearchConfig();
|
||||
const config = response?.data;
|
||||
const configured = !!(config && config.provider);
|
||||
isWebSearchConfigured.value = configured;
|
||||
const response = await listWebSearchProviders();
|
||||
const providers = (response as any)?.data;
|
||||
webSearchProviders.value = Array.isArray(providers) ? providers : [];
|
||||
|
||||
if (!configured && settingsStore.isWebSearchEnabled) {
|
||||
if (!isWebSearchConfigured.value && settingsStore.isWebSearchEnabled) {
|
||||
settingsStore.toggleWebSearch(false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load web search config:', error);
|
||||
isWebSearchConfigured.value = false;
|
||||
webSearchProviders.value = [];
|
||||
if (settingsStore.isWebSearchEnabled) {
|
||||
settingsStore.toggleWebSearch(false);
|
||||
}
|
||||
|
||||
@@ -317,6 +317,18 @@ const fallbackProviderOptions = computed(() => [
|
||||
description: t('model.editor.providers.openai.description'),
|
||||
modelTypes: ['chat', 'embedding', 'vllm', 'asr']
|
||||
},
|
||||
{
|
||||
value: 'azure_openai',
|
||||
label: t('model.editor.providers.azure_openai.label'),
|
||||
defaultUrls: {
|
||||
chat: 'https://{resource}.openai.azure.com',
|
||||
embedding: 'https://{resource}.openai.azure.com',
|
||||
vllm: 'https://{resource}.openai.azure.com',
|
||||
asr: 'https://{resource}.openai.azure.com'
|
||||
},
|
||||
description: t('model.editor.providers.azure_openai.description'),
|
||||
modelTypes: ['chat', 'embedding', 'vllm', 'asr']
|
||||
},
|
||||
{
|
||||
value: 'aliyun',
|
||||
label: t('model.editor.providers.aliyun.label'),
|
||||
@@ -810,7 +822,8 @@ const checkRemoteAPI = async () => {
|
||||
result = await checkRemoteModel({
|
||||
modelName: formData.value.modelName,
|
||||
baseUrl: formData.value.baseUrl,
|
||||
apiKey: formData.value.apiKey || ''
|
||||
apiKey: formData.value.apiKey || '',
|
||||
provider: formData.value.provider
|
||||
})
|
||||
break
|
||||
|
||||
@@ -846,7 +859,8 @@ const checkRemoteAPI = async () => {
|
||||
result = await checkRemoteModel({
|
||||
modelName: formData.value.modelName,
|
||||
baseUrl: formData.value.baseUrl,
|
||||
apiKey: formData.value.apiKey || ''
|
||||
apiKey: formData.value.apiKey || '',
|
||||
provider: formData.value.provider
|
||||
})
|
||||
break
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
<t-icon name="control-platform" class="menu-icon" />
|
||||
<span>{{ $t('settings.modelManagement') }}</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="handleQuickNav('ollama')">
|
||||
<t-icon name="server" class="menu-icon" />
|
||||
<span>Ollama</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="handleQuickNav('websearch')">
|
||||
<svg
|
||||
width="16"
|
||||
@@ -47,16 +43,21 @@
|
||||
<t-icon name="tools" class="menu-icon" />
|
||||
<span>{{ $t('settings.mcpService') }}</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="handleQuickNav('api')">
|
||||
<t-icon name="secured" class="menu-icon" />
|
||||
<span>{{ $t('settings.apiInfo') }}</span>
|
||||
</div>
|
||||
<div class="menu-divider"></div>
|
||||
<div class="menu-item" @click="handleSettings">
|
||||
<t-icon name="setting" class="menu-icon" />
|
||||
<span>{{ $t('general.allSettings') }}</span>
|
||||
</div>
|
||||
<div class="menu-divider"></div>
|
||||
<div class="menu-item" @click="openApiDoc">
|
||||
<t-icon name="book" class="menu-icon" />
|
||||
<div class="menu-item" @click="openClawhubSkill">
|
||||
<span class="menu-icon menu-icon--emoji" role="img" :aria-label="$t('common.clawhubSkill')">🦞</span>
|
||||
<span class="menu-text-with-icon">
|
||||
<span>{{ $t('tenant.apiDocument') }}</span>
|
||||
<span>{{ $t('common.clawhubSkill') }}</span>
|
||||
<span class="menu-new-badge">{{ $t('common.newBadge') }}</span>
|
||||
<svg class="menu-external-icon" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path
|
||||
fill="currentColor"
|
||||
@@ -65,10 +66,11 @@
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="openWebsite">
|
||||
<t-icon name="home" class="menu-icon" />
|
||||
<div class="menu-item" @click="openChromeExtension">
|
||||
<t-icon name="extension" class="menu-icon" />
|
||||
<span class="menu-text-with-icon">
|
||||
<span>{{ $t('common.website') }}</span>
|
||||
<span>{{ $t('common.chromeExtension') }}</span>
|
||||
<span class="menu-new-badge">{{ $t('common.newBadge') }}</span>
|
||||
<svg class="menu-external-icon" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path
|
||||
fill="currentColor"
|
||||
@@ -77,10 +79,15 @@
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="openGithub">
|
||||
<div
|
||||
class="menu-item"
|
||||
:title="$t('common.githubStarTip')"
|
||||
@click="openGithub"
|
||||
>
|
||||
<t-icon name="logo-github" class="menu-icon" />
|
||||
<span class="menu-text-with-icon">
|
||||
<span>GitHub</span>
|
||||
<span>{{ $t('common.github') }}</span>
|
||||
<t-icon name="star-filled" class="menu-github-star-icon" size="14px" aria-hidden="true" />
|
||||
<svg class="menu-external-icon" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path
|
||||
fill="currentColor"
|
||||
@@ -89,11 +96,13 @@
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div class="menu-divider"></div>
|
||||
<div class="menu-item danger" @click="handleLogout">
|
||||
<t-icon name="logout" class="menu-icon" />
|
||||
<span>{{ $t('auth.logout') }}</span>
|
||||
</div>
|
||||
<template v-if="!authStore.isLiteMode">
|
||||
<div class="menu-divider"></div>
|
||||
<div class="menu-item danger" @click="handleLogout">
|
||||
<t-icon name="logout" class="menu-icon" />
|
||||
<span>{{ $t('auth.logout') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
@@ -159,16 +168,20 @@ const handleSettings = () => {
|
||||
router.push('/platform/settings')
|
||||
}
|
||||
|
||||
// 打开 API 文档
|
||||
const openApiDoc = () => {
|
||||
const CHROME_EXTENSION_URL =
|
||||
'https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd?utm_source=item-share-cb'
|
||||
|
||||
const CLAWHUB_SKILL_URL = 'https://clawhub.ai/lyingbug/weknora'
|
||||
|
||||
// 打开 WeKnora Chrome 插件(Chrome应用商店)
|
||||
const openChromeExtension = () => {
|
||||
menuVisible.value = false
|
||||
window.open('https://github.com/Tencent/WeKnora/blob/main/docs/api/README.md', '_blank')
|
||||
window.open(CHROME_EXTENSION_URL, '_blank')
|
||||
}
|
||||
|
||||
// 打开官网
|
||||
const openWebsite = () => {
|
||||
const openClawhubSkill = () => {
|
||||
menuVisible.value = false
|
||||
window.open('https://weknora.weixin.qq.com/', '_blank')
|
||||
window.open(CLAWHUB_SKILL_URL, '_blank')
|
||||
}
|
||||
|
||||
// 打开 GitHub
|
||||
@@ -407,6 +420,18 @@ onUnmounted(() => {
|
||||
height: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&--emoji {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 15px;
|
||||
line-height: 1;
|
||||
flex-shrink: 0;
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-text-with-icon {
|
||||
@@ -417,13 +442,33 @@ onUnmounted(() => {
|
||||
color: inherit;
|
||||
min-width: 0;
|
||||
|
||||
span {
|
||||
> span:first-of-type {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-new-badge {
|
||||
flex-shrink: 0;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
padding: 2px 5px;
|
||||
border-radius: 4px;
|
||||
background: var(--td-brand-color-light);
|
||||
color: var(--td-brand-color);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.menu-github-star-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--td-warning-color);
|
||||
}
|
||||
|
||||
.menu-external-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
|
||||
@@ -690,6 +690,24 @@ const getParentContent = (item: any) => {
|
||||
return parentContextCache.value.get(item.parent_chunk_id) || '';
|
||||
};
|
||||
|
||||
const summaryExpanded = ref(false);
|
||||
const summaryRef = ref<HTMLElement>();
|
||||
const summaryOverflow = ref(false);
|
||||
|
||||
const checkSummaryOverflow = () => {
|
||||
nextTick(() => {
|
||||
const el = summaryRef.value;
|
||||
if (!el) { summaryOverflow.value = false; return; }
|
||||
summaryOverflow.value = el.scrollHeight > el.clientHeight + 1;
|
||||
});
|
||||
};
|
||||
|
||||
watch(() => props.details?.description, () => {
|
||||
summaryExpanded.value = false;
|
||||
checkSummaryOverflow();
|
||||
});
|
||||
watch(summaryRef, () => checkSummaryOverflow());
|
||||
|
||||
const downloadFile = () => {
|
||||
downKnowledgeDetails(props.details.id)
|
||||
.then((result) => {
|
||||
@@ -734,7 +752,7 @@ const handleDetailsScroll = () => {
|
||||
</script>
|
||||
<template>
|
||||
<div class="doc_content" ref="mdContentWrap">
|
||||
<t-drawer :visible="visible" :zIndex="2000" :closeBtn="true" @close="handleClose">
|
||||
<t-drawer :visible="visible" :zIndex="2000" :closeBtn="true" :footer="false" @close="handleClose">
|
||||
<template #header>
|
||||
<div class="drawer-header">
|
||||
<span class="header-title">{{ getDisplayTitle() }}</span>
|
||||
@@ -784,7 +802,12 @@ const handleDetailsScroll = () => {
|
||||
<!-- 文档摘要 -->
|
||||
<div v-if="details.description" class="summary_box">
|
||||
<span class="label">{{ $t('knowledgeBase.documentSummary') }}</span>
|
||||
<div class="summary_content">{{ details.description }}</div>
|
||||
<div class="summary_wrapper" :class="{ 'summary_clickable': summaryOverflow || summaryExpanded }" @click="(summaryOverflow || summaryExpanded) && (summaryExpanded = !summaryExpanded)">
|
||||
<div ref="summaryRef" :class="['summary_content', { 'summary_collapsed': !summaryExpanded }]">{{ details.description }}</div>
|
||||
<div v-if="(summaryOverflow && !summaryExpanded) || summaryExpanded" class="summary_fade" :class="{ 'summary_fade_expanded': summaryExpanded }">
|
||||
<t-icon :name="summaryExpanded ? 'chevron-up' : 'chevron-down'" size="14px" class="summary_fade_icon" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="details.summary_status === 'pending' || details.summary_status === 'processing'" class="summary_box">
|
||||
<span class="label">{{ $t('knowledgeBase.documentSummary') }}</span>
|
||||
@@ -948,10 +971,6 @@ const handleDetailsScroll = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<t-button @click="handleClose">{{ $t('common.confirm') }}</t-button>
|
||||
<t-button theme="default" @click="handleClose">{{ $t('common.cancel') }}</t-button>
|
||||
</template>
|
||||
</t-drawer>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1056,15 +1075,50 @@ const handleDetailsScroll = () => {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.summary_content {
|
||||
padding: 12px;
|
||||
.summary_wrapper {
|
||||
position: relative;
|
||||
background: var(--td-bg-color-container-hover);
|
||||
border-radius: 4px;
|
||||
|
||||
&.summary_clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.summary_content {
|
||||
padding: 12px;
|
||||
color: var(--td-text-color-primary);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
|
||||
&.summary_collapsed {
|
||||
max-height: 4.5em;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.summary_fade {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding-bottom: 4px;
|
||||
pointer-events: none;
|
||||
|
||||
&:not(.summary_fade_expanded) {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 28px;
|
||||
background: linear-gradient(transparent, var(--td-bg-color-container-hover) 80%);
|
||||
border-radius: 0 0 4px 4px;
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.summary_fade_icon {
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.summary_loading {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="logo_row" v-if="!uiStore.sidebarCollapsed">
|
||||
<div class="logo_box" @click="router.push('/platform/knowledge-bases')" style="cursor: pointer;">
|
||||
<img class="logo" src="@/assets/img/weknora.png" alt="">
|
||||
<sup v-if="isLiteEdition" class="lite-badge">Lite</sup>
|
||||
</div>
|
||||
<div class="sidebar-toggle"
|
||||
@click="uiStore.toggleSidebar"
|
||||
@@ -60,6 +61,14 @@
|
||||
</div>
|
||||
</t-tooltip>
|
||||
<div ref="submenuscrollContainer" @scroll="handleScroll" class="submenu" v-if="item.children && !uiStore.sidebarCollapsed">
|
||||
<!-- 骨架屏占位 -->
|
||||
<template v-if="loading && groupedSessions.length === 0">
|
||||
<div v-for="n in 5" :key="'skel-'+n" class="submenu_item_p">
|
||||
<div class="submenu_item">
|
||||
<t-skeleton animation="gradient" style="margin-left:18px;width:80%" :row-col="[{ width: '100%', height: '16px' }]" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-for="(group, groupIndex) in groupedSessions" :key="groupIndex">
|
||||
<div class="timeline_header">{{ group.label }}</div>
|
||||
<div class="submenu_item_p" v-for="(subitem, subindex) in group.items" :key="subitem.id">
|
||||
@@ -137,6 +146,7 @@ import { MessagePlugin, DialogPlugin, Icon as TIcon } from "tdesign-vue-next";
|
||||
import UserMenu from '@/components/UserMenu.vue';
|
||||
import TenantSelector from '@/components/TenantSelector.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getSystemInfo } from '@/api/system';
|
||||
|
||||
const { t } = useI18n();
|
||||
const usemenuStore = useMenuStore();
|
||||
@@ -155,8 +165,9 @@ const submenuscrollContainer = ref(null);
|
||||
const totalPages = computed(() => Math.ceil(total.value / page_size.value));
|
||||
const hasMore = computed(() => currentPage.value < totalPages.value);
|
||||
type MenuItem = { title: string; icon: string; path: string; childrenPath?: string; children?: any[] };
|
||||
const { menuArr } = storeToRefs(usemenuStore);
|
||||
const { menuArr, visibleMenuArr } = storeToRefs(usemenuStore);
|
||||
let activeSubmenu = ref<string>('');
|
||||
const isLiteEdition = ref(false);
|
||||
|
||||
// 批量管理状态
|
||||
const batchMode = ref(false)
|
||||
@@ -250,15 +261,15 @@ const getIconActiveState = (itemPath: string) => {
|
||||
};
|
||||
};
|
||||
|
||||
// 分离上下两部分菜单
|
||||
// 分离上下两部分菜单(使用 visibleMenuArr 以便 lite 模式过滤 logout)
|
||||
const topMenuItems = computed<MenuItem[]>(() => {
|
||||
return (menuArr.value as unknown as MenuItem[]).filter((item: MenuItem) =>
|
||||
return (visibleMenuArr.value as unknown as MenuItem[]).filter((item: MenuItem) =>
|
||||
item.path === 'knowledge-bases' || item.path === 'knowledge-search' || item.path === 'agents' || item.path === 'organizations' || item.path === 'creatChat'
|
||||
);
|
||||
});
|
||||
|
||||
const bottomMenuItems = computed<MenuItem[]>(() => {
|
||||
return (menuArr.value as unknown as MenuItem[]).filter((item: MenuItem) => {
|
||||
return (visibleMenuArr.value as unknown as MenuItem[]).filter((item: MenuItem) => {
|
||||
if (item.path === 'knowledge-bases' || item.path === 'knowledge-search' || item.path === 'agents' || item.path === 'organizations' || item.path === 'creatChat') {
|
||||
return false;
|
||||
}
|
||||
@@ -539,6 +550,14 @@ onMounted(async () => {
|
||||
currentSecondpath.value = `chat/${route.params.chatid}`;
|
||||
}
|
||||
|
||||
isLiteEdition.value = authStore.isLiteMode
|
||||
getSystemInfo().then(res => {
|
||||
if (res.data?.edition === 'lite') {
|
||||
isLiteEdition.value = true
|
||||
authStore.setLiteMode(true)
|
||||
}
|
||||
}).catch(() => {})
|
||||
|
||||
// 初始化知识库信息
|
||||
const kbId = (route.params as any)?.kbId as string
|
||||
if (kbId && isInKnowledgeBase.value) {
|
||||
@@ -761,6 +780,11 @@ const onDragHandleMouseDown = (e: MouseEvent) => {
|
||||
transition: width 0.25s ease, min-width 0.25s ease;
|
||||
position: relative;
|
||||
|
||||
// macOS Wails 桌面:红绿灯位于 HiddenInset 标题栏区域,需让出顶部空间
|
||||
html.wails-desktop & {
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
&--collapsed {
|
||||
min-width: 60px;
|
||||
width: 60px;
|
||||
@@ -832,10 +856,21 @@ const onDragHandleMouseDown = (e: MouseEvent) => {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
|
||||
.logo{
|
||||
width: 134px;
|
||||
height: auto;
|
||||
}
|
||||
.lite-badge {
|
||||
margin-left: 2px;
|
||||
align-self: flex-start;
|
||||
margin-top: 2px;
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-placeholder);
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.logo_img {
|
||||
@@ -998,6 +1033,11 @@ const onDragHandleMouseDown = (e: MouseEvent) => {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
@keyframes menuItemFadeIn {
|
||||
from { opacity: 0; transform: translateX(-4px); }
|
||||
to { opacity: 1; transform: translateX(0); }
|
||||
}
|
||||
|
||||
.timeline_header {
|
||||
font-family: "PingFang SC";
|
||||
font-size: 12px;
|
||||
@@ -1007,6 +1047,7 @@ const onDragHandleMouseDown = (e: MouseEvent) => {
|
||||
margin-top: 8px;
|
||||
line-height: 20px;
|
||||
user-select: none;
|
||||
animation: menuItemFadeIn 0.25s ease-out;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 4px;
|
||||
@@ -1017,6 +1058,7 @@ const onDragHandleMouseDown = (e: MouseEvent) => {
|
||||
height: 44px;
|
||||
padding: 4px 0px 4px 0px;
|
||||
box-sizing: border-box;
|
||||
animation: menuItemFadeIn 0.25s ease-out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,9 +13,46 @@ function getSystemTheme(): 'light' | 'dark' {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||
}
|
||||
|
||||
/** Wails:与原生窗口底色 / 系统深浅色一致,减轻 Ctrl+R 整窗白闪(浅色与 --td-bg-color-page #eee 对齐) */
|
||||
function syncWailsNativeChrome(effective: 'light' | 'dark') {
|
||||
const bg = effective === 'dark' ? '#181818' : '#eeeeee'
|
||||
document.documentElement.style.background = bg
|
||||
document.documentElement.style.minHeight = '100%'
|
||||
document.documentElement.style.colorScheme = effective === 'dark' ? 'dark' : 'light'
|
||||
if (document.body) {
|
||||
document.body.style.background = bg
|
||||
document.body.style.minHeight = '100%'
|
||||
}
|
||||
const appEl = document.getElementById('app')
|
||||
if (appEl) {
|
||||
appEl.style.background = bg
|
||||
appEl.style.minHeight = '100%'
|
||||
}
|
||||
const w = (window as unknown as {
|
||||
runtime?: {
|
||||
WindowSetDarkTheme?: () => void
|
||||
WindowSetLightTheme?: () => void
|
||||
WindowSetBackgroundColour?: (r: number, g: number, b: number, a: number) => void
|
||||
}
|
||||
}).runtime
|
||||
if (!w?.WindowSetBackgroundColour) return
|
||||
try {
|
||||
if (effective === 'dark') {
|
||||
w.WindowSetDarkTheme?.()
|
||||
w.WindowSetBackgroundColour(24, 24, 24, 255)
|
||||
} else {
|
||||
w.WindowSetLightTheme?.()
|
||||
w.WindowSetBackgroundColour(238, 238, 238, 255)
|
||||
}
|
||||
} catch {
|
||||
/* 非桌面壳或未注入 runtime */
|
||||
}
|
||||
}
|
||||
|
||||
function applyTheme(mode: ThemeMode) {
|
||||
const effective = mode === 'system' ? getSystemTheme() : mode
|
||||
document.documentElement.setAttribute('theme-mode', effective)
|
||||
syncWailsNativeChrome(effective)
|
||||
}
|
||||
|
||||
export function useTheme() {
|
||||
|
||||
@@ -103,15 +103,17 @@ export default {
|
||||
noValidFilesSelected: 'All selected files are unsupported',
|
||||
hiddenFilesFiltered: 'Filtered {count} hidden files',
|
||||
imagesFilteredNoVLM: 'Filtered {count} image files (VLM not enabled)',
|
||||
videosFilteredNoVLM: 'Filtered {count} video files (VLM not enabled)',
|
||||
audiosFilteredNoASR: 'Filtered {count} audio files (ASR not enabled)',
|
||||
invalidFilesFiltered: 'Filtered {count} unsupported files',
|
||||
unsupportedFileType: 'Unsupported file type',
|
||||
unsupportedTypesHint: 'Some document types ({types}) have no available parser engine and cannot be processed',
|
||||
goToParserSettings: 'Configure',
|
||||
failedFilesList: 'Failed files:',
|
||||
failedFilesList: 'Failed files:',
|
||||
andMoreFiles: '...and {count} more files',
|
||||
duplicateFilesSkipped: '{count} duplicate files skipped',
|
||||
uploadFile: 'Upload File',
|
||||
uploadFileDesc: 'Supports PDF, Word, TXT, etc.',
|
||||
uploadFileDesc: 'Supports PDF, Word, TXT, images, videos, audio, etc.',
|
||||
importURL: 'Import from URL',
|
||||
addDocument: 'Add Document',
|
||||
importURLDesc: 'Import via URL link',
|
||||
@@ -567,6 +569,8 @@ export default {
|
||||
webSearchConfig: 'Web Search',
|
||||
enableMemory: 'Enable Memory',
|
||||
enableMemoryDesc: 'When enabled, the system will record your conversation history and automatically recall relevant content in future conversations to provide more personalized answers.',
|
||||
autoCheckUpdate: 'Auto Download Updates',
|
||||
autoCheckUpdateDesc: 'When enabled, automatically check and download the latest version in the background.',
|
||||
memoryRequiresNeo4j: 'Memory feature requires Neo4j graph database. Please configure and enable Neo4j (set NEO4J_ENABLE=true) before enabling this feature.',
|
||||
memoryHowToEnable: 'View Neo4j Configuration Guide',
|
||||
parserEngine: 'Parser Engine',
|
||||
@@ -655,6 +659,7 @@ export default {
|
||||
engineLocal: 'Local',
|
||||
engineCos: 'Tencent Cloud COS',
|
||||
engineTos: 'Volcengine TOS',
|
||||
engineOss: 'Alibaba Cloud OSS',
|
||||
engineS3: 'AWS S3',
|
||||
localTitle: 'Local Storage',
|
||||
localDesc: 'Store files on the server local filesystem, suitable for single-node deployment only.',
|
||||
@@ -688,6 +693,10 @@ export default {
|
||||
s3Desc: 'AWS S3 and S3-compatible object storage services, suitable for public cloud deployment.',
|
||||
s3AccessKeyPlaceholder: 'AWS Access Key',
|
||||
s3SecretKeyPlaceholder: 'AWS Secret Key',
|
||||
ossTitle: 'Alibaba Cloud OSS',
|
||||
ossDesc: 'Alibaba Cloud Object Storage Service (OSS), suitable for public cloud deployment.',
|
||||
ossAccessKeyPlaceholder: 'Alibaba Cloud Access Key',
|
||||
ossSecretKeyPlaceholder: 'Alibaba Cloud Secret Key',
|
||||
console: 'Console',
|
||||
docs: 'Docs',
|
||||
testConnection: 'Test Connection',
|
||||
@@ -699,6 +708,7 @@ export default {
|
||||
requestFailed: 'Request failed',
|
||||
cos: 'Tencent Cloud COS',
|
||||
tos: 'Volcengine TOS',
|
||||
oss: 'Alibaba Cloud OSS',
|
||||
},
|
||||
},
|
||||
webSearchSettings: {
|
||||
@@ -1159,7 +1169,11 @@ export default {
|
||||
reset: 'Reset',
|
||||
clear: 'Clear',
|
||||
website: 'Official Website',
|
||||
chromeExtension: 'Chrome extension',
|
||||
clawhubSkill: 'Claw Skill',
|
||||
newBadge: 'New',
|
||||
github: 'GitHub',
|
||||
githubStarTip: 'Open the repo on GitHub — star it if you find it useful',
|
||||
on: 'On',
|
||||
off: 'Off',
|
||||
resetToDefault: 'Reset to default',
|
||||
@@ -1175,6 +1189,8 @@ export default {
|
||||
defaultUser: 'User',
|
||||
copyFailed: 'Copy failed',
|
||||
retry: 'Retry',
|
||||
expand: 'Expand',
|
||||
collapse: 'Collapse',
|
||||
},
|
||||
mentionDetail: {
|
||||
readOnlyFromAgent: 'Read-only in this conversation; not shown in Knowledge Base list',
|
||||
@@ -1958,6 +1974,10 @@ export default {
|
||||
description: 'View and manage your API key',
|
||||
keyLabel: 'API Key',
|
||||
keyDescription: 'Secret used for API requests. Keep it safe.',
|
||||
urlLabel: 'API URL',
|
||||
urlDescription: 'Base path for REST API requests; append the specific endpoint when calling.',
|
||||
copyUrlTitle: 'Copy API URL',
|
||||
urlCopySuccess: 'API URL copied to clipboard',
|
||||
copyTitle: 'Copy API Key',
|
||||
docLabel: 'API Documentation',
|
||||
docDescription: 'View complete API documentation and examples,',
|
||||
@@ -1973,7 +1993,26 @@ export default {
|
||||
createdAtDescription: 'Time when the account was created',
|
||||
noKey: 'No API Key available',
|
||||
copySuccess: 'API Key copied to clipboard',
|
||||
copyFailed: 'Copy failed, please copy manually'
|
||||
copyFailed: 'Copy failed, please copy manually',
|
||||
desktopPortLabel: 'Local API port (desktop)',
|
||||
desktopPortDescription:
|
||||
'Use a fixed port (e.g. 37841) so tools like the Chrome extension can keep the same API URL. 0 means a random port each launch. Restart the app after saving.',
|
||||
desktopPortSave: 'Save',
|
||||
desktopPortSaved: 'Saved. Restart the app for it to take effect.',
|
||||
desktopPortSaveFailed: 'Save failed',
|
||||
desktopPortInvalid: 'Enter a port between 0 and 65535',
|
||||
desktopBindPublicLabel: 'Allow LAN access to the API',
|
||||
desktopBindPublicDescription:
|
||||
'When enabled, the embedded server listens on 0.0.0.0 so other devices on your LAN can reach the API via the address below. This increases exposure—use host firewalls and routing rules as needed. Restart the app after changing this.',
|
||||
desktopBindPublicSaved: 'Saved. Restart the app for it to take effect.',
|
||||
desktopBindPublicSaveFailed: 'Save failed',
|
||||
lanUrlLabel: 'LAN API base URL',
|
||||
lanUrlDescription:
|
||||
'Shown after “Allow LAN access” is on and the app has restarted. If the IP is wrong, replace the host with your machine’s IPv4 from system network settings.',
|
||||
lanUrlCopyTitle: 'Copy LAN API URL',
|
||||
lanUrlCopySuccess: 'LAN API URL copied',
|
||||
lanUrlUnavailable:
|
||||
'The API is listening on all interfaces, but no LAN IPv4 could be detected automatically. Find your IPv4 in network settings and build http://YOUR_IP:PORT/api/v1 manually.',
|
||||
}
|
||||
},
|
||||
system: {
|
||||
@@ -2153,6 +2192,10 @@ export default {
|
||||
label: 'OpenAI',
|
||||
description: 'gpt-5.2, gpt-5-mini, etc.',
|
||||
},
|
||||
azure_openai: {
|
||||
label: 'Azure OpenAI',
|
||||
description: 'OpenAI service hosted on Microsoft Azure',
|
||||
},
|
||||
aliyun: {
|
||||
label: 'Aliyun DashScope',
|
||||
description: 'qwen-plus, tongyi-embedding-vision-plus, qwen3-rerank, etc.',
|
||||
@@ -3085,6 +3128,8 @@ export default {
|
||||
engineTosDesc: 'Volcengine object storage, for public cloud deployment',
|
||||
engineS3: 'AWS S3',
|
||||
engineS3Desc: 'AWS S3 and compatible storage, for public cloud deployment',
|
||||
engineOss: 'Alibaba Cloud OSS',
|
||||
engineOssDesc: 'Alibaba Cloud Object Storage Service, for public cloud deployment',
|
||||
},
|
||||
parser: {
|
||||
title: 'Parser Engine',
|
||||
@@ -3282,12 +3327,14 @@ export default {
|
||||
},
|
||||
im: {
|
||||
title: 'IM Integration',
|
||||
description: 'Connect agent to instant messaging platforms like WeCom, Feishu, Slack, Telegram, DingTalk, and Mattermost',
|
||||
description: 'Connect agent to instant messaging platforms like WeCom, Feishu, Slack, Telegram, DingTalk, Mattermost and WeChat',
|
||||
feishu: 'Feishu',
|
||||
slack: 'Slack',
|
||||
telegram: 'Telegram',
|
||||
dingtalk: 'DingTalk',
|
||||
mattermost: 'Mattermost',
|
||||
wecom: 'WeCom',
|
||||
wechat: 'WeChat',
|
||||
addChannel: 'Add Channel',
|
||||
editChannel: 'Edit Channel',
|
||||
deleteConfirm: 'Are you sure you want to delete this channel? This action cannot be undone.',
|
||||
@@ -3315,6 +3362,8 @@ export default {
|
||||
'When on, bot replies are new top-level posts in the channel. When off (default), they stay in the thread and the main view only shows “N replies”.',
|
||||
modeHint: 'WebSocket is recommended for easier setup',
|
||||
consoleTip: 'to get credentials',
|
||||
wecomWSEndpointHint: 'Optional. For private WeCom deployments, enter a custom WebSocket address. Leave empty to use the default public cloud endpoint. For internal network addresses, add the hostname to the SSRF_WHITELIST env var.',
|
||||
wecomAPIBaseURLHint: 'Optional. For private WeCom deployments, enter a custom API base URL. Leave empty to use the default public cloud endpoint. For internal network addresses, add the hostname to the SSRF_WHITELIST env var.',
|
||||
fileKnowledgeBase: 'File Storage Knowledge Base',
|
||||
fileKnowledgeBasePlaceholder: 'Select a knowledge base (optional)',
|
||||
fileKnowledgeBaseHint: 'When configured, files sent by users will be automatically saved to this knowledge base',
|
||||
@@ -3322,6 +3371,13 @@ export default {
|
||||
sessionModeUser: 'Per User (default)',
|
||||
sessionModeThread: 'Per Thread',
|
||||
sessionModeHint: 'User mode: each person has their own conversation. Use /clear to start fresh. Thread mode: each message thread is a separate conversation. Multiple people can collaborate in the same thread.',
|
||||
wechatScanBind: 'Scan to bind WeChat',
|
||||
wechatScanning: 'Scan the QR code with WeChat',
|
||||
wechatBindSuccess: 'WeChat bound successfully',
|
||||
wechatRebind: 'Rebind',
|
||||
wechatHint: 'Requires iOS WeChat 8.0.70+, direct messages only',
|
||||
wechatQRExpired: 'QR code expired, please try again',
|
||||
wechatBinding: 'Binding...',
|
||||
},
|
||||
mcp: {
|
||||
label: 'MCP Services',
|
||||
@@ -3464,11 +3520,15 @@ export default {
|
||||
untitled: 'Untitled',
|
||||
resourceLoadFailed: 'Failed to load resources',
|
||||
noResources: 'No wiki spaces found',
|
||||
noResourcesDesc: 'The app needs wiki access via a group chat to fetch content',
|
||||
noResourcesDesc: 'The app needs wiki access via a group chat to fetch content',
|
||||
noResourcesDesc_notion: 'The app needs Notion page access permissions to fetch content',
|
||||
retryLoadResources: 'Retry',
|
||||
guideStep1: 'Create a group chat in Feishu, then add your app as a bot in the group settings',
|
||||
guideStep2: 'Open wiki "Settings" > "Member Settings" > "Add Member", search for the group chat and add it',
|
||||
guideStep3: 'Ensure the group chat role is at least "Can Read", then come back and click Retry',
|
||||
guideStep1_notion: 'Open the page or database you want to sync in Notion',
|
||||
guideStep2_notion: 'Click the "···" menu at the top right, select "Connect to" or "Add connections"',
|
||||
guideStep3_notion: 'Search and select your Integration app, then come back and click Retry',
|
||||
permissionDocLink: 'View Feishu wiki permission docs',
|
||||
syncScheduleLabel: 'Sync schedule',
|
||||
conflictLabel: 'Conflict strategy',
|
||||
|
||||
@@ -102,6 +102,8 @@ export default {
|
||||
noValidFilesSelected: "선택한 파일 모두 지원되지 않음",
|
||||
hiddenFilesFiltered: "{count}개 숨김 파일 필터링됨",
|
||||
imagesFilteredNoVLM: "{count}개 이미지 파일 필터링됨(VLM 미활성화)",
|
||||
videosFilteredNoVLM: "{count}개 동영상 파일 필터링됨(VLM 미활성화)",
|
||||
audiosFilteredNoASR: "{count}개 오디오 파일 필터링됨(ASR 미활성화)",
|
||||
invalidFilesFiltered: "{count}개 지원되지 않는 파일 필터링됨",
|
||||
unsupportedFileType: "지원되지 않는 파일 형식",
|
||||
unsupportedTypesHint: "일부 문서 유형({types})에 사용 가능한 파서 엔진이 없어 처리할 수 없습니다",
|
||||
@@ -110,7 +112,7 @@ export default {
|
||||
andMoreFiles: "...외 {count}개 파일",
|
||||
duplicateFilesSkipped: "{count}개 중복 파일 무시됨",
|
||||
uploadFile: "파일 업로드",
|
||||
uploadFileDesc: "PDF, Word, TXT 등 지원",
|
||||
uploadFileDesc: "PDF, Word, TXT, 이미지, 동영상, 오디오 등 지원",
|
||||
importURL: "웹페이지 가져오기",
|
||||
addDocument: "문서 추가",
|
||||
importURLDesc: "URL 링크로 가져오기",
|
||||
@@ -429,6 +431,8 @@ export default {
|
||||
webSearchConfig: "웹 검색",
|
||||
enableMemory: "기억 기능 활성화",
|
||||
enableMemoryDesc: "활성화하면 시스템이 대화 기록을 저장하고 향후 대화에서 관련 내용을 자동으로 회상하여 더 개인화된 답변을 제공합니다.",
|
||||
autoCheckUpdate: '업데이트 자동 다운로드',
|
||||
autoCheckUpdateDesc: '활성화하면 시작 시 최신 버전을 자동으로 확인하고 백그라운드에서 다운로드합니다.',
|
||||
memoryRequiresNeo4j: "기억 기능은 Neo4j 그래프 데이터베이스가 필요합니다. 이 기능을 활성화하기 전에 Neo4j를 구성하고 활성화해 주세요 (NEO4J_ENABLE=true 설정).",
|
||||
memoryHowToEnable: "Neo4j 구성 가이드 보기",
|
||||
parserEngine: "파싱 엔진",
|
||||
@@ -517,6 +521,7 @@ export default {
|
||||
engineLocal: 'Local(로컬)',
|
||||
engineCos: 'Tencent Cloud COS',
|
||||
engineTos: 'Volcengine TOS',
|
||||
engineOss: 'Alibaba Cloud OSS',
|
||||
engineS3: 'AWS S3',
|
||||
localTitle: 'Local(로컬 스토리지)',
|
||||
localDesc: '서버 로컬 파일시스템에 파일을 저장합니다. 단일 노드 배포에만 적합합니다.',
|
||||
@@ -550,6 +555,10 @@ export default {
|
||||
s3Desc: 'AWS S3 및 호환 오브젝트 스토리지 서비스, 퍼블릭 클라우드 배포에 적합합니다.',
|
||||
s3AccessKeyPlaceholder: 'AWS Access Key',
|
||||
s3SecretKeyPlaceholder: 'AWS Secret Key',
|
||||
ossTitle: 'Alibaba Cloud OSS',
|
||||
ossDesc: 'Alibaba Cloud 오브젝트 스토리지 서비스(OSS), 퍼블릭 클라우드 배포에 적합합니다.',
|
||||
ossAccessKeyPlaceholder: 'Alibaba Cloud Access Key',
|
||||
ossSecretKeyPlaceholder: 'Alibaba Cloud Secret Key',
|
||||
console: '콘솔',
|
||||
docs: '문서',
|
||||
testConnection: '연결 테스트',
|
||||
@@ -561,6 +570,7 @@ export default {
|
||||
requestFailed: '요청 실패',
|
||||
cos: 'Tencent Cloud COS',
|
||||
tos: 'Volcengine TOS',
|
||||
oss: 'Alibaba Cloud OSS',
|
||||
},
|
||||
},
|
||||
webSearchSettings: {
|
||||
@@ -1007,7 +1017,11 @@ export default {
|
||||
reset: "초기화",
|
||||
clear: "지우기",
|
||||
website: "공식 웹사이트",
|
||||
chromeExtension: 'Chrome 확장 프로그램',
|
||||
clawhubSkill: 'Claw Skill',
|
||||
newBadge: 'New',
|
||||
github: 'GitHub',
|
||||
githubStarTip: 'GitHub에서 저장소로 이동합니다. 유용하다면 Star를 부탁드립니다',
|
||||
on: "켜기",
|
||||
off: "끄기",
|
||||
resetToDefault: "기본값 복원",
|
||||
@@ -1023,6 +1037,8 @@ export default {
|
||||
defaultUser: "사용자",
|
||||
copyFailed: "복사 실패",
|
||||
retry: "재시도",
|
||||
expand: "펼치기",
|
||||
collapse: "접기",
|
||||
},
|
||||
mentionDetail: {
|
||||
faqCount: "Q&A {count}개",
|
||||
@@ -1406,6 +1422,10 @@ export default {
|
||||
description: "API 키 보기 및 관리",
|
||||
keyLabel: "API 키",
|
||||
keyDescription: "API 호출에 사용되는 키, 안전하게 보관하세요",
|
||||
urlLabel: "API URL",
|
||||
urlDescription: "REST API 기본 경로입니다. 호출 시 구체적인 엔드포인트 경로를 이어서 사용하세요.",
|
||||
copyUrlTitle: "API URL 복사",
|
||||
urlCopySuccess: "API URL이 클립보드에 복사되었습니다",
|
||||
copyTitle: "API 키 복사",
|
||||
docLabel: "API 문서",
|
||||
docDescription: "전체 API 호출 문서 및 예시 보기, ",
|
||||
@@ -1422,8 +1442,28 @@ export default {
|
||||
noKey: "API 키 없음",
|
||||
copySuccess: "API 키가 클립보드에 복사되었습니다",
|
||||
copyFailed: "복사 실패, 수동으로 복사해주세요",
|
||||
desktopPortLabel: "로컬 API 포트 (데스크톱)",
|
||||
desktopPortDescription:
|
||||
"Chrome 확장 프로그램 등에서 동일한 API 주소를 쓰려면 고정 포트(예: 37841)를 지정하세요. 0이면 매번 다른 포트입니다. 저장 후 앱을 다시 시작하세요.",
|
||||
desktopPortSave: "저장",
|
||||
desktopPortSaved: "저장되었습니다. 적용하려면 앱을 다시 시작하세요.",
|
||||
desktopPortSaveFailed: "저장 실패",
|
||||
desktopPortInvalid: "0~65535 사이의 포트를 입력하세요",
|
||||
desktopBindPublicLabel: "Allow LAN access to the API",
|
||||
desktopBindPublicDescription:
|
||||
"When enabled, the embedded server listens on 0.0.0.0 so other devices on your LAN can reach the API via the address below. This increases exposure—use host firewalls and routing rules as needed. Restart the app after changing this.",
|
||||
desktopBindPublicSaved: "Saved. Restart the app for it to take effect.",
|
||||
desktopBindPublicSaveFailed: "Save failed",
|
||||
lanUrlLabel: "LAN API base URL",
|
||||
lanUrlDescription:
|
||||
"Shown after \"Allow LAN access\" is on and the app has restarted. If the IP is wrong, replace the host with your machine IPv4 from system network settings.",
|
||||
lanUrlCopyTitle: "Copy LAN API URL",
|
||||
lanUrlCopySuccess: "LAN API URL copied",
|
||||
lanUrlUnavailable:
|
||||
"The API is listening on all interfaces, but no LAN IPv4 could be detected automatically. Find your IPv4 in network settings and build http://YOUR_IP:PORT/api/v1 manually.",
|
||||
},
|
||||
},
|
||||
|
||||
system: {
|
||||
title: "시스템 정보",
|
||||
sectionDescription: "시스템 버전 정보 및 사용자 계정 설정 보기",
|
||||
@@ -1603,6 +1643,10 @@ export default {
|
||||
label: "OpenAI",
|
||||
description: "gpt-5.2, gpt-5-mini 등",
|
||||
},
|
||||
azure_openai: {
|
||||
label: 'Azure OpenAI',
|
||||
description: 'Microsoft Azure에서 호스팅되는 OpenAI 서비스',
|
||||
},
|
||||
aliyun: {
|
||||
label: "Aliyun DashScope",
|
||||
description: "qwen-plus, tongyi-embedding-vision-plus, qwen3-rerank 등",
|
||||
@@ -3139,6 +3183,8 @@ export default {
|
||||
engineTosDesc: 'Volcengine 오브젝트 스토리지, 퍼블릭 클라우드 배포에 적합',
|
||||
engineS3: 'AWS S3',
|
||||
engineS3Desc: 'AWS S3 및 호환 스토리지, 퍼블릭 클라우드 배포에 적합',
|
||||
engineOss: 'Alibaba Cloud OSS',
|
||||
engineOssDesc: 'Alibaba Cloud 오브젝트 스토리지, 퍼블릭 클라우드 배포에 적합',
|
||||
},
|
||||
parser: {
|
||||
title: '파서 엔진',
|
||||
@@ -3343,6 +3389,8 @@ export default {
|
||||
"켜면 봇 답변이 채널의 새 최상위 게시물로 올라갑니다. 끄면(기본) 스레드 답변이며 메인 화면에는 「N개 답변」만 보입니다.",
|
||||
modeHint: "WebSocket 방식이 설정이 더 간편하여 권장됩니다",
|
||||
consoleTip: "자격 증명 정보를 가져오세요",
|
||||
wecomWSEndpointHint: "선택 사항. 프라이빗 WeCom 배포 시 사용자 정의 WebSocket 주소를 입력하세요. 비워두면 기본 퍼블릭 클라우드 주소를 사용합니다. 내부 네트워크 주소의 경우 SSRF_WHITELIST 환경 변수에 호스트명을 추가하세요.",
|
||||
wecomAPIBaseURLHint: "선택 사항. 프라이빗 WeCom 배포 시 사용자 정의 API 기본 URL을 입력하세요. 비워두면 기본 퍼블릭 클라우드 주소를 사용합니다. 내부 네트워크 주소의 경우 SSRF_WHITELIST 환경 변수에 호스트명을 추가하세요.",
|
||||
fileKnowledgeBase: "파일 저장 지식 베이스",
|
||||
fileKnowledgeBasePlaceholder: "지식 베이스 선택 (선택 사항)",
|
||||
fileKnowledgeBaseHint: "설정 시 사용자가 보낸 파일이 자동으로 해당 지식 베이스에 저장됩니다",
|
||||
@@ -3516,11 +3564,15 @@ export default {
|
||||
untitled: "제목 없음",
|
||||
resourceLoadFailed: "리소스 목록 로드 실패",
|
||||
noResources: "동기화 가능한 위키 공간을 찾을 수 없습니다",
|
||||
noResourcesHint: "먼저 데이터 소스를 저장하고 권한 설정을 확인하세요",
|
||||
permissionHint: "앱이 위키 공간의 멤버로 추가되어야 콘텐츠에 접근할 수 있습니다:",
|
||||
permissionStep1: "페이슈를 열고 동기화할 위키 공간으로 이동",
|
||||
permissionStep2: "오른쪽 상단 '...' > '설정' > '멤버 관리' 클릭",
|
||||
permissionStep3: "페이슈 앱을 검색하여 위키 공간 멤버로 추가",
|
||||
noResourcesDesc: "앱이 콘텐츠를 가져오려면 그룹 채팅을 통해 위키 접근 권한을 얻어야 합니다",
|
||||
noResourcesDesc_notion: "앱이 콘텐츠를 가져오려면 Notion 페이지 접근 권한이 필요합니다",
|
||||
retryLoadResources: "다시 시도",
|
||||
guideStep1: "Feishu에서 그룹 채팅을 만들고 그룹 설정의 '그룹 봇'에 앱을 추가하세요",
|
||||
guideStep2: "위키 '설정' > '멤버 설정' > '멤버 추가'를 열고 해당 그룹 채팅을 검색하여 추가하세요",
|
||||
guideStep3: "그룹 채팅 역할이 최소 '읽기 가능'인지 확인한 후, 돌아와서 다시 시도를 클릭하세요",
|
||||
guideStep1_notion: "Notion에서 동기화하려는 페이지나 데이터베이스를 엽니다",
|
||||
guideStep2_notion: "오른쪽 상단의 '···' 메뉴를 클릭하고 'Connect to' 또는 'Add connections'를 선택합니다",
|
||||
guideStep3_notion: "Integration 앱을 검색하여 선택한 후, 돌아와서 다시 시도를 클릭하세요",
|
||||
permissionDocLink: "페이슈 위키 권한 설정 문서 보기",
|
||||
syncScheduleLabel: "동기화 주기",
|
||||
conflictLabel: "충돌 전략",
|
||||
|
||||
@@ -85,6 +85,8 @@ export default {
|
||||
noValidFilesSelected: 'Все выбранные файлы не поддерживаются',
|
||||
hiddenFilesFiltered: 'Отфильтровано {count} скрытых файлов',
|
||||
imagesFilteredNoVLM: 'Отфильтровано {count} изображений (VLM не включен)',
|
||||
videosFilteredNoVLM: 'Отфильтровано {count} видеофайлов (VLM не включен)',
|
||||
audiosFilteredNoASR: 'Отфильтровано {count} аудиофайлов (ASR не включен)',
|
||||
invalidFilesFiltered: 'Отфильтровано {count} неподдерживаемых файлов',
|
||||
unsupportedFileType: 'Неподдерживаемый тип файла',
|
||||
unsupportedTypesHint: 'Некоторые типы документов ({types}) не имеют доступного парсера и не могут быть обработаны',
|
||||
@@ -93,7 +95,7 @@ export default {
|
||||
andMoreFiles: '...и ещё {count} файлов',
|
||||
duplicateFilesSkipped: 'Пропущено {count} повторяющихся файлов',
|
||||
uploadFile: 'Загрузить файл',
|
||||
uploadFileDesc: 'Поддерживает PDF, Word, TXT и т.д.',
|
||||
uploadFileDesc: 'Поддерживает PDF, Word, TXT, изображения, видео, аудио и т.д.',
|
||||
importURL: 'Импорт из URL',
|
||||
importURLDesc: 'Импорт по ссылке URL',
|
||||
importURLTitle: 'Импорт из URL',
|
||||
@@ -546,6 +548,8 @@ export default {
|
||||
webSearchConfig: 'Сетевой поиск',
|
||||
enableMemory: 'Включить память',
|
||||
enableMemoryDesc: 'При включении система будет записывать историю ваших разговоров и автоматически вспоминать соответствующий контент в будущих беседах для более персонализированных ответов.',
|
||||
autoCheckUpdate: 'Автоматическая загрузка обновлений',
|
||||
autoCheckUpdateDesc: 'При включении автоматически проверять и скачивать последнюю версию в фоновом режиме при запуске.',
|
||||
memoryRequiresNeo4j: 'Функция памяти требует графовую базу данных Neo4j. Пожалуйста, настройте и включите Neo4j (установите NEO4J_ENABLE=true) перед активацией этой функции.',
|
||||
memoryHowToEnable: 'Руководство по настройке Neo4j',
|
||||
parserEngine: 'Движок парсинга',
|
||||
@@ -636,6 +640,7 @@ export default {
|
||||
engineLocal: 'Локальное',
|
||||
engineCos: 'Tencent Cloud COS',
|
||||
engineTos: 'Volcengine TOS',
|
||||
engineOss: 'Alibaba Cloud OSS',
|
||||
engineS3: 'AWS S3',
|
||||
localTitle: 'Локальное хранилище',
|
||||
localDesc: 'Хранение файлов в локальной файловой системе сервера. Подходит только для однонодового развёртывания.',
|
||||
@@ -669,6 +674,10 @@ export default {
|
||||
s3Desc: 'AWS S3 и совместимые сервисы объектного хранилища для публичного облака.',
|
||||
s3AccessKeyPlaceholder: 'AWS Access Key',
|
||||
s3SecretKeyPlaceholder: 'AWS Secret Key',
|
||||
ossTitle: 'Alibaba Cloud OSS',
|
||||
ossDesc: 'Объектное хранилище Alibaba Cloud (OSS), подходит для публичного облака.',
|
||||
ossAccessKeyPlaceholder: 'Alibaba Cloud Access Key',
|
||||
ossSecretKeyPlaceholder: 'Alibaba Cloud Secret Key',
|
||||
console: 'Консоль',
|
||||
docs: 'Документация',
|
||||
testConnection: 'Тест подключения',
|
||||
@@ -679,7 +688,8 @@ export default {
|
||||
unknownError: 'Неизвестная ошибка',
|
||||
requestFailed: 'Ошибка запроса',
|
||||
cos: 'Tencent Cloud COS',
|
||||
tos: 'Volcengine TOS'
|
||||
tos: 'Volcengine TOS',
|
||||
oss: 'Alibaba Cloud OSS',
|
||||
}
|
||||
},
|
||||
webSearchSettings: {
|
||||
@@ -1121,7 +1131,11 @@ export default {
|
||||
reset: 'Сбросить',
|
||||
clear: 'Очистить',
|
||||
website: 'Официальный сайт',
|
||||
chromeExtension: 'Расширение Chrome',
|
||||
clawhubSkill: 'Claw Skill',
|
||||
newBadge: 'New',
|
||||
github: 'GitHub',
|
||||
githubStarTip: 'Открыть репозиторий на GitHub — поставьте Star, если проект полезен',
|
||||
on: 'Вкл',
|
||||
off: 'Выкл',
|
||||
resetToDefault: 'Сбросить по умолчанию',
|
||||
@@ -1137,6 +1151,8 @@ export default {
|
||||
defaultUser: 'Пользователь',
|
||||
copyFailed: 'Ошибка копирования',
|
||||
retry: 'Повторить',
|
||||
expand: 'Развернуть',
|
||||
collapse: 'Свернуть',
|
||||
me: 'Я',
|
||||
copy: 'Копировать',
|
||||
copied: 'Скопировано'
|
||||
@@ -1248,6 +1264,10 @@ export default {
|
||||
description: 'Просматривайте и управляйте своим API-ключом',
|
||||
keyLabel: 'API Key',
|
||||
keyDescription: 'Ключ для API-запросов. Храните его в безопасности.',
|
||||
urlLabel: 'URL API',
|
||||
urlDescription: 'Базовый путь REST API; при вызове добавляйте конкретный путь эндпоинта.',
|
||||
copyUrlTitle: 'Скопировать URL API',
|
||||
urlCopySuccess: 'URL API скопирован в буфер обмена',
|
||||
copyTitle: 'Скопировать API Key',
|
||||
docLabel: 'Документация API',
|
||||
docDescription: 'Ознакомьтесь с полной документацией и примерами API,',
|
||||
@@ -1263,7 +1283,26 @@ export default {
|
||||
createdAtDescription: 'Время создания учётной записи',
|
||||
noKey: 'API Key отсутствует',
|
||||
copySuccess: 'API Key скопирован в буфер обмена',
|
||||
copyFailed: 'Не удалось скопировать, пожалуйста, сделайте это вручную'
|
||||
copyFailed: 'Не удалось скопировать, пожалуйста, сделайте это вручную',
|
||||
desktopPortLabel: 'Локальный порт API (desktop)',
|
||||
desktopPortDescription:
|
||||
'Укажите фиксированный порт (например, 37841), чтобы расширение Chrome и другие инструменты всегда использовали один URL API. 0 — случайный порт при каждом запуске. После сохранения перезапустите приложение.',
|
||||
desktopPortSave: 'Сохранить',
|
||||
desktopPortSaved: 'Сохранено. Перезапустите приложение, чтобы применить.',
|
||||
desktopPortSaveFailed: 'Не удалось сохранить',
|
||||
desktopPortInvalid: 'Введите порт от 0 до 65535',
|
||||
desktopBindPublicLabel: 'Разрешить доступ к API в LAN',
|
||||
desktopBindPublicDescription:
|
||||
'Встроенный сервер слушает 0.0.0.0 — другие устройства в локальной сети смогут обращаться к API по адресу ниже. Риски доступа выше; настройте брандмауэр и маршрутизацию. После изменения перезапустите приложение.',
|
||||
desktopBindPublicSaved: 'Сохранено. Перезапустите приложение, чтобы применить.',
|
||||
desktopBindPublicSaveFailed: 'Не удалось сохранить',
|
||||
lanUrlLabel: 'Базовый URL API для LAN',
|
||||
lanUrlDescription:
|
||||
'Отображается после включения доступа в LAN и перезапуска. Если IP неверный, подставьте IPv4 из сетевых настроек системы.',
|
||||
lanUrlCopyTitle: 'Копировать LAN URL API',
|
||||
lanUrlCopySuccess: 'LAN URL API скопирован',
|
||||
lanUrlUnavailable:
|
||||
'API слушает все интерфейсы, но LAN IPv4 не удалось определить автоматически. Узнайте IPv4 в настройках сети и соберите http://ВАШ_IP:ПОРТ/api/v1 вручную.',
|
||||
}
|
||||
},
|
||||
system: {
|
||||
@@ -1442,6 +1481,10 @@ export default {
|
||||
label: 'OpenAI',
|
||||
description: 'gpt-5.2, gpt-5-mini, etc.'
|
||||
},
|
||||
azure_openai: {
|
||||
label: 'Azure OpenAI',
|
||||
description: 'Сервис OpenAI на платформе Microsoft Azure',
|
||||
},
|
||||
aliyun: {
|
||||
label: 'Aliyun DashScope',
|
||||
description: 'qwen-plus, tongyi-embedding-vision-plus, qwen3-rerank, etc.'
|
||||
@@ -2755,6 +2798,8 @@ export default {
|
||||
engineTosDesc: 'Объектное хранилище Volcengine, для публичного облака',
|
||||
engineS3: 'AWS S3',
|
||||
engineS3Desc: 'AWS S3 и совместимые хранилища, для публичного облака',
|
||||
engineOss: 'Alibaba Cloud OSS',
|
||||
engineOssDesc: 'Объектное хранилище Alibaba Cloud, для публичного облака',
|
||||
},
|
||||
parser: {
|
||||
title: 'Парсер',
|
||||
@@ -2982,6 +3027,8 @@ export default {
|
||||
'Включено — ответы бота как новые сообщения в канале. Выключено (по умолчанию) — ответы в ветке, в основном окне только «N ответов».',
|
||||
modeHint: 'Рекомендуется WebSocket — проще настроить',
|
||||
consoleTip: 'для получения учётных данных',
|
||||
wecomWSEndpointHint: 'Необязательно. Для приватного развёртывания WeCom укажите пользовательский адрес WebSocket. Оставьте пустым для публичного облака. Для адресов внутренней сети добавьте имя хоста в переменную SSRF_WHITELIST.',
|
||||
wecomAPIBaseURLHint: 'Необязательно. Для приватного развёртывания WeCom укажите пользовательский базовый URL API. Оставьте пустым для публичного облака. Для адресов внутренней сети добавьте имя хоста в переменную SSRF_WHITELIST.',
|
||||
fileKnowledgeBase: 'База знаний для файлов',
|
||||
fileKnowledgeBasePlaceholder: 'Выберите базу знаний (необязательно)',
|
||||
fileKnowledgeBaseHint: 'При настройке файлы, отправленные пользователями, автоматически сохраняются в эту базу знаний',
|
||||
@@ -3423,11 +3470,15 @@ export default {
|
||||
untitled: 'Без названия',
|
||||
resourceLoadFailed: 'Не удалось загрузить список ресурсов',
|
||||
noResources: 'Пространства вики не найдены',
|
||||
noResourcesHint: 'Сначала сохраните источник данных и проверьте права доступа',
|
||||
permissionHint: 'Приложение должно быть добавлено как участник пространства вики для доступа к контенту:',
|
||||
permissionStep1: 'Откройте Feishu и перейдите в пространство вики для синхронизации',
|
||||
permissionStep2: 'Нажмите "..." > "Настройки" > "Управление участниками"',
|
||||
permissionStep3: 'Найдите и добавьте приложение Feishu как участника пространства',
|
||||
noResourcesDesc: 'Приложению требуется доступ к вики через групповой чат для получения контента',
|
||||
noResourcesDesc_notion: 'Приложению требуются права доступа к странице Notion для получения контента',
|
||||
retryLoadResources: 'Повторить',
|
||||
guideStep1: 'Создайте групповой чат в Feishu, затем добавьте ваше приложение как бота в настройках группы',
|
||||
guideStep2: 'Откройте вики "Настройки" > "Управление участниками" > "Добавить участника", найдите групповой чат и добавьте его',
|
||||
guideStep3: 'Убедитесь, что роль группового чата как минимум "Может читать", затем вернитесь и нажмите Повторить',
|
||||
guideStep1_notion: 'Откройте страницу или базу данных, которую хотите синхронизировать в Notion',
|
||||
guideStep2_notion: 'Нажмите меню «···» в правом верхнем углу, выберите «Connect to» или «Add connections»',
|
||||
guideStep3_notion: 'Найдите и выберите ваше интеграционное приложение, затем вернитесь и нажмите Повторить',
|
||||
permissionDocLink: 'Документация по настройке прав доступа',
|
||||
syncScheduleLabel: 'Расписание синхронизации',
|
||||
conflictLabel: 'Стратегия конфликтов',
|
||||
|
||||
@@ -102,6 +102,8 @@ export default {
|
||||
noValidFilesSelected: "选中的文件均不支持",
|
||||
hiddenFilesFiltered: "已过滤 {count} 个隐藏文件",
|
||||
imagesFilteredNoVLM: "已过滤 {count} 个图片文件(未启用VLM)",
|
||||
videosFilteredNoVLM: "已过滤 {count} 个视频文件(未启用VLM)",
|
||||
audiosFilteredNoASR: "已过滤 {count} 个音频文件(未启用ASR)",
|
||||
invalidFilesFiltered: "已过滤 {count} 个不支持的文件",
|
||||
unsupportedFileType: "不支持的文件格式",
|
||||
unsupportedTypesHint: "部分文档类型({types})暂无可用解析引擎,上传后将无法解析",
|
||||
@@ -110,7 +112,7 @@ export default {
|
||||
andMoreFiles: "...及其他 {count} 个文件",
|
||||
duplicateFilesSkipped: "已忽略 {count} 个重复文件",
|
||||
uploadFile: "上传文件",
|
||||
uploadFileDesc: "支持 PDF、Word、TXT 等",
|
||||
uploadFileDesc: "支持 PDF、Word、TXT、图片、视频、音频等",
|
||||
importURL: "导入网页",
|
||||
addDocument: "添加文档",
|
||||
importURLDesc: "通过URL链接导入",
|
||||
@@ -426,6 +428,8 @@ export default {
|
||||
webSearchConfig: "网络搜索",
|
||||
enableMemory: "开启记忆功能",
|
||||
enableMemoryDesc: "开启后,系统将记录您的对话历史,并在后续对话中自动回忆相关内容,提供更个性化的回答。",
|
||||
autoCheckUpdate: '自动下载更新',
|
||||
autoCheckUpdateDesc: '开启后自动检查并在后台下载最新版本安装包。',
|
||||
memoryRequiresNeo4j: "记忆功能依赖 Neo4j 图数据库,请先配置并启用 Neo4j(设置环境变量 NEO4J_ENABLE=true)后再开启此功能。",
|
||||
memoryHowToEnable: "查看 Neo4j 配置指南",
|
||||
parserEngine: "解析引擎",
|
||||
@@ -514,6 +518,7 @@ export default {
|
||||
engineLocal: "Local(本地)",
|
||||
engineCos: "腾讯云 COS",
|
||||
engineTos: "火山引擎 TOS",
|
||||
engineOss: "阿里云 OSS",
|
||||
engineS3: "AWS S3",
|
||||
localTitle: "Local(本地存储)",
|
||||
localDesc: "使用服务器本地文件系统存储文件,仅适合单机部署。",
|
||||
@@ -547,6 +552,10 @@ export default {
|
||||
s3Desc: "AWS S3 及兼容的对象存储服务,适合公有云部署。",
|
||||
s3AccessKeyPlaceholder: "AWS Access Key",
|
||||
s3SecretKeyPlaceholder: "AWS Secret Key",
|
||||
ossTitle: "阿里云 OSS",
|
||||
ossDesc: "阿里云对象存储服务(OSS),适合公有云部署。",
|
||||
ossAccessKeyPlaceholder: "阿里云 Access Key",
|
||||
ossSecretKeyPlaceholder: "阿里云 Secret Key",
|
||||
console: "控制台",
|
||||
docs: "文档",
|
||||
testConnection: "测试连接",
|
||||
@@ -558,6 +567,7 @@ export default {
|
||||
requestFailed: "请求失败",
|
||||
cos: "腾讯云 COS",
|
||||
tos: "火山引擎 TOS",
|
||||
oss: "阿里云 OSS",
|
||||
},
|
||||
},
|
||||
webSearchSettings: {
|
||||
@@ -1011,7 +1021,11 @@ export default {
|
||||
reset: "重置",
|
||||
clear: "清空",
|
||||
website: "官方网站",
|
||||
chromeExtension: "Chrome 插件",
|
||||
clawhubSkill: "Claw Skill",
|
||||
newBadge: "New",
|
||||
github: 'GitHub',
|
||||
githubStarTip: '在 GitHub 打开仓库,若觉得有用欢迎点个 Star',
|
||||
on: "开启",
|
||||
off: "关闭",
|
||||
resetToDefault: "恢复默认",
|
||||
@@ -1027,6 +1041,8 @@ export default {
|
||||
defaultUser: "用户",
|
||||
copyFailed: "复制失败",
|
||||
retry: "重试",
|
||||
expand: "展开",
|
||||
collapse: "收起",
|
||||
},
|
||||
mentionDetail: {
|
||||
faqCount: "共 {count} 条问答",
|
||||
@@ -1400,6 +1416,10 @@ export default {
|
||||
description: "查看和管理您的 API 密钥",
|
||||
keyLabel: "API Key",
|
||||
keyDescription: "用于 API 调用的密钥,请妥善保管",
|
||||
urlLabel: "API 地址",
|
||||
urlDescription: "REST API 的基础路径,请求时在末尾拼接具体接口路径",
|
||||
copyUrlTitle: "复制 API 地址",
|
||||
urlCopySuccess: "API 地址已复制到剪贴板",
|
||||
copyTitle: "复制 API Key",
|
||||
docLabel: "API 文档",
|
||||
docDescription: "查看完整的 API 调用文档和示例,",
|
||||
@@ -1416,6 +1436,25 @@ export default {
|
||||
noKey: "暂无 API Key",
|
||||
copySuccess: "API Key 已复制到剪贴板",
|
||||
copyFailed: "复制失败,请手动复制",
|
||||
desktopPortLabel: "本地 API 端口(桌面版)",
|
||||
desktopPortDescription:
|
||||
"填写固定端口(如 37841)后,Chrome 扩展等工具可长期使用同一 API 地址;0 表示每次启动随机端口。保存后请重启应用生效。",
|
||||
desktopPortSave: "保存",
|
||||
desktopPortSaved: "已保存,请重启应用后生效",
|
||||
desktopPortSaveFailed: "保存失败",
|
||||
desktopPortInvalid: "请输入 0–65535 之间的端口",
|
||||
desktopBindPublicLabel: "允许局域网访问 API",
|
||||
desktopBindPublicDescription:
|
||||
"开启后内嵌服务监听 0.0.0.0,同一局域网内其他设备可通过下方地址调用 API。存在数据暴露风险,请在防火墙与路由侧自行做好访问控制;修改后需重启应用。",
|
||||
desktopBindPublicSaved: "已保存,请重启应用后生效",
|
||||
desktopBindPublicSaveFailed: "保存失败",
|
||||
lanUrlLabel: "局域网 API 地址",
|
||||
lanUrlDescription:
|
||||
"在已开启「允许局域网访问」且应用已重启后显示;若 IP 不准确,请在本机网络设置中查看实际 IPv4 后替换主机部分。",
|
||||
lanUrlCopyTitle: "复制局域网 API 地址",
|
||||
lanUrlCopySuccess: "局域网 API 地址已复制",
|
||||
lanUrlUnavailable:
|
||||
"当前已监听所有网卡,但未能自动识别本机 IPv4。请在本机网络设置中查看局域网地址,并手动拼接为 http://你的IP:端口/api/v1。",
|
||||
},
|
||||
},
|
||||
system: {
|
||||
@@ -1595,6 +1634,10 @@ export default {
|
||||
label: "OpenAI",
|
||||
description: "gpt-5.2, gpt-5-mini, etc.",
|
||||
},
|
||||
azure_openai: {
|
||||
label: 'Azure OpenAI',
|
||||
description: 'Microsoft Azure 上的 OpenAI 服务',
|
||||
},
|
||||
aliyun: {
|
||||
label: "阿里云 DashScope",
|
||||
description: "qwen-plus, tongyi-embedding-vision-plus, qwen3-rerank, etc.",
|
||||
@@ -3083,6 +3126,8 @@ export default {
|
||||
engineTosDesc: "火山引擎对象存储,适合公有云部署",
|
||||
engineS3: "AWS S3",
|
||||
engineS3Desc: "AWS S3 及兼容存储,适合公有云部署",
|
||||
engineOss: "阿里云 OSS",
|
||||
engineOssDesc: "阿里云对象存储,适合公有云部署",
|
||||
},
|
||||
parser: {
|
||||
title: "解析引擎",
|
||||
@@ -3257,13 +3302,14 @@ export default {
|
||||
},
|
||||
im: {
|
||||
title: "IM 集成",
|
||||
description: "将智能体接入即时通讯平台,支持企业微信、飞书、Slack、Telegram、钉钉和 Mattermost",
|
||||
description: "将智能体接入即时通讯平台,支持企业微信、飞书、Slack、Telegram、钉钉、Mattermost和微信",
|
||||
wecom: "企业微信",
|
||||
feishu: "飞书",
|
||||
slack: "Slack",
|
||||
telegram: "Telegram",
|
||||
dingtalk: "钉钉",
|
||||
mattermost: "Mattermost",
|
||||
wechat: "微信",
|
||||
addChannel: "添加渠道",
|
||||
editChannel: "编辑渠道",
|
||||
deleteConfirm: "确定删除该渠道?删除后无法恢复。",
|
||||
@@ -3291,6 +3337,8 @@ export default {
|
||||
"开启后 Bot 回复作为频道内新帖子;关闭(默认)则作为原消息的线程回复,主窗口仅显示「N 条回复」。",
|
||||
modeHint: "推荐使用 WebSocket 方式接入,配置更简单",
|
||||
consoleTip: "前往获取凭证信息",
|
||||
wecomWSEndpointHint: "可选,私有化部署时填写自定义 WebSocket 地址,留空则使用默认公有云地址。内网地址需将域名加入 SSRF_WHITELIST 环境变量",
|
||||
wecomAPIBaseURLHint: "可选,私有化部署时填写自定义 API 地址,留空则使用默认公有云地址。内网地址需将域名加入 SSRF_WHITELIST 环境变量",
|
||||
fileKnowledgeBase: "文件保存知识库",
|
||||
fileKnowledgeBasePlaceholder: "选择知识库(可选)",
|
||||
fileKnowledgeBaseHint: "配置后,用户发送的文件将自动保存到该知识库中",
|
||||
@@ -3298,6 +3346,13 @@ export default {
|
||||
sessionModeUser: "按用户(默认)",
|
||||
sessionModeThread: "按话题",
|
||||
sessionModeHint: "用户模式:每个用户独立对话,使用 /clear 开始新对话。话题模式:每个消息话题独立对话,同一话题中多人可协作。",
|
||||
wechatScanBind: "扫码绑定微信",
|
||||
wechatScanning: "请使用微信扫描二维码",
|
||||
wechatBindSuccess: "微信绑定成功",
|
||||
wechatRebind: "重新绑定",
|
||||
wechatHint: "需要 iOS 微信 8.0.70+ 版本,仅支持单聊消息",
|
||||
wechatQRExpired: "二维码已过期,请重新获取",
|
||||
wechatBinding: "绑定中...",
|
||||
},
|
||||
tools: {
|
||||
thinking: "思考",
|
||||
@@ -3463,11 +3518,15 @@ export default {
|
||||
untitled: "无标题",
|
||||
resourceLoadFailed: "加载资源列表失败",
|
||||
noResources: "未找到可同步的知识库空间",
|
||||
noResourcesDesc: "应用需要通过群聊获得知识库访问权限才能拉取内容",
|
||||
noResourcesDesc: "应用需要通过群聊获得知识库访问权限才能拉取内容",
|
||||
noResourcesDesc_notion: "应用需要获得 Notion 页面的访问权限才能拉取内容",
|
||||
retryLoadResources: "重新加载",
|
||||
guideStep1: "在飞书中创建一个群聊,在群设置「群机器人」中添加你的应用",
|
||||
guideStep2: "打开知识库「设置」→「成员设置」→ 添加成员,搜索该群聊名称并添加",
|
||||
guideStep3: "确保群聊角色至少为「可阅读」,然后回到这里点重新加载",
|
||||
guideStep1_notion: "在 Notion 中打开你想要同步的页面或数据库",
|
||||
guideStep2_notion: "点击右上角的「···」菜单,选择「Connect to」或「Add connections」",
|
||||
guideStep3_notion: "搜索并选择你的集成应用(Integration),然后回到这里点重新加载",
|
||||
permissionDocLink: "查看飞书知识库权限配置文档",
|
||||
syncScheduleLabel: "同步频率",
|
||||
conflictLabel: "冲突策略",
|
||||
|
||||
@@ -20,4 +20,7 @@ app.use(createPinia());
|
||||
app.use(router);
|
||||
app.use(i18n);
|
||||
|
||||
app.mount("#app");
|
||||
// 等首屏路由(含导航守卫、Lite 自动登录)完成后再挂载,避免先闪默认页再跳转
|
||||
router.isReady().finally(() => {
|
||||
app.mount("#app");
|
||||
});
|
||||
|
||||
@@ -1,7 +1,27 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { listKnowledgeBases } from '@/api/knowledge-base'
|
||||
import type { RouteLocationNormalized } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { validateToken } from '@/api/auth'
|
||||
import { autoSetup } from '@/api/auth'
|
||||
|
||||
/** Lite /桌面 WebView 硬刷新时可能只打开 `/`,用 session 记住上次页面以便恢复 */
|
||||
const LITE_LAST_PATH_KEY = 'weknora_lite_last_path'
|
||||
|
||||
function isLiteEdition(authStore: ReturnType<typeof useAuthStore>) {
|
||||
return authStore.isLiteMode || localStorage.getItem('weknora_lite_mode') === 'true'
|
||||
}
|
||||
|
||||
function isLiteSpaDefaultEntry(to: RouteLocationNormalized) {
|
||||
return (
|
||||
to.path === '/' ||
|
||||
to.path === '/platform' ||
|
||||
to.path === '/platform/knowledge-bases' ||
|
||||
to.name === 'knowledgeBaseList'
|
||||
)
|
||||
}
|
||||
|
||||
function isSafeLiteRestoreTarget(path: string) {
|
||||
return path.startsWith('/platform/') && !path.startsWith('/platform/organizations')
|
||||
}
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
@@ -105,10 +125,55 @@ const router = createRouter({
|
||||
],
|
||||
});
|
||||
|
||||
// 持久化 auto-setup / login 返回的认证信息到 store
|
||||
function persistLoginResponse(authStore: ReturnType<typeof useAuthStore>, response: any) {
|
||||
if (response.user && response.tenant && response.token) {
|
||||
authStore.setUser({
|
||||
id: response.user.id || '',
|
||||
username: response.user.username || '',
|
||||
email: response.user.email || '',
|
||||
avatar: response.user.avatar,
|
||||
tenant_id: String(response.tenant.id) || '',
|
||||
can_access_all_tenants: response.user.can_access_all_tenants || false,
|
||||
created_at: response.user.created_at || new Date().toISOString(),
|
||||
updated_at: response.user.updated_at || new Date().toISOString()
|
||||
})
|
||||
authStore.setToken(response.token)
|
||||
if (response.refresh_token) {
|
||||
authStore.setRefreshToken(response.refresh_token)
|
||||
}
|
||||
authStore.setTenant({
|
||||
id: String(response.tenant.id) || '',
|
||||
name: response.tenant.name || '',
|
||||
api_key: response.tenant.api_key || '',
|
||||
owner_id: response.user.id || '',
|
||||
created_at: response.tenant.created_at || new Date().toISOString(),
|
||||
updated_at: response.tenant.updated_at || new Date().toISOString()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let autoSetupAttempted = false
|
||||
let liteDeepLinkRestoreDone = false
|
||||
|
||||
// 路由守卫:检查认证状态和系统初始化状态
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const authStore = useAuthStore()
|
||||
|
||||
|
||||
// Lite:硬刷新后若落在默认首页,恢复本次会话中最后访问的 /platform 子路径
|
||||
if (!liteDeepLinkRestoreDone) {
|
||||
liteDeepLinkRestoreDone = true
|
||||
if (isLiteEdition(authStore)) {
|
||||
const saved = sessionStorage.getItem(LITE_LAST_PATH_KEY)
|
||||
if (saved && isSafeLiteRestoreTarget(saved) && isLiteSpaDefaultEntry(to)) {
|
||||
if (saved !== to.fullPath) {
|
||||
next(saved)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果访问的是登录页面或初始化页面,直接放行
|
||||
if (to.meta.requiresAuth === false || to.meta.requiresInit === false) {
|
||||
// 如果已登录用户访问登录页面,重定向到知识库列表页面
|
||||
@@ -123,29 +188,34 @@ router.beforeEach(async (to, from, next) => {
|
||||
// 检查用户认证状态
|
||||
if (to.meta.requiresAuth !== false) {
|
||||
if (!authStore.isLoggedIn) {
|
||||
// 未登录,跳转到登录页面
|
||||
// Lite 版:尝试自动初始化(仅一次),成功则跳过登录页
|
||||
if (!autoSetupAttempted) {
|
||||
autoSetupAttempted = true
|
||||
try {
|
||||
const response = await autoSetup()
|
||||
if (response.success) {
|
||||
persistLoginResponse(authStore, response)
|
||||
authStore.setLiteMode(true)
|
||||
next(to.fullPath)
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
// auto-setup 不可用(非 lite 版本),走正常登录流程
|
||||
}
|
||||
}
|
||||
next('/login')
|
||||
return
|
||||
}
|
||||
|
||||
// 验证Token有效性
|
||||
// try {
|
||||
// const { valid } = await validateToken()
|
||||
// if (!valid) {
|
||||
// // Token无效,清空认证信息并跳转到登录页面
|
||||
// authStore.logout()
|
||||
// next('/login')
|
||||
// return
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Token验证失败:', error)
|
||||
// authStore.logout()
|
||||
// next('/login')
|
||||
// return
|
||||
// }
|
||||
}
|
||||
|
||||
next()
|
||||
});
|
||||
})
|
||||
|
||||
router.afterEach((to) => {
|
||||
if (!isLiteEdition(useAuthStore())) return
|
||||
if (to.path === '/login') return
|
||||
if (!to.path.startsWith('/platform')) return
|
||||
sessionStorage.setItem(LITE_LAST_PATH_KEY, to.fullPath)
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
@@ -15,6 +15,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
const selectedTenantId = ref<number | null>(null)
|
||||
const selectedTenantName = ref<string | null>(null)
|
||||
const allTenants = ref<TenantInfoFromAPI[]>([])
|
||||
const isLiteMode = ref(false)
|
||||
|
||||
// 计算属性
|
||||
const isLoggedIn = computed(() => {
|
||||
@@ -102,6 +103,14 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
return selectedTenantId.value
|
||||
}
|
||||
|
||||
const setLiteMode = (value: boolean) => {
|
||||
isLiteMode.value = value
|
||||
if (value) {
|
||||
localStorage.setItem('weknora_lite_mode', 'true')
|
||||
} else {
|
||||
localStorage.removeItem('weknora_lite_mode')
|
||||
}
|
||||
}
|
||||
|
||||
const logout = () => {
|
||||
// 清空状态
|
||||
@@ -124,7 +133,13 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
localStorage.removeItem('weknora_current_kb')
|
||||
localStorage.removeItem('weknora_selected_tenant_id')
|
||||
localStorage.removeItem('weknora_selected_tenant_name')
|
||||
|
||||
localStorage.removeItem('weknora_lite_mode')
|
||||
isLiteMode.value = false
|
||||
try {
|
||||
sessionStorage.removeItem('weknora_lite_last_path')
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
const initFromStorage = () => {
|
||||
@@ -192,6 +207,8 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
selectedTenantName.value = null
|
||||
}
|
||||
}
|
||||
|
||||
isLiteMode.value = localStorage.getItem('weknora_lite_mode') === 'true'
|
||||
}
|
||||
|
||||
// 初始化时从localStorage恢复状态
|
||||
@@ -216,6 +233,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
currentUserId,
|
||||
canAccessAllTenants,
|
||||
effectiveTenantId,
|
||||
isLiteMode,
|
||||
|
||||
// 方法
|
||||
setUser,
|
||||
@@ -227,6 +245,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
setSelectedTenant,
|
||||
setAllTenants,
|
||||
getSelectedTenant,
|
||||
setLiteMode,
|
||||
logout,
|
||||
initFromStorage
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { reactive, ref, computed, watch } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import i18n from '@/i18n'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
type MenuChild = Record<string, any>
|
||||
|
||||
@@ -58,6 +59,16 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
}
|
||||
)
|
||||
|
||||
const liteHiddenPaths = new Set(['logout', 'organizations'])
|
||||
|
||||
const visibleMenuArr = computed(() => {
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.isLiteMode) {
|
||||
return menuArr.filter(item => !liteHiddenPaths.has(item.path))
|
||||
}
|
||||
return menuArr
|
||||
})
|
||||
|
||||
const chatMenuIndex = menuArr.findIndex(item => item.path === 'creatChat')
|
||||
|
||||
const clearMenuArr = () => {
|
||||
@@ -120,6 +131,7 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
|
||||
return {
|
||||
menuArr,
|
||||
visibleMenuArr,
|
||||
isFirstSession,
|
||||
firstQuery,
|
||||
firstMentionedItems,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { BUILTIN_QUICK_ANSWER_ID, BUILTIN_SMART_REASONING_ID } from "@/api/agent";
|
||||
import { getApiBaseUrl } from "@/utils/api-base";
|
||||
|
||||
// 定义设置接口
|
||||
interface Settings {
|
||||
@@ -18,6 +19,7 @@ interface Settings {
|
||||
conversationModels: ConversationModels;
|
||||
selectedAgentId: string; // 当前选中的智能体ID
|
||||
selectedAgentSourceTenantId: string | null; // 当使用共享智能体时,来源租户 ID(用于后端 model/KB/MCP 解析)
|
||||
autoCheckUpdate?: boolean; // 是否自动检查并下载更新
|
||||
}
|
||||
|
||||
// Agent 配置接口
|
||||
@@ -63,7 +65,7 @@ interface OllamaConfig {
|
||||
|
||||
// 默认设置
|
||||
const defaultSettings: Settings = {
|
||||
endpoint: import.meta.env.VITE_IS_DOCKER ? "" : "http://localhost:8080",
|
||||
endpoint: getApiBaseUrl(),
|
||||
apiKey: "",
|
||||
knowledgeBaseId: "",
|
||||
isAgentEnabled: false,
|
||||
@@ -95,6 +97,7 @@ const defaultSettings: Settings = {
|
||||
},
|
||||
selectedAgentId: BUILTIN_QUICK_ANSWER_ID, // 默认选中快速问答模式
|
||||
selectedAgentSourceTenantId: null as string | null, // 共享智能体来源租户 ID
|
||||
autoCheckUpdate: true,
|
||||
};
|
||||
|
||||
export const useSettingsStore = defineStore("settings", {
|
||||
@@ -143,6 +146,9 @@ export const useSettingsStore = defineStore("settings", {
|
||||
// 记忆功能是否启用
|
||||
isMemoryEnabled: (state) => state.settings.enableMemory || false,
|
||||
|
||||
// 是否自动检查并下载更新
|
||||
isAutoCheckUpdateEnabled: (state) => state.settings.autoCheckUpdate ?? true,
|
||||
|
||||
// 当前选中的智能体ID
|
||||
selectedAgentId: (state) => state.settings.selectedAgentId || BUILTIN_QUICK_ANSWER_ID,
|
||||
// 共享智能体来源租户 ID(可选)
|
||||
@@ -307,6 +313,12 @@ export const useSettingsStore = defineStore("settings", {
|
||||
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
|
||||
},
|
||||
|
||||
// 启用/禁用自动检查更新
|
||||
toggleAutoCheckUpdate(enabled: boolean) {
|
||||
this.settings.autoCheckUpdate = enabled;
|
||||
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
|
||||
},
|
||||
|
||||
// File selection actions
|
||||
addFile(fileId: string) {
|
||||
if (!this.settings.selectedFiles) this.settings.selectedFiles = [];
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export function getApiBaseUrl(): string {
|
||||
// Use same-origin requests by default.
|
||||
// In local Vite dev, `vite.config.ts` proxies `/api` to the Go backend.
|
||||
return '';
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export function formatStringDate(date: any) {
|
||||
year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
|
||||
);
|
||||
}
|
||||
const DEFAULT_VALID_TYPES = new Set(["pdf", "txt", "md", "docx", "doc", "pptx", "ppt", "jpg", "jpeg", "png", "csv", "xlsx", "xls"]);
|
||||
const DEFAULT_VALID_TYPES = new Set(["pdf", "txt", "md", "docx", "doc", "pptx", "ppt", "jpg", "jpeg", "png", "csv", "xlsx", "xls", "mp4", "mov", "avi", "mkv", "webm", "wmv", "flv", "mp3", "wav", "m4a", "flac", "ogg"]);
|
||||
|
||||
/**
|
||||
* Returns true when the file should be **rejected**.
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
import axios from "axios";
|
||||
import { generateRandomString } from "./index";
|
||||
import i18n from '@/i18n'
|
||||
import { getApiBaseUrl } from './api-base';
|
||||
|
||||
const t = (key: string) => i18n.global.t(key)
|
||||
|
||||
// API基础URL
|
||||
const BASE_URL = import.meta.env.VITE_IS_DOCKER ? "" : "http://localhost:8080";
|
||||
const BASE_URL = getApiBaseUrl();
|
||||
|
||||
|
||||
// 创建Axios实例
|
||||
|
||||
@@ -41,7 +41,7 @@ const DOMPurifyConfig = {
|
||||
'display', 'pointer-events', 'cursor', 'data-emit', 'direction'
|
||||
],
|
||||
// 允许的协议
|
||||
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|(?:local|minio|cos|tos|s3):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,
|
||||
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|(?:local|minio|cos|tos|s3|oss):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,
|
||||
// 禁止的标签和属性
|
||||
FORBID_TAGS: ['script', 'object', 'embed', 'form', 'input', 'button'],
|
||||
FORBID_ATTR: ['onerror', 'onload', 'onclick', 'onmouseover', 'onfocus', 'onblur'],
|
||||
@@ -119,7 +119,7 @@ function protectProviderImageSrcInHTML(html: string): string {
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"');
|
||||
return html.replace(
|
||||
/<img\b([^>]*?)\ssrc=(["'])(local|minio|cos|tos|s3):(?:\/\/|//|//)([^"']+)\2([^>]*)>/gi,
|
||||
/<img\b([^>]*?)\ssrc=(["'])(local|minio|cos|tos|s3|oss):(?:\/\/|//|//)([^"']+)\2([^>]*)>/gi,
|
||||
(_m, before, quote, provider, restPathRaw, after) => {
|
||||
const restPath = decodeProviderURL(restPathRaw);
|
||||
const protectedSrc = `${provider}://${restPath}`;
|
||||
@@ -173,7 +173,7 @@ export function isValidURL(url: string): boolean {
|
||||
}
|
||||
|
||||
// 允许 provider:// 形式,由前端后续鉴权拉取并替换为 blob URL
|
||||
if (/^(local|minio|cos|tos|s3):\/\/\S+$/i.test(trimmed)) {
|
||||
if (/^(local|minio|cos|tos|s3|oss):\/\/\S+$/i.test(trimmed)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ export async function hydrateProtectedFileImages(root: ParentNode | null | undef
|
||||
}
|
||||
|
||||
const images = root.querySelectorAll<HTMLImageElement>(
|
||||
'img[data-protected-src], img[src^="local://"], img[src^="minio://"], img[src^="cos://"], img[src^="tos://"], img[src^="s3://"]',
|
||||
'img[data-protected-src], img[src^="local://"], img[src^="minio://"], img[src^="cos://"], img[src^="tos://"], img[src^="s3://"], img[src^="oss://"]',
|
||||
);
|
||||
if (!images.length) {
|
||||
return;
|
||||
@@ -319,7 +319,7 @@ export async function hydrateProtectedFileImages(root: ParentNode | null | undef
|
||||
}
|
||||
img.dataset.authHydrated = '1';
|
||||
|
||||
const isProviderScheme = /^(local|minio|cos|tos|s3):\/\//.test(sourceURL);
|
||||
const isProviderScheme = /^(local|minio|cos|tos|s3|oss):\/\//.test(sourceURL);
|
||||
const requestURL = isProviderScheme
|
||||
? `/files?${new URLSearchParams({ file_path: sourceURL }).toString()}`
|
||||
: sourceURL;
|
||||
|
||||
@@ -1247,6 +1247,7 @@ import { listSkills, type SkillInfo } from '@/api/skill';
|
||||
import { listWebSearchProviders, type WebSearchProviderEntity } from '@/api/web-search-provider';
|
||||
import { getAgentConfig, getConversationConfig, getStorageEngineStatus, type StorageEngineStatusItem, type PromptTemplate } from '@/api/system';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useOrganizationStore } from '@/stores/organization';
|
||||
import AgentAvatar from '@/components/AgentAvatar.vue';
|
||||
import PromptTemplateSelector from '@/components/PromptTemplateSelector.vue';
|
||||
@@ -1255,6 +1256,7 @@ import AgentShareSettings from '@/components/AgentShareSettings.vue';
|
||||
import IMChannelPanel from '@/components/IMChannelPanel.vue';
|
||||
|
||||
const uiStore = useUIStore();
|
||||
const authStore = useAuthStore();
|
||||
const orgStore = useOrganizationStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -1293,6 +1295,7 @@ const imageStorageOptions = computed(() => {
|
||||
{ value: 'cos', label: t('settings.storage.engineCos'), disabled: statusMap.cos === false },
|
||||
{ value: 'tos', label: t('settings.storage.engineTos'), disabled: statusMap.tos === false },
|
||||
{ value: 's3', label: 'Amazon S3', disabled: statusMap.s3 === false },
|
||||
{ value: 'oss', label: t('settings.storage.engineOss'), disabled: statusMap.oss === false },
|
||||
];
|
||||
});
|
||||
|
||||
@@ -1482,8 +1485,8 @@ const navItems = computed(() => {
|
||||
if (!isAgentMode.value) {
|
||||
items.push({ key: 'conversation', icon: 'chat', label: t('agent.editor.conversationSettings') });
|
||||
}
|
||||
// 共享管理(仅编辑模式且非内置智能体)
|
||||
if (props.mode === 'edit' && props.agent?.id && !props.agent?.is_builtin) {
|
||||
// 共享管理(仅编辑模式且非内置智能体,Lite 模式下隐藏)
|
||||
if (props.mode === 'edit' && props.agent?.id && !props.agent?.is_builtin && !authStore.isLiteMode) {
|
||||
items.push({ key: 'share', icon: 'share', label: t('knowledgeEditor.sidebar.share') });
|
||||
}
|
||||
// IM集成(仅编辑模式,创建时Agent还没有ID)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div class="agent-list-container">
|
||||
<ListSpaceSidebar
|
||||
v-if="!authStore.isLiteMode"
|
||||
v-model="spaceSelection"
|
||||
:count-all="allAgentsCount"
|
||||
:count-mine="agents.length"
|
||||
@@ -9,16 +10,17 @@
|
||||
hide-shared
|
||||
/>
|
||||
<div class="agent-list-content">
|
||||
<div class="header">
|
||||
<div class="header-title">
|
||||
<div class="title-row">
|
||||
<h2>{{ $t('agent.title') }}</h2>
|
||||
<div class="header" style="--wails-draggable: drag">
|
||||
<div class="header-title" style="--wails-draggable: drag">
|
||||
<div class="title-row" style="--wails-draggable: drag">
|
||||
<h2 style="--wails-draggable: drag">{{ $t('agent.title') }}</h2>
|
||||
<t-tooltip :content="$t('agent.createAgent')" placement="bottom">
|
||||
<t-button
|
||||
variant="text"
|
||||
theme="default"
|
||||
size="small"
|
||||
class="header-action-btn"
|
||||
style="--wails-draggable: no-drag"
|
||||
@click="handleCreateAgent"
|
||||
>
|
||||
<template #icon>
|
||||
@@ -33,10 +35,27 @@
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
</div>
|
||||
<p class="header-subtitle">{{ $t('agent.subtitle') }}</p>
|
||||
<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('agent.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="agent-list-main">
|
||||
<!-- 骨架屏占位 -->
|
||||
<div v-if="loading && agents.length === 0" class="agent-card-wrap">
|
||||
<div v-for="n in 6" :key="'skel-'+n" class="agent-card agent-card-skeleton">
|
||||
<div class="card-header">
|
||||
<div class="card-header-left">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '32px', height: '32px', type: 'circle' }, { width: '40%', height: '18px' }]]" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '100%', height: '14px' }, { width: '70%', height: '14px' }]" />
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '60px', height: '22px', type: 'rect' }, { width: '60px', height: '22px', type: 'rect' }]]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 全部:我的 + 共享 -->
|
||||
<div v-if="spaceSelection === 'all' && filteredAgents.length > 0" class="agent-card-wrap">
|
||||
<div
|
||||
@@ -544,10 +563,12 @@ import type { SharedAgentInfo, OrganizationSharedAgentItem } from '@/api/organiz
|
||||
import AgentEditorModal from './AgentEditorModal.vue'
|
||||
import AgentAvatar from '@/components/AgentAvatar.vue'
|
||||
import ListSpaceSidebar from '@/components/ListSpaceSidebar.vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
const orgStore = useOrganizationStore()
|
||||
|
||||
interface AgentWithUI extends CustomAgent {
|
||||
@@ -1180,10 +1201,23 @@ defineExpose({
|
||||
}
|
||||
|
||||
|
||||
@keyframes contentFadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.agent-card-wrap {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
grid-template-columns: 1fr;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
|
||||
.agent-card-skeleton {
|
||||
cursor: default;
|
||||
.card-header { margin-bottom: 16px; }
|
||||
.card-content { flex: 1; }
|
||||
.card-bottom { margin-top: auto; }
|
||||
}
|
||||
|
||||
/* 与知识库列表卡片统一尺寸:160px 高、18px 20px 内边距、12px 圆角 */
|
||||
|
||||
@@ -377,7 +377,7 @@ import { Autoplay, EffectFade, Pagination } from 'swiper/modules'
|
||||
import 'swiper/css'
|
||||
import 'swiper/css/effect-fade'
|
||||
import 'swiper/css/pagination'
|
||||
import { login, register, getOIDCAuthorizationURL, getOIDCConfig } from '@/api/auth'
|
||||
import { login, register, getOIDCAuthorizationURL, getOIDCConfig, autoSetup } from '@/api/auth'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
@@ -668,13 +668,24 @@ const handleRegister = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if already logged in
|
||||
onMounted(() => {
|
||||
// Check if already logged in; for lite edition, attempt transparent auto-setup
|
||||
onMounted(async () => {
|
||||
if (authStore.isLoggedIn) {
|
||||
router.replace('/platform/knowledge-bases')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await autoSetup()
|
||||
if (response.success) {
|
||||
authStore.setLiteMode(true)
|
||||
await persistLoginResponse(response)
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
// auto-setup not available (standard edition) — show normal login form
|
||||
}
|
||||
|
||||
loadOIDCConfig()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1000,9 +1000,15 @@ const handleCitationActivate = (el: HTMLElement) => {
|
||||
const url = el.getAttribute('data-url');
|
||||
if (!url) return;
|
||||
try {
|
||||
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
|
||||
if (!newWindow) {
|
||||
window.location.assign(url);
|
||||
// @ts-ignore: Wails runtime check
|
||||
if (window.runtime && window.runtime.BrowserOpenURL) {
|
||||
// @ts-ignore
|
||||
window.runtime.BrowserOpenURL(url);
|
||||
} else {
|
||||
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
|
||||
if (!newWindow) {
|
||||
window.location.assign(url);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
window.location.assign(url);
|
||||
@@ -1200,10 +1206,8 @@ const onRootClick = (e: Event) => {
|
||||
// Handle web citation clicks
|
||||
const webEl = target.closest?.('.citation-web') as HTMLElement | null;
|
||||
if (webEl && webEl.getAttribute('data-url')) {
|
||||
if (!(webEl instanceof HTMLAnchorElement)) {
|
||||
e.preventDefault();
|
||||
handleCitationActivate(webEl);
|
||||
}
|
||||
e.preventDefault();
|
||||
handleCitationActivate(webEl);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1223,6 +1227,18 @@ const onRootClick = (e: Event) => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle generic a clicks (especially in Wails desktop)
|
||||
const aEl = target.closest?.('a') as HTMLAnchorElement | null;
|
||||
// @ts-ignore
|
||||
if (aEl && aEl.href && window.runtime && window.runtime.BrowserOpenURL) {
|
||||
if (aEl.href.startsWith('http://') || aEl.href.startsWith('https://')) {
|
||||
e.preventDefault();
|
||||
// @ts-ignore
|
||||
window.runtime.BrowserOpenURL(aEl.href);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onRootKeydown = (e: KeyboardEvent) => {
|
||||
@@ -1233,15 +1249,8 @@ const onRootKeydown = (e: KeyboardEvent) => {
|
||||
const webEl = target.closest?.('.citation-web') as HTMLElement | null;
|
||||
if (webEl) {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
if (webEl instanceof HTMLAnchorElement && e.key === 'Enter') {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
if (webEl instanceof HTMLAnchorElement) {
|
||||
webEl.click();
|
||||
} else {
|
||||
handleCitationActivate(webEl);
|
||||
}
|
||||
handleCitationActivate(webEl);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -259,19 +259,17 @@ const getWebSearchDisplayText = (item) => {
|
||||
line-height: 20px;
|
||||
padding: 2px 0;
|
||||
transition: all 0.2s ease;
|
||||
border-bottom: 1px solid transparent;
|
||||
border-bottom: 1px dashed var(--td-brand-color);
|
||||
|
||||
&:hover {
|
||||
border-bottom-color: var(--td-brand-color);
|
||||
background-color: rgba(7, 192, 95, 0.08);
|
||||
border-radius: 3px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
&.doc-web {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,33 @@
|
||||
<div class="chat">
|
||||
<div ref="scrollContainer" class="chat_scroll_box" @scroll="handleScroll">
|
||||
<div class="msg_list">
|
||||
<!-- 消息列表骨架屏 -->
|
||||
<div v-if="historyLoading && messagesList.length === 0" class="msg-skeleton-list">
|
||||
<div class="msg-skeleton msg-skeleton-user">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '45%', height: '36px', type: 'rect' }]" />
|
||||
</div>
|
||||
<div class="msg-skeleton msg-skeleton-bot">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '80%', height: '16px' }, { width: '100%', height: '16px' }, { width: '60%', height: '16px' }]" />
|
||||
</div>
|
||||
<div class="msg-skeleton msg-skeleton-user">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '35%', height: '36px', type: 'rect' }]" />
|
||||
</div>
|
||||
<div class="msg-skeleton msg-skeleton-bot">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '70%', height: '16px' }, { width: '90%', height: '16px' }]" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 推荐问题卡片 - 仅在新会话(无消息)时展示 -->
|
||||
<div v-if="messagesList.length === 0 && !loading" class="suggested-questions-container" :class="{ 'has-questions': suggestedQuestions.length > 0 }">
|
||||
<transition name="sq-fade">
|
||||
<div v-if="messagesList.length === 0 && !loading" class="suggested-questions-container" :class="{ 'has-questions': suggestedQuestions.length > 0 || suggestedQuestionsLoading }">
|
||||
<!-- 骨架屏占位 -->
|
||||
<div v-if="suggestedQuestionsLoading && suggestedQuestions.length === 0" class="suggested-questions-inner">
|
||||
<div class="suggested-questions-title"><t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '18px' }]" /></div>
|
||||
<div class="suggested-questions-grid">
|
||||
<div v-for="n in 6" :key="'sq-skel-'+n" class="suggested-question-card sq-card-skeleton">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '90%', height: '14px' }, { width: '60%', height: '14px' }]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<transition v-else appear name="sq-fade">
|
||||
<div v-if="suggestedQuestions.length > 0" class="suggested-questions-inner">
|
||||
<div class="suggested-questions-title">{{ t('chat.suggestedQuestions') }}</div>
|
||||
<div class="suggested-questions-grid">
|
||||
@@ -40,6 +64,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<transition name="scroll-btn-fade">
|
||||
<div v-show="userHasScrolledUp" class="scroll-to-bottom-btn" @click="onClickScrollToBottom">
|
||||
<t-icon name="chevron-down" size="20px" />
|
||||
</div>
|
||||
</transition>
|
||||
<div style="min-height: 115px; margin: 16px auto 4px;width: 100%;max-width: 800px;">
|
||||
<InputField
|
||||
ref="inputFieldRef"
|
||||
@@ -98,9 +127,19 @@ const scrollLock = ref(false);
|
||||
const isNeedTitle = ref(false);
|
||||
const isFirstEnter = ref(true);
|
||||
const loading = ref(false);
|
||||
const historyLoading = ref(true);
|
||||
let fullContent = ref('')
|
||||
let userquery = ref('')
|
||||
const scrollContainer = ref(null)
|
||||
const userHasScrolledUp = ref(false)
|
||||
const SCROLL_BOTTOM_THRESHOLD = 80
|
||||
|
||||
const isNearBottom = () => {
|
||||
if (!scrollContainer.value) return true;
|
||||
const { scrollTop, scrollHeight, clientHeight } = scrollContainer.value;
|
||||
return scrollHeight - scrollTop - clientHeight < SCROLL_BOTTOM_THRESHOLD;
|
||||
}
|
||||
|
||||
const handleKBEditorSuccess = (kbId) => {
|
||||
navigateToKnowledgeBaseList(kbId)
|
||||
}
|
||||
@@ -198,10 +237,12 @@ watch([() => route.params], (newvalue) => {
|
||||
messagesList.splice(0);
|
||||
session_id.value = newvalue[0].chatid;
|
||||
|
||||
// 切换会话时,重置状态(加载历史消息不应显示loading)
|
||||
// 切换会话时,重置状态
|
||||
historyLoading.value = true;
|
||||
loading.value = false;
|
||||
isReplying.value = false;
|
||||
currentAssistantMessageId.value = '';
|
||||
userHasScrolledUp.value = false;
|
||||
|
||||
checkmenuTitle(session_id.value)
|
||||
let data = {
|
||||
@@ -212,13 +253,18 @@ watch([() => route.params], (newvalue) => {
|
||||
getmsgList(data);
|
||||
}
|
||||
});
|
||||
const scrollToBottom = () => {
|
||||
const scrollToBottom = (force = false) => {
|
||||
if (!force && userHasScrolledUp.value) return;
|
||||
nextTick(() => {
|
||||
if (scrollContainer.value) {
|
||||
scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
|
||||
}
|
||||
})
|
||||
}
|
||||
const onClickScrollToBottom = () => {
|
||||
userHasScrolledUp.value = false;
|
||||
scrollToBottom(true);
|
||||
}
|
||||
const debounce = (fn, delay) => {
|
||||
let timer
|
||||
return (...args) => {
|
||||
@@ -239,7 +285,11 @@ const onChatScrollTop = () => {
|
||||
getmsgList(data, true, scrollHeight);
|
||||
}
|
||||
}
|
||||
const handleScroll = debounce(onChatScrollTop, 500);
|
||||
const debouncedScrollTop = debounce(onChatScrollTop, 500);
|
||||
const handleScroll = () => {
|
||||
userHasScrolledUp.value = !isNearBottom();
|
||||
debouncedScrollTop();
|
||||
};
|
||||
|
||||
const getmsgList = (data, isScrollType = false, scrollHeight) => {
|
||||
getMessageList(data).then(res => {
|
||||
@@ -247,6 +297,8 @@ const getmsgList = (data, isScrollType = false, scrollHeight) => {
|
||||
created_at.value = res.data[0].created_at;
|
||||
handleMsgList(res.data, isScrollType, scrollHeight);
|
||||
}
|
||||
}).finally(() => {
|
||||
historyLoading.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
@@ -381,7 +433,7 @@ const handleMsgList = async (data, isScrollType = false, newScrollHeight) => {
|
||||
}
|
||||
messagesList.unshift(item);
|
||||
if (isFirstEnter.value) {
|
||||
scrollToBottom();
|
||||
scrollToBottom(true);
|
||||
} else if (isScrollType) {
|
||||
nextTick(() => {
|
||||
const { scrollHeight } = scrollContainer.value;
|
||||
@@ -473,8 +525,9 @@ const sendMsg = async (value, modelId = '', mentionedItems = [], imageFiles = []
|
||||
}
|
||||
|
||||
// 将@提及的知识库和文件信息存入用户消息
|
||||
messagesList.push({ content: value, role: 'user', mentioned_items: mentionedItems, images: userImages, attachments: attachmentFiles.map(a => ({ file_name: a.name, file_size: a.size, file_type: '.' + a.name.split('.').pop()?.toLowerCase() })), channel: 'web' });
|
||||
scrollToBottom();
|
||||
messagesList.push({ content: value, role: 'user', mentioned_items: mentionedItems, images: userImages, attachments: attachmentFiles.map(a => ({ file_name: a.name, file_size: a.size, file_type: '.' + a.name.split('.').pop()?.toLowerCase() })), channel: 'web' });
|
||||
userHasScrolledUp.value = false;
|
||||
scrollToBottom(true);
|
||||
|
||||
// Get agent mode status from settings store
|
||||
const agentEnabled = useSettingsStoreInstance.isAgentEnabled;
|
||||
@@ -637,7 +690,7 @@ onChunk((data) => {
|
||||
};
|
||||
messagesList.push(existingMessage);
|
||||
loading.value = false; // 消息已创建,关闭 loading
|
||||
scrollToBottom();
|
||||
scrollToBottom(true);
|
||||
}
|
||||
|
||||
existingMessage.knowledge_references = data.knowledge_references || data.data?.references || [];
|
||||
@@ -739,7 +792,7 @@ const handleAgentChunk = (data) => {
|
||||
};
|
||||
messagesList.push(newMsg);
|
||||
loading.value = false; // 消息已创建,关闭 loading
|
||||
scrollToBottom();
|
||||
scrollToBottom(true);
|
||||
// Don't return - continue to process the current event data
|
||||
message = newMsg;
|
||||
}
|
||||
@@ -1110,7 +1163,8 @@ onMounted(async () => {
|
||||
checkmenuTitle(session_id.value)
|
||||
if (firstQuery.value) {
|
||||
scrollLock.value = true;
|
||||
sendMsg(firstQuery.value, firstModelId.value || '', firstMentionedItems.value || [], firstImageFiles.value || [], firstAttachmentFiles.value || []);
|
||||
historyLoading.value = false;
|
||||
sendMsg(firstQuery.value, firstModelId.value || '', firstMentionedItems.value || [], firstImageFiles.value || [], firstAttachmentFiles.value || []);
|
||||
usemenuStore.changeFirstQuery('', [], '', [], []);
|
||||
} else {
|
||||
scrollLock.value = false;
|
||||
@@ -1179,6 +1233,45 @@ onBeforeRouteUpdate((to, from, next) => {
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-to-bottom-btn {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 140px;
|
||||
z-index: 10;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
background: var(--td-bg-color-container);
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: var(--td-text-color-secondary);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-container-hover);
|
||||
color: var(--td-text-color-primary);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateX(-50%) scale(0.92);
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-btn-fade-enter-active,
|
||||
.scroll-btn-fade-leave-active {
|
||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
.scroll-btn-fade-enter-from,
|
||||
.scroll-btn-fade-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateX(-50%) translateY(8px);
|
||||
}
|
||||
|
||||
.agent-mode-indicator {
|
||||
display: flex;
|
||||
@@ -1204,6 +1297,30 @@ onBeforeRouteUpdate((to, from, next) => {
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes contentFadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.msg-skeleton-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
max-width: 800px;
|
||||
padding: 16px 0;
|
||||
animation: contentFadeIn 0.3s ease-out;
|
||||
}
|
||||
.msg-skeleton-user {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.msg-skeleton-bot {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.msg_list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -1276,6 +1393,7 @@ onBeforeRouteUpdate((to, from, next) => {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
animation: contentFadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.sq-fade-enter-active,
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
<template>
|
||||
<div class="dialogue-wrap">
|
||||
<div class="dialogue-answers">
|
||||
<div class="dialogue-title">
|
||||
<span>{{ $t('createChat.title') }}</span>
|
||||
<div class="dialogue-title" style="--wails-draggable: drag">
|
||||
<span style="--wails-draggable: drag">{{ $t('createChat.title') }}</span>
|
||||
</div>
|
||||
<!-- 推荐问题 -->
|
||||
<div ref="sqContainerRef" class="suggested-questions-container">
|
||||
<transition name="sq-slide-fade" mode="out-in"
|
||||
<!-- 骨架屏占位 -->
|
||||
<div v-if="sqLoading && suggestedQuestions.length === 0" class="suggested-questions-inner">
|
||||
<div class="suggested-questions-title"><t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '18px' }]" /></div>
|
||||
<div class="suggested-questions-grid">
|
||||
<div v-for="n in 6" :key="'sq-skel-'+n" class="suggested-question-card sq-card-skeleton">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '90%', height: '14px' }, { width: '60%', height: '14px' }]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<transition v-else appear name="sq-slide-fade" mode="out-in"
|
||||
@before-leave="onBeforeLeave"
|
||||
@after-leave="onAfterLeave"
|
||||
@enter="onEnter"
|
||||
@@ -69,6 +78,7 @@ const { navigateToKnowledgeBaseList } = useKnowledgeBaseCreationNavigation();
|
||||
|
||||
// ===== 推荐问题 =====
|
||||
const suggestedQuestions = ref<SuggestedQuestion[]>([]);
|
||||
const sqLoading = ref(true);
|
||||
const sqCardsRevealed = ref(false);
|
||||
const sqRenderKey = ref(0);
|
||||
const sqContainerRef = ref<HTMLElement | null>(null);
|
||||
@@ -119,7 +129,7 @@ const onQuestionsEntered = () => {
|
||||
|
||||
const fetchSuggestedQuestions = async () => {
|
||||
const fetchId = ++suggestedQuestionsFetchId;
|
||||
// 加载期间保留旧数据,不清空,避免布局抖动
|
||||
if (suggestedQuestions.value.length === 0) sqLoading.value = true;
|
||||
try {
|
||||
const agentId = settingsStore.selectedAgentId;
|
||||
if (!agentId) return;
|
||||
@@ -140,6 +150,10 @@ const fetchSuggestedQuestions = async () => {
|
||||
if (fetchId === suggestedQuestionsFetchId) {
|
||||
suggestedQuestions.value = [];
|
||||
}
|
||||
} finally {
|
||||
if (fetchId === suggestedQuestionsFetchId) {
|
||||
sqLoading.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -277,11 +291,17 @@ const handleKBEditorSuccess = (kbId: string) => {
|
||||
transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
@keyframes skeletonFadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
.suggested-questions-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
animation: skeletonFadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
// 容器整体过渡:淡入 + 轻微上滑
|
||||
@@ -335,6 +355,12 @@ const handleKBEditorSuccess = (kbId: string) => {
|
||||
background 0.2s ease,
|
||||
box-shadow 0.2s ease;
|
||||
|
||||
&.sq-card-skeleton {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&.sq-card-visible {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
|
||||
@@ -42,6 +42,7 @@ const uploadInputRef = ref<HTMLInputElement | null>(null);
|
||||
const folderUploadInputRef = ref<HTMLInputElement | null>(null);
|
||||
const uploading = ref(false);
|
||||
const kbLoading = ref(false);
|
||||
const docListLoading = ref(true);
|
||||
const isFAQ = computed(() => (kbInfo.value?.type || '') === 'faq');
|
||||
const missingStorageEngine = computed(() => {
|
||||
if (!kbInfo.value || isFAQ.value) return false
|
||||
@@ -210,6 +211,18 @@ const fileTypeOptions = computed(() => [
|
||||
{ content: 'MD', value: 'md' },
|
||||
{ content: 'URL', value: 'url' },
|
||||
{ content: t('knowledgeBase.typeManual'), value: 'manual' },
|
||||
{ content: 'MP4', value: 'mp4' },
|
||||
{ content: 'MOV', value: 'mov' },
|
||||
{ content: 'AVI', value: 'avi' },
|
||||
{ content: 'MKV', value: 'mkv' },
|
||||
{ content: 'WEBM', value: 'webm' },
|
||||
{ content: 'WMV', value: 'wmv' },
|
||||
{ content: 'FLV', value: 'flv' },
|
||||
{ content: 'MP3', value: 'mp3' },
|
||||
{ content: 'WAV', value: 'wav' },
|
||||
{ content: 'M4A', value: 'm4a' },
|
||||
{ content: 'FLAC', value: 'flac' },
|
||||
{ content: 'OGG', value: 'ogg' },
|
||||
]);
|
||||
type TagInputInstance = ComponentPublicInstance<{ focus: () => void; select: () => void }>;
|
||||
const tagDropdownOptions = computed(() =>
|
||||
@@ -554,6 +567,7 @@ const loadKnowledgeBaseInfo = async (targetKbId: string) => {
|
||||
// 重置store中的标签选择状态,避免上传文档时自动带上之前选择的标签
|
||||
uiStore.setSelectedTagId('');
|
||||
if (!isFAQ.value) {
|
||||
docListLoading.value = true;
|
||||
loadKnowledgeFiles(targetKbId);
|
||||
} else {
|
||||
cardList.value = [];
|
||||
@@ -711,6 +725,7 @@ onUnmounted(() => {
|
||||
});
|
||||
watch(() => cardList.value, (newValue) => {
|
||||
if (isFAQ.value) return;
|
||||
docListLoading.value = false;
|
||||
|
||||
// Auto-open document if navigated with ?knowledge_id=xxx
|
||||
if (pendingKnowledgeId.value && newValue?.length) {
|
||||
@@ -1115,11 +1130,14 @@ const handleFolderUpload = async (event: Event) => {
|
||||
}
|
||||
|
||||
const vlmEnabled = kbInfo.value?.vlm_config?.enabled || false;
|
||||
const asrEnabled = kbInfo.value?.asr_config?.enabled || false;
|
||||
const dynamicTypes = supportedFileTypes.value.size > 0 ? supportedFileTypes.value : undefined
|
||||
|
||||
const validFiles: File[] = [];
|
||||
let hiddenFileCount = 0;
|
||||
let imageFilteredCount = 0;
|
||||
let videoFilteredCount = 0;
|
||||
let audioFilteredCount = 0;
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
@@ -1132,13 +1150,25 @@ const handleFolderUpload = async (event: Event) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileExt = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase();
|
||||
const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
||||
const videoTypes = ['mp4', 'mov', 'avi', 'mkv', 'webm', 'wmv', 'flv'];
|
||||
const audioTypes = ['mp3', 'wav', 'm4a', 'flac', 'ogg'];
|
||||
|
||||
if (!vlmEnabled) {
|
||||
const fileExt = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase();
|
||||
const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
||||
if (imageTypes.includes(fileExt)) {
|
||||
imageFilteredCount++;
|
||||
continue;
|
||||
}
|
||||
if (videoTypes.includes(fileExt)) {
|
||||
videoFilteredCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!asrEnabled && audioTypes.includes(fileExt)) {
|
||||
audioFilteredCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!kbFileTypeVerification(file, true, dynamicTypes)) {
|
||||
@@ -1151,7 +1181,6 @@ const handleFolderUpload = async (event: Event) => {
|
||||
if (input) input.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
MessagePlugin.info(t('knowledgeBase.uploadingFolder', { total: validFiles.length }));
|
||||
|
||||
// 批量上传
|
||||
@@ -1444,8 +1473,13 @@ async function createNewSession(value: string): Promise<void> {
|
||||
:disabled="!kbId"
|
||||
@click.stop="handleNavigateToCurrentKB"
|
||||
>
|
||||
<span>{{ kbInfo?.name || '--' }}</span>
|
||||
<t-icon name="chevron-down" />
|
||||
<template v-if="!kbInfo">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '20px' }]" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{ kbInfo.name }}</span>
|
||||
<t-icon name="chevron-down" />
|
||||
</template>
|
||||
</button>
|
||||
</t-dropdown>
|
||||
<button
|
||||
@@ -1455,13 +1489,18 @@ async function createNewSession(value: string): Promise<void> {
|
||||
:disabled="!kbId"
|
||||
@click="handleNavigateToCurrentKB"
|
||||
>
|
||||
{{ kbInfo?.name || '--' }}
|
||||
<template v-if="!kbInfo">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '20px' }]" />
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ kbInfo.name }}
|
||||
</template>
|
||||
</button>
|
||||
<t-icon name="chevron-right" class="breadcrumb-separator" />
|
||||
<span class="breadcrumb-current">{{ $t('knowledgeEditor.document.title') }}</span>
|
||||
</h2>
|
||||
<!-- 身份与最后更新:紧凑单行,置于标题行右侧,悬停显示权限说明 -->
|
||||
<div v-if="kbInfo" class="kb-access-meta">
|
||||
<div v-if="kbInfo && !authStore.isLiteMode" class="kb-access-meta">
|
||||
<t-tooltip :content="accessPermissionSummary" placement="top">
|
||||
<span class="kb-access-meta-inner">
|
||||
<t-tag size="small" :theme="isOwner ? 'success' : (effectiveKBPermission === 'admin' ? 'primary' : effectiveKBPermission === 'editor' ? 'warning' : 'default')" class="kb-access-role-tag">
|
||||
@@ -1514,7 +1553,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
ref="uploadInputRef"
|
||||
type="file"
|
||||
class="document-upload-input"
|
||||
:accept="acceptFileTypes || '.pdf,.docx,.doc,.txt,.md,.json,.jpg,.jpeg,.png,.csv,.xlsx,.xls,.pptx,.ppt,.mp3,.wav,.m4a,.flac,.ogg'"
|
||||
:accept="acceptFileTypes || '.pdf,.docx,.doc,.txt,.md,.json,.jpg,.jpeg,.png,.csv,.xlsx,.xls,.pptx,.ppt,.mp3,.wav,.m4a,.flac,.ogg,.mp4,.mov,.avi,.mkv,.webm,.wmv,.flv'"
|
||||
multiple
|
||||
@change="handleDocumentUpload"
|
||||
/>
|
||||
@@ -1541,7 +1580,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
:title="$t('knowledgeBase.tagCreateAction')"
|
||||
@click="startCreateTag"
|
||||
>
|
||||
<span class="create-tag-plus" aria-hidden="true">+</span>
|
||||
<t-icon name="add" />
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1557,11 +1596,18 @@ async function createNewSession(value: string): Promise<void> {
|
||||
</template>
|
||||
</t-input>
|
||||
</div>
|
||||
<t-loading :loading="tagLoading" size="small">
|
||||
<div class="tag-list">
|
||||
<div class="tag-list">
|
||||
<template v-if="tagLoading && !filteredTags.length">
|
||||
<div v-for="n in 8" :key="'skel-tag-'+n" class="tag-list-item" style="cursor: default; pointer-events: none;">
|
||||
<div class="tag-list-left" style="gap: 12px; width: 100%;">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '80%', height: '18px' }]" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="creatingTag" class="tag-list-item tag-editing" @click.stop>
|
||||
<div class="tag-list-left">
|
||||
<t-icon name="folder" size="18px" />
|
||||
<span class="tag-hash-icon">#</span>
|
||||
<div class="tag-edit-input">
|
||||
<t-input
|
||||
ref="newTagInputRef"
|
||||
@@ -1606,7 +1652,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
@click="handleTagRowClick(tag.id)"
|
||||
>
|
||||
<div class="tag-list-left">
|
||||
<t-icon name="folder" size="18px" />
|
||||
<span class="tag-hash-icon">#</span>
|
||||
<template v-if="editingTagId === tag.id">
|
||||
<div class="tag-edit-input" @click.stop>
|
||||
<t-input
|
||||
@@ -1685,8 +1731,8 @@ async function createNewSession(value: string): Promise<void> {
|
||||
{{ $t('tenant.loadMore') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</t-loading>
|
||||
</template>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="tag-content">
|
||||
<div class="doc-card-area">
|
||||
@@ -1732,8 +1778,22 @@ async function createNewSession(value: string): Promise<void> {
|
||||
ref="knowledgeScroll"
|
||||
@scroll="handleScroll"
|
||||
>
|
||||
<template v-if="cardList.length">
|
||||
<div class="doc-card-list">
|
||||
<!-- 文档骨架屏 -->
|
||||
<div v-if="docListLoading && cardList.length === 0" class="doc-card-list doc-card-list-animated">
|
||||
<div v-for="n in 8" :key="'doc-skel-'+n" class="knowledge-card knowledge-card-skeleton">
|
||||
<div class="card-content">
|
||||
<div class="card-content-nav">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '70%', height: '18px' }]" />
|
||||
</div>
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '100%', height: '14px' }, { width: '60%', height: '14px' }]" />
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '80px', height: '14px' }, { width: '40px', height: '18px', type: 'rect' }]]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template v-else-if="cardList.length">
|
||||
<div class="doc-card-list doc-card-list-animated">
|
||||
<!-- 现有文档卡片 -->
|
||||
<div
|
||||
class="knowledge-card"
|
||||
@@ -1952,7 +2012,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-else-if="!docListLoading">
|
||||
<div class="doc-empty-state">
|
||||
<EmptyKnowledge />
|
||||
</div>
|
||||
@@ -2078,19 +2138,18 @@ async function createNewSession(value: string): Promise<void> {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
background: var(--td-bg-color-container);
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
// 与列表页筛选区一致:白底卡片感、细分界
|
||||
// 贴近整体系统设计语言的极简侧栏(对齐 menu 与右侧主窗口质感)
|
||||
.tag-sidebar {
|
||||
width: 200px;
|
||||
background: var(--td-bg-color-container);
|
||||
width: 180px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-right: 1px solid var(--td-component-stroke);
|
||||
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
|
||||
padding: 16px;
|
||||
box-shadow: 1px 0 0 rgba(0, 0, 0, 0.02);
|
||||
padding: 0 16px 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
@@ -2101,62 +2160,71 @@ async function createNewSession(value: string): Promise<void> {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 12px;
|
||||
padding: 0 4px;
|
||||
color: var(--td-text-color-primary);
|
||||
|
||||
.sidebar-title {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
|
||||
.sidebar-count {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
align-items: center;
|
||||
|
||||
.create-tag-btn {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
padding: 0;
|
||||
border-radius: 6px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--td-success-color);
|
||||
line-height: 1;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
color: var(--td-text-color-secondary);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
.t-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-brand-color-active);
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
}
|
||||
|
||||
.create-tag-plus {
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tag-search-bar {
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 12px;
|
||||
padding: 0 4px;
|
||||
|
||||
:deep(.t-input) {
|
||||
font-size: 13px;
|
||||
background-color: var(--td-bg-color-container);
|
||||
border-color: var(--td-component-stroke);
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border-color: transparent;
|
||||
border-radius: 6px;
|
||||
box-shadow: none !important;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.t-is-focused {
|
||||
border-color: var(--td-brand-color);
|
||||
background-color: var(--td-bg-color-container);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2190,13 +2258,13 @@ async function createNewSession(value: string): Promise<void> {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 9px 12px;
|
||||
padding: 8px 8px;
|
||||
border-radius: 6px;
|
||||
color: var(--td-text-color-primary);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
|
||||
.tag-list-left {
|
||||
@@ -2206,12 +2274,25 @@ async function createNewSession(value: string): Promise<void> {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
|
||||
.t-icon {
|
||||
.t-icon,
|
||||
.tag-hash-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: 14px;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.t-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.tag-hash-icon {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-name {
|
||||
@@ -2221,10 +2302,9 @@ async function createNewSession(value: string): Promise<void> {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 450;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.tag-list-right {
|
||||
@@ -2237,37 +2317,34 @@ async function createNewSession(value: string): Promise<void> {
|
||||
|
||||
.tag-count {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-weight: 500;
|
||||
min-width: 28px;
|
||||
padding: 3px 7px;
|
||||
border-radius: 8px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-weight: 400;
|
||||
transition: all 0.2s ease;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
text-align: right;
|
||||
padding-left: 8px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-primary);
|
||||
|
||||
.tag-list-left .t-icon {
|
||||
color: var(--td-text-color-primary);
|
||||
.tag-list-left .t-icon,
|
||||
.tag-list-left .tag-hash-icon {
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.tag-count {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-primary);
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: var(--td-success-color-light);
|
||||
background: var(--td-brand-color-light);
|
||||
color: var(--td-brand-color);
|
||||
font-weight: 500;
|
||||
|
||||
.tag-list-left .t-icon {
|
||||
.tag-list-left .t-icon,
|
||||
.tag-list-left .tag-hash-icon {
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
@@ -2276,9 +2353,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
}
|
||||
|
||||
.tag-count {
|
||||
background: var(--td-success-color-light);
|
||||
color: var(--td-brand-color);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2322,22 +2397,22 @@ async function createNewSession(value: string): Promise<void> {
|
||||
}
|
||||
|
||||
:deep(.tag-action-btn.confirm) {
|
||||
background: var(--td-success-color-light);
|
||||
color: var(--td-brand-color-active);
|
||||
|
||||
&:hover {
|
||||
background: var(--td-success-color-light);
|
||||
color: var(--td-success-color);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.tag-action-btn.cancel) {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
background: transparent;
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.tag-action-btn.cancel) {
|
||||
background: transparent;
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2348,48 +2423,38 @@ async function createNewSession(value: string): Promise<void> {
|
||||
max-width: 100%;
|
||||
|
||||
:deep(.t-input) {
|
||||
font-size: 12px;
|
||||
font-size: 13px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
:deep(.t-input__wrap) {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
:deep(.t-input__inner) {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
padding: 0;
|
||||
color: var(--td-text-color-primary);
|
||||
caret-color: var(--td-text-color-primary);
|
||||
caret-color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
:deep(.t-input:hover),
|
||||
:deep(.t-input.t-is-focused),
|
||||
:deep(.t-input__wrap:hover),
|
||||
:deep(.t-input__wrap.t-is-focused) {
|
||||
border-bottom-color: var(--td-success-color);
|
||||
border-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
&:hover .tag-more {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tag-more-btn {
|
||||
@@ -2399,7 +2464,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 4px;
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-text-color-placeholder);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
@@ -2413,7 +2478,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
text-align: center;
|
||||
padding: 10px 6px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: 11px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2464,9 +2529,10 @@ async function createNewSession(value: string): Promise<void> {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
padding: 12px;
|
||||
padding: 0 0 0 16px;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
background: var(--td-bg-color-container);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.doc-card-area {
|
||||
@@ -2508,29 +2574,33 @@ async function createNewSession(value: string): Promise<void> {
|
||||
|
||||
:deep(.t-input) {
|
||||
font-size: 13px;
|
||||
background-color: var(--td-bg-color-container);
|
||||
border-color: var(--td-component-stroke);
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border-color: transparent;
|
||||
border-radius: 6px;
|
||||
box-shadow: none !important;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.t-is-focused {
|
||||
border-color: var(--td-brand-color);
|
||||
background-color: var(--td-bg-color-container);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.t-select) {
|
||||
.t-input {
|
||||
font-size: 13px;
|
||||
background-color: var(--td-bg-color-container);
|
||||
border-color: var(--td-component-stroke);
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border-color: transparent;
|
||||
border-radius: 6px;
|
||||
box-shadow: none !important;
|
||||
|
||||
&:hover,
|
||||
&.t-is-focused {
|
||||
border-color: var(--td-brand-color);
|
||||
background-color: var(--td-bg-color-container);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2872,6 +2942,11 @@ async function createNewSession(value: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes contentFadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.doc-card-list {
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
@@ -2879,6 +2954,29 @@ async function createNewSession(value: string): Promise<void> {
|
||||
gap: 14px;
|
||||
align-content: flex-start;
|
||||
width: 100%;
|
||||
|
||||
&.doc-card-list-animated {
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
}
|
||||
|
||||
.knowledge-card-skeleton {
|
||||
cursor: default;
|
||||
.card-content { padding: 15px 17px 13px; }
|
||||
.card-content-nav { margin-bottom: 14px; }
|
||||
.card-bottom {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 0 17px;
|
||||
box-sizing: border-box;
|
||||
height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-top: 1px solid var(--td-component-stroke);
|
||||
}
|
||||
}
|
||||
|
||||
.doc-empty-state {
|
||||
|
||||
@@ -292,6 +292,7 @@ import { createKnowledgeBase, getKnowledgeBaseById, listKnowledgeFiles, updateKn
|
||||
import { updateKBConfig, type KBModelConfigRequest } from '@/api/initialization'
|
||||
import { listModels } from '@/api/model'
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import KBModelConfig from './settings/KBModelConfig.vue'
|
||||
import KBParserSettings from './settings/KBParserSettings.vue'
|
||||
import KBStorageSettings from './settings/KBStorageSettings.vue'
|
||||
@@ -304,6 +305,7 @@ import DataSourceSettings from './settings/DataSourceSettings.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const uiStore = useUIStore()
|
||||
const authStore = useAuthStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
// Props
|
||||
@@ -349,7 +351,7 @@ const navItems = computed(() => {
|
||||
items.push({ key: 'datasource', icon: 'cloud-download', label: t('knowledgeEditor.sidebar.datasource'), badge: dsCount.value || undefined })
|
||||
}
|
||||
}
|
||||
if (props.mode === 'edit' && props.kbId) {
|
||||
if (props.mode === 'edit' && props.kbId && !authStore.isLiteMode) {
|
||||
items.push({ key: 'share', icon: 'share', label: t('knowledgeEditor.sidebar.share') })
|
||||
}
|
||||
return items
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div class="kb-list-container">
|
||||
<ListSpaceSidebar
|
||||
v-if="!authStore.isLiteMode"
|
||||
v-model="spaceSelection"
|
||||
:count-all="allKnowledgeBases"
|
||||
:count-mine="kbs.length"
|
||||
@@ -8,23 +9,24 @@
|
||||
:count-by-org="effectiveSharedCountByOrg"
|
||||
/>
|
||||
<div class="kb-list-content">
|
||||
<div class="header">
|
||||
<div class="header-title">
|
||||
<div class="title-row">
|
||||
<h2>{{ $t('knowledgeBase.title') }}</h2>
|
||||
<div class="header" style="--wails-draggable: drag">
|
||||
<div class="header-title" style="--wails-draggable: drag">
|
||||
<div class="title-row" style="--wails-draggable: drag">
|
||||
<h2 style="--wails-draggable: drag">{{ $t('knowledgeBase.title') }}</h2>
|
||||
<t-tooltip :content="$t('knowledgeList.create')" placement="bottom">
|
||||
<t-button
|
||||
variant="text"
|
||||
theme="default"
|
||||
size="small"
|
||||
class="header-action-btn"
|
||||
style="--wails-draggable: no-drag"
|
||||
@click="handleCreateKnowledgeBase"
|
||||
>
|
||||
<template #icon><t-icon name="folder-add" size="16px" /></template>
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
</div>
|
||||
<p class="header-subtitle">{{ $t('knowledgeList.subtitle') }}</p>
|
||||
<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('knowledgeList.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kb-list-main">
|
||||
@@ -76,6 +78,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 骨架屏占位 -->
|
||||
<div v-if="loading && kbs.length === 0" class="kb-card-wrap">
|
||||
<div v-for="n in 6" :key="'skel-'+n" class="kb-card kb-card-skeleton">
|
||||
<div class="card-header">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '60%', height: '20px' }]" />
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '100%', height: '14px' }, { width: '80%', height: '14px' }]" />
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '28px', height: '28px', type: 'rect' }, { width: '28px', height: '28px', type: 'rect' }]]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片网格:全部 -->
|
||||
<div v-if="spaceSelection === 'all' && filteredKnowledgeBases.length > 0" class="kb-card-wrap">
|
||||
<!-- 全部:我的知识库 + 共享给我的知识库 -->
|
||||
@@ -168,7 +185,7 @@
|
||||
</t-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-right">
|
||||
<div v-if="!authStore.isLiteMode" class="bottom-right">
|
||||
<div class="personal-source">
|
||||
<t-icon name="user" size="14px" />
|
||||
<span>{{ $t('knowledgeList.myLabel') }}</span>
|
||||
@@ -342,7 +359,7 @@
|
||||
</t-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-right">
|
||||
<div v-if="!authStore.isLiteMode" class="bottom-right">
|
||||
<div class="personal-source">
|
||||
<t-icon name="user" size="14px" />
|
||||
<span>{{ $t('knowledgeList.myLabel') }}</span>
|
||||
@@ -605,6 +622,7 @@ import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
|
||||
import { listKnowledgeBases, deleteKnowledgeBase, togglePinKnowledgeBase } from '@/api/knowledge-base'
|
||||
import { formatStringDate } from '@/utils/index'
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useOrganizationStore } from '@/stores/organization'
|
||||
import { listOrganizationSharedKnowledgeBases, type SharedKnowledgeBase, type OrganizationSharedKnowledgeBaseItem, type SourceFromAgentInfo } from '@/api/organization'
|
||||
import KnowledgeBaseEditorModal from './KnowledgeBaseEditorModal.vue'
|
||||
@@ -615,6 +633,7 @@ import { useI18n } from 'vue-i18n'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const uiStore = useUIStore()
|
||||
const authStore = useAuthStore()
|
||||
const orgStore = useOrganizationStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -1579,10 +1598,16 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
transition: width 0.2s ease;
|
||||
}
|
||||
|
||||
@keyframes contentFadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.kb-card-wrap {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
grid-template-columns: 1fr;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
|
||||
.kb-card {
|
||||
@@ -1601,6 +1626,13 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
height: 160px;
|
||||
min-height: 160px;
|
||||
|
||||
&.kb-card-skeleton {
|
||||
cursor: default;
|
||||
.card-header { margin-bottom: 16px; }
|
||||
.card-content { flex: 1; }
|
||||
.card-bottom { margin-top: auto; }
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-brand-color);
|
||||
box-shadow: 0 4px 12px rgba(7, 192, 95, 0.12);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="ks-container">
|
||||
<div class="ks-content">
|
||||
<div class="header">
|
||||
<div class="header-title">
|
||||
<h2>{{ $t('knowledgeSearch.title') }}</h2>
|
||||
<p class="header-subtitle">{{ $t('knowledgeSearch.subtitle') }}</p>
|
||||
<div class="header" style="--wails-draggable: drag">
|
||||
<div class="header-title" style="--wails-draggable: drag">
|
||||
<h2 style="--wails-draggable: drag">{{ $t('knowledgeSearch.title') }}</h2>
|
||||
<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('knowledgeSearch.subtitle') }}</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<t-button variant="text" shape="square" :class="{ active: showSettings }" @click="showSettings = !showSettings">
|
||||
<div class="header-actions" style="--wails-draggable: no-drag">
|
||||
<t-button variant="text" shape="square" :class="{ active: showSettings }" style="--wails-draggable: no-drag" @click="showSettings = !showSettings">
|
||||
<template #icon><t-icon name="setting" /></template>
|
||||
</t-button>
|
||||
</div>
|
||||
|
||||
@@ -23,8 +23,13 @@
|
||||
:disabled="!props.kbId"
|
||||
@click.stop="handleNavigateToCurrentKB"
|
||||
>
|
||||
<span>{{ kbInfo?.name || '--' }}</span>
|
||||
<t-icon name="chevron-down" />
|
||||
<template v-if="!kbInfo">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '20px' }]" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{ kbInfo.name }}</span>
|
||||
<t-icon name="chevron-down" />
|
||||
</template>
|
||||
</button>
|
||||
</t-dropdown>
|
||||
<button
|
||||
@@ -34,13 +39,18 @@
|
||||
:disabled="!props.kbId"
|
||||
@click="handleNavigateToCurrentKB"
|
||||
>
|
||||
{{ kbInfo?.name || '--' }}
|
||||
<template v-if="!kbInfo">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '20px' }]" />
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ kbInfo.name }}
|
||||
</template>
|
||||
</button>
|
||||
<t-icon name="chevron-right" class="breadcrumb-separator" />
|
||||
<span class="breadcrumb-current">{{ $t('knowledgeEditor.faq.title') }}</span>
|
||||
</h2>
|
||||
<!-- 身份与最后更新:紧凑单行,置于标题行右侧,悬停显示权限说明 -->
|
||||
<div v-if="kbInfo" class="faq-access-meta">
|
||||
<div v-if="kbInfo && !authStore.isLiteMode" class="faq-access-meta">
|
||||
<t-tooltip :content="accessPermissionSummary" placement="top">
|
||||
<span class="faq-access-meta-inner">
|
||||
<t-tag size="small" :theme="isOwner ? 'success' : (effectiveKBPermission === 'admin' ? 'primary' : effectiveKBPermission === 'editor' ? 'warning' : 'default')" class="faq-access-role-tag">
|
||||
@@ -206,7 +216,7 @@
|
||||
:title="$t('knowledgeBase.tagCreateAction')"
|
||||
@click="startCreateTag"
|
||||
>
|
||||
<span class="create-tag-plus" aria-hidden="true">+</span>
|
||||
<t-icon name="add" />
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -222,13 +232,20 @@
|
||||
</template>
|
||||
</t-input>
|
||||
</div>
|
||||
<t-loading :loading="tagLoading" size="small">
|
||||
<div ref="tagListRef" class="faq-tag-list" @scroll="handleTagListScroll">
|
||||
<div ref="tagListRef" class="faq-tag-list" @scroll="handleTagListScroll">
|
||||
<template v-if="tagLoading && !filteredTags.length">
|
||||
<div v-for="n in 8" :key="'skel-tag-'+n" class="faq-tag-item" style="cursor: default; pointer-events: none;">
|
||||
<div class="faq-tag-left" style="gap: 12px; width: 100%;">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '80%', height: '18px' }]" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="creatingTag" class="faq-tag-item tag-editing" @click.stop>
|
||||
<div class="faq-tag-left">
|
||||
<t-icon name="folder" size="18px" />
|
||||
<div class="tag-edit-input">
|
||||
<t-input
|
||||
<div class="faq-tag-left">
|
||||
<span class="tag-hash-icon">#</span>
|
||||
<div class="tag-edit-input">
|
||||
<t-input
|
||||
ref="newTagInputRef"
|
||||
v-model="newTagName"
|
||||
size="small"
|
||||
@@ -270,9 +287,9 @@
|
||||
:class="{ active: selectedTagId === tag.seq_id, editing: editingTagId === tag.id }"
|
||||
@click="handleTagRowClick(tag.seq_id)"
|
||||
>
|
||||
<div class="faq-tag-left">
|
||||
<t-icon name="folder" size="18px" />
|
||||
<template v-if="editingTagId === tag.id">
|
||||
<div class="faq-tag-left">
|
||||
<span class="tag-hash-icon">#</span>
|
||||
<template v-if="editingTagId === tag.id">
|
||||
<div class="tag-edit-input" @click.stop>
|
||||
<t-input
|
||||
:ref="setEditingTagInputRefByTag(tag.id)"
|
||||
@@ -343,8 +360,8 @@
|
||||
<div v-if="tagLoadingMore" class="tag-loading-more">
|
||||
<t-loading size="small" />
|
||||
</div>
|
||||
</div>
|
||||
</t-loading>
|
||||
</template>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="faq-card-area">
|
||||
@@ -394,9 +411,22 @@
|
||||
</div>
|
||||
<!-- Card List Container with Scroll -->
|
||||
<div ref="scrollContainer" class="faq-scroll-container" @scroll="handleScroll">
|
||||
<t-loading :loading="loading && entries.length === 0" size="medium">
|
||||
<!-- FAQ 骨架屏 -->
|
||||
<div v-if="loading && entries.length === 0" class="faq-skeleton-grid">
|
||||
<div v-for="n in 6" :key="'faq-skel-'+n" class="faq-card faq-card-skeleton">
|
||||
<div class="faq-card-header">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '80%', height: '16px' }]" />
|
||||
</div>
|
||||
<div class="faq-card-body">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '100%', height: '13px' }, { width: '90%', height: '13px' }, { width: '60%', height: '13px' }]" />
|
||||
</div>
|
||||
<div class="faq-skel-footer">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '50px', height: '18px', type: 'rect' }, { width: '60px', height: '18px', type: 'rect' }]]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Card List -->
|
||||
<template v-if="entries.length > 0">
|
||||
<template v-else-if="entries.length > 0">
|
||||
<div ref="cardListRef" class="faq-card-list">
|
||||
<div
|
||||
v-for="entry in entries"
|
||||
@@ -614,8 +644,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="!loading" class="faq-empty-state">
|
||||
<template v-else-if="!loading">
|
||||
<div class="faq-empty-state">
|
||||
<div class="empty-content">
|
||||
<t-icon name="file-add" size="48px" class="empty-icon" />
|
||||
<div class="empty-text">{{ $t('knowledgeEditor.faq.emptyTitle') }}</div>
|
||||
@@ -623,7 +653,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-loading>
|
||||
<div v-if="loadingMore" class="faq-load-more">
|
||||
<t-loading size="small" :text="$t('common.loading')" />
|
||||
</div>
|
||||
@@ -1363,7 +1392,7 @@ const handleFaqAction = (data: { value: string }) => {
|
||||
}
|
||||
}
|
||||
|
||||
const loading = ref(false)
|
||||
const loading = ref(true)
|
||||
const loadingMore = ref(false)
|
||||
const entries = ref<FAQEntry[]>([])
|
||||
const entryStatusLoading = reactive<Record<number, boolean>>({})
|
||||
@@ -3274,22 +3303,21 @@ watch(() => entries.value.map(e => ({
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
background: var(--td-bg-color-container);
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
// 与列表页筛选区、文档型知识库标签栏一致:白底卡片感
|
||||
// 贴近整体系统设计语言的极简侧栏
|
||||
.faq-tag-panel {
|
||||
width: 200px;
|
||||
background: var(--td-bg-color-container);
|
||||
width: 180px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-right: 1px solid var(--td-component-stroke);
|
||||
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
|
||||
padding: 16px;
|
||||
flex-shrink: 0;
|
||||
box-shadow: 1px 0 0 rgba(0, 0, 0, 0.02);
|
||||
padding: 0 16px 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
max-height: 100%;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
@@ -3308,77 +3336,88 @@ watch(() => entries.value.map(e => ({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 12px;
|
||||
padding: 0 4px;
|
||||
color: var(--td-text-color-primary);
|
||||
|
||||
.sidebar-title {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
|
||||
.sidebar-count {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
align-items: center;
|
||||
|
||||
.create-tag-btn {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
padding: 0;
|
||||
border-radius: 6px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--td-success-color);
|
||||
line-height: 1;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
color: var(--td-text-color-secondary);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
.t-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-brand-color-active);
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
}
|
||||
|
||||
.create-tag-plus {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.sidebar-action-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 6px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--td-text-color-secondary);
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-success-color);
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tag-search-bar {
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 12px;
|
||||
padding: 0 4px;
|
||||
|
||||
:deep(.t-input) {
|
||||
font-size: 12px;
|
||||
background-color: var(--td-bg-color-container);
|
||||
border-color: var(--td-component-stroke);
|
||||
font-size: 13px;
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border-color: transparent;
|
||||
border-radius: 6px;
|
||||
box-shadow: none !important;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.t-is-focused {
|
||||
border-color: var(--td-brand-color);
|
||||
background-color: var(--td-bg-color-container);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.t-input__inner) {
|
||||
@@ -3415,13 +3454,13 @@ watch(() => entries.value.map(e => ({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 9px 12px;
|
||||
padding: 8px 8px;
|
||||
border-radius: 6px;
|
||||
color: var(--td-text-color-primary);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
|
||||
.faq-tag-left {
|
||||
@@ -3431,12 +3470,25 @@ watch(() => entries.value.map(e => ({
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
|
||||
.t-icon {
|
||||
.t-icon,
|
||||
.tag-hash-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: 14px;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.t-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.tag-hash-icon {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-name {
|
||||
@@ -3446,10 +3498,9 @@ watch(() => entries.value.map(e => ({
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 450;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.faq-tag-right {
|
||||
@@ -3462,37 +3513,34 @@ watch(() => entries.value.map(e => ({
|
||||
|
||||
.faq-tag-count {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-weight: 500;
|
||||
min-width: 28px;
|
||||
padding: 3px 7px;
|
||||
border-radius: 8px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-weight: 400;
|
||||
transition: all 0.2s ease;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
text-align: right;
|
||||
padding-left: 8px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-primary);
|
||||
|
||||
.faq-tag-left .t-icon {
|
||||
color: var(--td-text-color-primary);
|
||||
.faq-tag-left .t-icon,
|
||||
.faq-tag-left .tag-hash-icon {
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.faq-tag-count {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-primary);
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: var(--td-success-color-light);
|
||||
background: var(--td-brand-color-light);
|
||||
color: var(--td-brand-color);
|
||||
font-weight: 500;
|
||||
|
||||
.faq-tag-left .t-icon {
|
||||
.faq-tag-left .t-icon,
|
||||
.faq-tag-left .tag-hash-icon {
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
@@ -3501,13 +3549,7 @@ watch(() => entries.value.map(e => ({
|
||||
}
|
||||
|
||||
.faq-tag-count {
|
||||
background: var(--td-success-color-light);
|
||||
color: var(--td-brand-color);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--td-success-color-light);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3551,22 +3593,22 @@ watch(() => entries.value.map(e => ({
|
||||
}
|
||||
|
||||
:deep(.tag-action-btn.confirm) {
|
||||
background: var(--td-success-color-light);
|
||||
color: var(--td-brand-color-active);
|
||||
|
||||
&:hover {
|
||||
background: var(--td-success-color-light);
|
||||
color: var(--td-success-color);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.tag-action-btn.cancel) {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
background: transparent;
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.tag-action-btn.cancel) {
|
||||
background: transparent;
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3577,39 +3619,40 @@ watch(() => entries.value.map(e => ({
|
||||
max-width: 100%;
|
||||
|
||||
:deep(.t-input) {
|
||||
font-size: 12px;
|
||||
font-size: 13px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
:deep(.t-input__wrap) {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
:deep(.t-input__inner) {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
padding: 0;
|
||||
color: var(--td-text-color-primary);
|
||||
caret-color: var(--td-text-color-primary);
|
||||
caret-color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
:deep(.t-input:hover),
|
||||
:deep(.t-input.t-is-focused),
|
||||
:deep(.t-input__wrap:hover),
|
||||
:deep(.t-input__wrap.t-is-focused) {
|
||||
border-bottom-color: var(--td-success-color);
|
||||
border-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tag-more-btn {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
@@ -3617,23 +3660,15 @@ watch(() => entries.value.map(e => ({
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 4px;
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-text-color-placeholder);
|
||||
transition: all 0.2s ease;
|
||||
opacity: 0.6;
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-secondary);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.tag-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tag-more-placeholder {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
@@ -3653,12 +3688,13 @@ watch(() => entries.value.map(e => ({
|
||||
.faq-card-area {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px;
|
||||
min-height: 0;
|
||||
padding: 0 0 0 16px;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
background: var(--td-bg-color-container);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.faq-search-bar {
|
||||
@@ -3683,7 +3719,7 @@ watch(() => entries.value.map(e => ({
|
||||
background: transparent;
|
||||
border: none;
|
||||
&:hover {
|
||||
color: var(--td-text-color-secondary);
|
||||
color: var(--td-brand-color);
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
}
|
||||
}
|
||||
@@ -3691,15 +3727,17 @@ watch(() => entries.value.map(e => ({
|
||||
|
||||
:deep(.t-input) {
|
||||
font-size: 13px;
|
||||
background-color: var(--td-bg-color-container);
|
||||
border-color: var(--td-component-stroke);
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border-color: transparent;
|
||||
border-radius: 6px;
|
||||
box-shadow: none !important;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.t-is-focused {
|
||||
border-color: var(--td-brand-color);
|
||||
background-color: var(--td-bg-color-container);
|
||||
border-color: var(--td-success-color);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4171,10 +4209,40 @@ watch(() => entries.value.map(e => ({
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
@keyframes contentFadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.faq-skeleton-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
|
||||
.faq-card-skeleton {
|
||||
cursor: default;
|
||||
height: auto;
|
||||
.faq-card-header {
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
}
|
||||
.faq-card-body {
|
||||
padding: 8px 0;
|
||||
}
|
||||
.faq-skel-footer {
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid var(--td-component-stroke);
|
||||
}
|
||||
}
|
||||
|
||||
// 卡片列表样式 - 使用绝对定位实现瀑布流,下一行补齐上一行空缺
|
||||
.faq-card-list {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,13 @@ const engineOptions = computed(() => {
|
||||
available: statusMap.s3,
|
||||
disabled: statusMap.s3 === false,
|
||||
},
|
||||
{
|
||||
value: 'oss',
|
||||
label: t('kbSettings.storage.engineOss'),
|
||||
desc: t('kbSettings.storage.engineOssDesc'),
|
||||
available: statusMap.oss,
|
||||
disabled: statusMap.oss === false,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@@ -8,17 +8,18 @@
|
||||
:count-joined="joinedCount"
|
||||
/>
|
||||
<div class="org-list-content">
|
||||
<div class="header">
|
||||
<div class="header-title">
|
||||
<div class="title-row">
|
||||
<h2>{{ $t('organization.title') }}</h2>
|
||||
<div class="header-actions">
|
||||
<div class="header" style="--wails-draggable: drag">
|
||||
<div class="header-title" style="--wails-draggable: drag">
|
||||
<div class="title-row" style="--wails-draggable: drag">
|
||||
<h2 style="--wails-draggable: drag">{{ $t('organization.title') }}</h2>
|
||||
<div class="header-actions" style="--wails-draggable: no-drag">
|
||||
<t-tooltip :content="$t('organization.joinOrg')" placement="bottom">
|
||||
<t-button
|
||||
variant="text"
|
||||
theme="default"
|
||||
size="small"
|
||||
class="header-action-btn"
|
||||
style="--wails-draggable: no-drag"
|
||||
@click="handleJoinOrganization"
|
||||
>
|
||||
<template #icon><t-icon name="enter" size="16px" /></template>
|
||||
@@ -30,6 +31,7 @@
|
||||
theme="default"
|
||||
size="small"
|
||||
class="header-action-btn"
|
||||
style="--wails-draggable: no-drag"
|
||||
@click="handleCreateOrganization"
|
||||
>
|
||||
<template #icon><img src="@/assets/img/organization-green.svg" class="org-create-icon" alt="" aria-hidden="true" /></template>
|
||||
@@ -37,10 +39,25 @@
|
||||
</t-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<p class="header-subtitle">{{ $t('organization.subtitle') }}</p>
|
||||
<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('organization.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="org-list-main">
|
||||
<!-- 骨架屏占位 -->
|
||||
<div v-if="loading && filteredOrganizations.length === 0" class="org-card-wrap">
|
||||
<div v-for="n in 4" :key="'skel-'+n" class="org-card org-card-skeleton">
|
||||
<div class="card-header">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '36px', height: '36px', type: 'circle' }, { width: '50%', height: '20px' }]]" />
|
||||
</div>
|
||||
<div style="flex:1;margin-top:12px">
|
||||
<t-skeleton animation="gradient" :row-col="[{ width: '100%', height: '14px' }, { width: '70%', height: '14px' }]" />
|
||||
</div>
|
||||
<div style="margin-top:auto">
|
||||
<t-skeleton animation="gradient" :row-col="[[{ width: '60px', height: '22px', type: 'rect' }, { width: '60px', height: '22px', type: 'rect' }]]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片网格 -->
|
||||
<div v-if="filteredOrganizations.length > 0" class="org-card-wrap">
|
||||
<div
|
||||
@@ -1404,10 +1421,24 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes contentFadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.org-card-wrap {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
grid-template-columns: 1fr;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
|
||||
.org-card-skeleton {
|
||||
cursor: default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 160px;
|
||||
min-height: 160px;
|
||||
}
|
||||
|
||||
/* 与知识库列表卡片统一尺寸:160px 高、18px 20px 内边距、12px 圆角 */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="main" ref="dropzone">
|
||||
<Menu></Menu>
|
||||
<RouterView />
|
||||
<RouterView v-if="isRouterAlive" />
|
||||
<div class="upload-mask" v-show="ismask">
|
||||
<input type="file" style="display: none" ref="uploadInput" accept=".pdf,.docx,.doc,.pptx,.ppt,.txt,.md,.jpg,.jpeg,.png,.csv,.xls,.xlsx" />
|
||||
<UploadMask></UploadMask>
|
||||
@@ -12,7 +12,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import Menu from '@/components/menu.vue'
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { ref, onMounted, onUnmounted, nextTick, provide } from 'vue';
|
||||
import { useRoute } from 'vue-router'
|
||||
import useKnowledgeBase from '@/hooks/useKnowledgeBase'
|
||||
import UploadMask from '@/components/upload-mask.vue'
|
||||
@@ -27,6 +27,22 @@ let ismask = ref(false)
|
||||
let uploadInput = ref();
|
||||
const { t } = useI18n();
|
||||
|
||||
const isRouterAlive = ref(true)
|
||||
const reloadApp = () => {
|
||||
isRouterAlive.value = false
|
||||
nextTick(() => {
|
||||
isRouterAlive.value = true
|
||||
})
|
||||
}
|
||||
provide('app:reload', reloadApp)
|
||||
|
||||
const handleGlobalKeyDown = (e: KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'r') {
|
||||
e.preventDefault()
|
||||
reloadApp()
|
||||
}
|
||||
}
|
||||
|
||||
// 用于跟踪拖拽进入/离开的计数器,解决子元素触发 dragleave 的问题
|
||||
let dragCounter = 0;
|
||||
|
||||
@@ -118,6 +134,14 @@ onMounted(() => {
|
||||
document.addEventListener('dragover', handleGlobalDragOver, true);
|
||||
document.addEventListener('dragleave', handleGlobalDragLeave, true);
|
||||
document.addEventListener('drop', handleGlobalDrop, true);
|
||||
window.addEventListener('keydown', handleGlobalKeyDown);
|
||||
// @ts-ignore
|
||||
if (window.runtime?.EventsOn) {
|
||||
// @ts-ignore
|
||||
window.runtime.EventsOn('app:reload', () => {
|
||||
reloadApp()
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// 组件卸载时移除全局事件监听器
|
||||
@@ -126,6 +150,12 @@ onUnmounted(() => {
|
||||
document.removeEventListener('dragover', handleGlobalDragOver, true);
|
||||
document.removeEventListener('dragleave', handleGlobalDragLeave, true);
|
||||
document.removeEventListener('drop', handleGlobalDrop, true);
|
||||
window.removeEventListener('keydown', handleGlobalKeyDown);
|
||||
// @ts-ignore
|
||||
if (window.runtime?.EventsOff) {
|
||||
// @ts-ignore
|
||||
window.runtime.EventsOff('app:reload')
|
||||
}
|
||||
dragCounter = 0;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -55,6 +55,96 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- API base URL -->
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('tenant.api.urlLabel') }}</label>
|
||||
<p class="desc">{{ $t('tenant.api.urlDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<div class="api-key-control">
|
||||
<t-input
|
||||
:model-value="apiBaseUrlDisplay"
|
||||
readonly
|
||||
type="text"
|
||||
style="width: 100%; font-family: monospace; font-size: 12px;"
|
||||
/>
|
||||
<t-button
|
||||
size="small"
|
||||
variant="text"
|
||||
@click="copyApiUrl"
|
||||
:title="$t('tenant.api.copyUrlTitle')"
|
||||
>
|
||||
<t-icon name="file-copy" />
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Desktop (Wails): fixed local API port + optional LAN/public listen -->
|
||||
<template v-if="showDesktopPortSetting || showDesktopBindPublicSetting">
|
||||
<div v-if="showDesktopPortSetting" class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('tenant.api.desktopPortLabel') }}</label>
|
||||
<p class="desc">{{ $t('tenant.api.desktopPortDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<div class="api-key-control">
|
||||
<div class="desktop-port-input-wrap">
|
||||
<t-input-number
|
||||
v-model="desktopPortInput"
|
||||
:min="0"
|
||||
:max="65535"
|
||||
theme="normal"
|
||||
/>
|
||||
</div>
|
||||
<t-button size="small" variant="text" @click="saveDesktopPort">
|
||||
{{ $t('tenant.api.desktopPortSave') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="showDesktopBindPublicSetting" class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('tenant.api.desktopBindPublicLabel') }}</label>
|
||||
<p class="desc">{{ $t('tenant.api.desktopBindPublicDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control desktop-bind-public-control">
|
||||
<t-switch v-model="desktopBindPublicInput" @change="onDesktopBindPublicChange" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="wailsApiLanBaseURL" class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('tenant.api.lanUrlLabel') }}</label>
|
||||
<p class="desc">{{ $t('tenant.api.lanUrlDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<div class="api-key-control">
|
||||
<t-input
|
||||
:model-value="wailsApiLanBaseURL"
|
||||
readonly
|
||||
type="text"
|
||||
style="width: 100%; font-family: monospace; font-size: 12px;"
|
||||
/>
|
||||
<t-button
|
||||
size="small"
|
||||
variant="text"
|
||||
@click="copyLanApiUrl"
|
||||
:title="$t('tenant.api.lanUrlCopyTitle')"
|
||||
>
|
||||
<t-icon name="file-copy" />
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="showLanUrlUnavailableHint" class="setting-row lan-url-hint-row">
|
||||
<t-alert theme="warning" :message="$t('tenant.api.lanUrlUnavailable')" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- API docs -->
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
@@ -123,6 +213,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { getCurrentUser, type TenantInfo, type UserInfo } from '@/api/auth'
|
||||
import { getApiBaseUrl } from '@/utils/api-base'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
@@ -134,6 +225,14 @@ const userInfo = ref<UserInfo | null>(null)
|
||||
const loading = ref(true)
|
||||
const error = ref('')
|
||||
const showApiKey = ref(false)
|
||||
/** WeKnora Lite (Wails): real API origin is loopback + dynamic port, not window.location.origin */
|
||||
const wailsApiBaseURL = ref<string | null>(null)
|
||||
const showDesktopPortSetting = ref(false)
|
||||
const showDesktopBindPublicSetting = ref(false)
|
||||
const desktopPortInput = ref<number | undefined>(0)
|
||||
const desktopBindPublicInput = ref(false)
|
||||
const wailsApiLanBaseURL = ref<string | null>(null)
|
||||
const desktopListenPublicActive = ref(false)
|
||||
|
||||
// Computed
|
||||
const displayApiKey = computed(() => {
|
||||
@@ -148,6 +247,164 @@ const displayApiKey = computed(() => {
|
||||
return masked
|
||||
})
|
||||
|
||||
const showLanUrlUnavailableHint = computed(
|
||||
() =>
|
||||
showDesktopBindPublicSetting.value &&
|
||||
desktopListenPublicActive.value &&
|
||||
!wailsApiLanBaseURL.value
|
||||
)
|
||||
|
||||
const apiBaseUrlDisplay = computed(() => {
|
||||
if (wailsApiBaseURL.value) {
|
||||
return wailsApiBaseURL.value
|
||||
}
|
||||
const configured = getApiBaseUrl().trim().replace(/\/$/, '')
|
||||
let origin = typeof window !== 'undefined' ? window.location.origin : ''
|
||||
if (!origin || origin === 'null') {
|
||||
origin = ''
|
||||
}
|
||||
const base = configured || origin
|
||||
return `${base}/api/v1`
|
||||
})
|
||||
|
||||
type WeKnoraDesktopWindow = Window & {
|
||||
__WEKNORA_API_BASE__?: string
|
||||
__WEKNORA_API_LAN_BASE__?: string
|
||||
go?: {
|
||||
main?: {
|
||||
App?: {
|
||||
GetAPIBaseURL?: () => Promise<string> | string
|
||||
GetAPILanBaseURL?: () => Promise<string> | string
|
||||
GetDesktopHTTPPortSetting?: () => Promise<number> | number
|
||||
GetDesktopHTTPBindPublicSetting?: () => Promise<boolean> | boolean
|
||||
GetDesktopListenPublicActive?: () => Promise<boolean> | boolean
|
||||
SetDesktopHTTPPortSetting?: (port: number) => Promise<void> | void
|
||||
SetDesktopHTTPBindPublicSetting?: (v: boolean) => Promise<void> | void
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function tryLoadWailsApiBaseURL() {
|
||||
const win = window as WeKnoraDesktopWindow
|
||||
for (let i = 0; i < 40; i++) {
|
||||
const injected = win.__WEKNORA_API_BASE__
|
||||
if (typeof injected === 'string' && injected.trim()) {
|
||||
wailsApiBaseURL.value = injected.trim().replace(/\/$/, '')
|
||||
await tryLoadWailsLanHints(win)
|
||||
return
|
||||
}
|
||||
const fn = win.go?.main?.App?.GetAPIBaseURL
|
||||
if (typeof fn === 'function') {
|
||||
try {
|
||||
const raw = await Promise.resolve(fn())
|
||||
if (typeof raw === 'string' && raw.trim()) {
|
||||
wailsApiBaseURL.value = raw.trim().replace(/\/$/, '')
|
||||
}
|
||||
} catch {
|
||||
/* binding error */
|
||||
}
|
||||
await tryLoadWailsLanHints(win)
|
||||
return
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 50))
|
||||
}
|
||||
await tryLoadWailsLanHints(win)
|
||||
}
|
||||
|
||||
async function tryLoadWailsLanHints(win: WeKnoraDesktopWindow) {
|
||||
const injectedLan = win.__WEKNORA_API_LAN_BASE__
|
||||
if (typeof injectedLan === 'string' && injectedLan.trim()) {
|
||||
wailsApiLanBaseURL.value = injectedLan.trim().replace(/\/$/, '')
|
||||
}
|
||||
const fnLan = win.go?.main?.App?.GetAPILanBaseURL
|
||||
if (typeof fnLan === 'function' && !wailsApiLanBaseURL.value) {
|
||||
try {
|
||||
const raw = await Promise.resolve(fnLan())
|
||||
if (typeof raw === 'string' && raw.trim()) {
|
||||
wailsApiLanBaseURL.value = raw.trim().replace(/\/$/, '')
|
||||
}
|
||||
} catch {
|
||||
/* binding error */
|
||||
}
|
||||
}
|
||||
const fnAct = win.go?.main?.App?.GetDesktopListenPublicActive
|
||||
if (typeof fnAct === 'function') {
|
||||
try {
|
||||
desktopListenPublicActive.value = !!(await Promise.resolve(fnAct()))
|
||||
} catch {
|
||||
desktopListenPublicActive.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function desktopPortBindingsAvailable(win: WeKnoraDesktopWindow) {
|
||||
const app = win.go?.main?.App
|
||||
return typeof app?.GetDesktopHTTPPortSetting === 'function' && typeof app?.SetDesktopHTTPPortSetting === 'function'
|
||||
}
|
||||
|
||||
function desktopBindPublicBindingsAvailable(win: WeKnoraDesktopWindow) {
|
||||
const app = win.go?.main?.App
|
||||
return (
|
||||
typeof app?.GetDesktopHTTPBindPublicSetting === 'function' &&
|
||||
typeof app?.SetDesktopHTTPBindPublicSetting === 'function'
|
||||
)
|
||||
}
|
||||
|
||||
async function loadDesktopApiPrefs() {
|
||||
const win = window as WeKnoraDesktopWindow
|
||||
if (desktopPortBindingsAvailable(win)) {
|
||||
showDesktopPortSetting.value = true
|
||||
try {
|
||||
const p = await Promise.resolve(win.go!.main!.App!.GetDesktopHTTPPortSetting!())
|
||||
desktopPortInput.value = typeof p === 'number' ? p : 0
|
||||
} catch {
|
||||
desktopPortInput.value = 0
|
||||
}
|
||||
}
|
||||
if (desktopBindPublicBindingsAvailable(win)) {
|
||||
showDesktopBindPublicSetting.value = true
|
||||
try {
|
||||
const b = await Promise.resolve(win.go!.main!.App!.GetDesktopHTTPBindPublicSetting!())
|
||||
desktopBindPublicInput.value = !!b
|
||||
} catch {
|
||||
desktopBindPublicInput.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const onDesktopBindPublicChange = async (value: boolean) => {
|
||||
const v = value === true
|
||||
const win = window as WeKnoraDesktopWindow
|
||||
const fn = win.go?.main?.App?.SetDesktopHTTPBindPublicSetting
|
||||
if (typeof fn !== 'function') return
|
||||
try {
|
||||
await Promise.resolve(fn(v))
|
||||
MessagePlugin.success(t('tenant.api.desktopBindPublicSaved'))
|
||||
} catch (err: unknown) {
|
||||
MessagePlugin.error(err instanceof Error ? err.message : t('tenant.api.desktopBindPublicSaveFailed'))
|
||||
desktopBindPublicInput.value = !v
|
||||
}
|
||||
}
|
||||
|
||||
const saveDesktopPort = async () => {
|
||||
const v = desktopPortInput.value
|
||||
const port = typeof v === 'number' && !Number.isNaN(v) ? Math.floor(v) : 0
|
||||
if (port < 0 || port > 65535) {
|
||||
MessagePlugin.warning(t('tenant.api.desktopPortInvalid'))
|
||||
return
|
||||
}
|
||||
const win = window as WeKnoraDesktopWindow
|
||||
const fn = win.go?.main?.App?.SetDesktopHTTPPortSetting
|
||||
if (typeof fn !== 'function') return
|
||||
try {
|
||||
await Promise.resolve(fn(port))
|
||||
MessagePlugin.success(t('tenant.api.desktopPortSaved'))
|
||||
} catch (err: unknown) {
|
||||
MessagePlugin.error(err instanceof Error ? err.message : t('tenant.api.desktopPortSaveFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
// Methods
|
||||
const loadInfo = async () => {
|
||||
try {
|
||||
@@ -203,6 +460,37 @@ const copyApiKey = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const copyLanApiUrl = async () => {
|
||||
const text = wailsApiLanBaseURL.value
|
||||
if (!text) return
|
||||
try {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
await navigator.clipboard.writeText(text)
|
||||
} else {
|
||||
fallbackCopyText(text)
|
||||
}
|
||||
MessagePlugin.success(t('tenant.api.lanUrlCopySuccess'))
|
||||
} catch {
|
||||
fallbackCopyText(text)
|
||||
MessagePlugin.success(t('tenant.api.lanUrlCopySuccess'))
|
||||
}
|
||||
}
|
||||
|
||||
const copyApiUrl = async () => {
|
||||
const text = apiBaseUrlDisplay.value
|
||||
try {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
await navigator.clipboard.writeText(text)
|
||||
} else {
|
||||
fallbackCopyText(text)
|
||||
}
|
||||
MessagePlugin.success(t('tenant.api.urlCopySuccess'))
|
||||
} catch {
|
||||
fallbackCopyText(text)
|
||||
MessagePlugin.success(t('tenant.api.urlCopySuccess'))
|
||||
}
|
||||
}
|
||||
|
||||
const formatDate = (dateStr: string | undefined) => {
|
||||
if (!dateStr) return t('tenant.unknown')
|
||||
|
||||
@@ -222,7 +510,9 @@ const formatDate = (dateStr: string | undefined) => {
|
||||
}
|
||||
|
||||
// Lifecycle
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
await tryLoadWailsApiBaseURL()
|
||||
await loadDesktopApiPrefs()
|
||||
loadInfo()
|
||||
})
|
||||
</script>
|
||||
@@ -328,7 +618,7 @@ onMounted(() => {
|
||||
min-width: 280px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
|
||||
.info-value {
|
||||
font-size: 14px;
|
||||
@@ -356,5 +646,37 @@ onMounted(() => {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 与 API Key / API 地址 行一致:输入区占满 flex 剩余宽度,文案按钮贴右 */
|
||||
.desktop-port-input-wrap {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.t-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.t-input__wrap) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(input) {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.desktop-bind-public-control {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.lan-url-hint-row {
|
||||
padding-top: 0;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
|
||||
:deep(.t-alert) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -73,6 +73,19 @@
|
||||
</t-link>
|
||||
</template>
|
||||
</t-alert>
|
||||
|
||||
<!-- 自动下载更新开关 (Lite edition only) -->
|
||||
<div class="setting-row" v-if="authStore.isLiteMode">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('settings.autoCheckUpdate') }}</label>
|
||||
<p class="desc">{{ $t('settings.autoCheckUpdateDesc') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-switch
|
||||
v-model="isAutoCheckUpdateEnabled"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -82,11 +95,13 @@ import { ref, onMounted, computed } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useSettingsStore } from '@/stores/settings'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { getSystemInfo } from '@/api/system'
|
||||
import { useTheme, type ThemeMode } from '@/composables/useTheme'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const settingsStore = useSettingsStore()
|
||||
const authStore = useAuthStore()
|
||||
const { currentTheme, setTheme } = useTheme()
|
||||
|
||||
// 本地状态
|
||||
@@ -106,6 +121,21 @@ const isMemoryEnabled = computed({
|
||||
set: (val) => settingsStore.toggleMemory(val)
|
||||
})
|
||||
|
||||
// 自动检查更新状态
|
||||
const isAutoCheckUpdateEnabled = computed({
|
||||
get: () => settingsStore.isAutoCheckUpdateEnabled,
|
||||
set: (val) => {
|
||||
settingsStore.toggleAutoCheckUpdate(val)
|
||||
if (val) {
|
||||
// @ts-ignore
|
||||
if (window.go && window.go.main && window.go.main.App && window.go.main.App.AutoCheckForUpdates) {
|
||||
// @ts-ignore
|
||||
window.go.main.App.AutoCheckForUpdates()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 初始化加载
|
||||
onMounted(async () => {
|
||||
// 从 localStorage 加载语言设置
|
||||
|
||||
@@ -3,37 +3,71 @@
|
||||
<div class="section-header">
|
||||
<h2>{{ $t('modelSettings.title') }}</h2>
|
||||
<p class="section-description">{{ $t('modelSettings.description') }}</p>
|
||||
|
||||
<!-- 内置模型说明 -->
|
||||
<div class="builtin-models-info">
|
||||
<div class="info-box">
|
||||
<div class="info-header">
|
||||
<t-icon name="info-circle" class="info-icon" />
|
||||
<span class="info-title">{{ $t('modelSettings.builtinModels.title') }}</span>
|
||||
</div>
|
||||
<div class="info-content">
|
||||
<p>{{ $t('modelSettings.builtinModels.description') }}</p>
|
||||
<p class="doc-link">
|
||||
<t-icon name="link" class="link-icon" />
|
||||
<a href="https://github.com/Tencent/WeKnora/blob/main/docs/BUILTIN_MODELS.md" target="_blank" rel="noopener noreferrer">
|
||||
{{ $t('modelSettings.builtinModels.viewGuide') }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="builtin-models-hint" role="note">
|
||||
<p class="builtin-hint-label">{{ $t('modelSettings.builtinModels.title') }}</p>
|
||||
<p class="builtin-hint-text">{{ $t('modelSettings.builtinModels.description') }}</p>
|
||||
<a
|
||||
class="builtin-hint-link"
|
||||
href="https://github.com/Tencent/WeKnora/blob/main/docs/BUILTIN_MODELS.md"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{ $t('modelSettings.builtinModels.viewGuide') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- WeKnoraCloud 厂商配置 -->
|
||||
<div class="weknoracloud-config-section" style="margin-bottom: 24px;">
|
||||
<div class="category-header" style="margin-bottom: 12px;">
|
||||
<h3 style="margin: 0; font-size: 16px; font-weight: 600;">WeKnoraCloud 厂商配置</h3>
|
||||
</div>
|
||||
<!-- 凭证失效警告 -->
|
||||
<div v-if="weKnoraCloudNeedsReinit" style="margin-bottom: 12px; background: #fff7ed; border: 1px solid #fed7aa; border-left: 3px solid #f97316; border-radius: 6px; padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px;">
|
||||
<t-icon name="error-circle" style="font-size: 16px; color: #f97316; flex-shrink: 0; margin-top: 1px;" />
|
||||
<div style="font-size: 13px; color: #9a3412; line-height: 1.5;">
|
||||
<strong>WeKnoraCloud 凭证已失效</strong><br />
|
||||
{{ weKnoraCloudReinitReason || '服务重启后加密密钥已变更,已保存的凭证无法解密。' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="weknoracloud-config-card" style="background: var(--td-bg-color-container); border: 1px solid var(--td-component-stroke); border-radius: 8px; padding: 20px;">
|
||||
<div style="display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;">
|
||||
<t-form-item label="APPID" style="margin-bottom: 0;">
|
||||
<t-input v-model="weKnoraCloudForm.appId" placeholder="请输入 APPID" style="width: 240px;" />
|
||||
</t-form-item>
|
||||
<t-form-item label="APPSECRET" style="margin-bottom: 0;">
|
||||
<t-input
|
||||
v-model="weKnoraCloudForm.appSecret"
|
||||
type="password"
|
||||
placeholder="请输入 APPSECRET"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-button
|
||||
theme="primary"
|
||||
:loading="weKnoraCloudLoading"
|
||||
@click="handleWeKnoraCloudInit"
|
||||
>
|
||||
保存并初始化
|
||||
</t-button>
|
||||
</div>
|
||||
<p style="color: var(--td-text-color-secondary); font-size: 12px; margin-top: 12px; margin-bottom: 0;">
|
||||
提交后将自动创建或更新三个模型(Chat / Embedding / Rerank)并设为各类型默认
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 对话模型 -->
|
||||
<div class="model-category-section" data-model-type="chat">
|
||||
<div class="category-header">
|
||||
<div class="header-info">
|
||||
<div class="settings-group model-type-group" data-model-type="chat">
|
||||
<div class="section-subheader">
|
||||
<div class="subheader-text">
|
||||
<h3>{{ $t('modelSettings.chat.title') }}</h3>
|
||||
<p>{{ $t('modelSettings.chat.desc') }}</p>
|
||||
<p class="section-desc">{{ $t('modelSettings.chat.desc') }}</p>
|
||||
</div>
|
||||
<t-button size="small" theme="primary" @click="openAddDialog('chat')" class="add-model-btn">
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('chat')">
|
||||
<template #icon>
|
||||
<t-icon name="add" class="add-icon" />
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
@@ -65,24 +99,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">
|
||||
<p class="empty-text">{{ $t('modelSettings.chat.empty') }}</p>
|
||||
<t-button theme="default" variant="outline" size="small" @click="openAddDialog('chat')">
|
||||
<div v-else class="empty-models">
|
||||
<p>{{ $t('modelSettings.chat.empty') }}</p>
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('chat')">
|
||||
<template #icon>
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Embedding 模型 -->
|
||||
<div class="model-category-section" data-model-type="embedding">
|
||||
<div class="category-header">
|
||||
<div class="header-info">
|
||||
<div class="settings-group model-type-group" data-model-type="embedding">
|
||||
<div class="section-subheader">
|
||||
<div class="subheader-text">
|
||||
<h3>{{ $t('modelSettings.embedding.title') }}</h3>
|
||||
<p>{{ $t('modelSettings.embedding.desc') }}</p>
|
||||
<p class="section-desc">{{ $t('modelSettings.embedding.desc') }}</p>
|
||||
</div>
|
||||
<t-button size="small" theme="primary" @click="openAddDialog('embedding')" class="add-model-btn">
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('embedding')">
|
||||
<template #icon>
|
||||
<t-icon name="add" class="add-icon" />
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
@@ -115,24 +152,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">
|
||||
<p class="empty-text">{{ $t('modelSettings.embedding.empty') }}</p>
|
||||
<t-button theme="default" variant="outline" size="small" @click="openAddDialog('embedding')">
|
||||
<div v-else class="empty-models">
|
||||
<p>{{ $t('modelSettings.embedding.empty') }}</p>
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('embedding')">
|
||||
<template #icon>
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ReRank 模型 -->
|
||||
<div class="model-category-section" data-model-type="rerank">
|
||||
<div class="category-header">
|
||||
<div class="header-info">
|
||||
<div class="settings-group model-type-group" data-model-type="rerank">
|
||||
<div class="section-subheader">
|
||||
<div class="subheader-text">
|
||||
<h3>{{ $t('modelSettings.rerank.title') }}</h3>
|
||||
<p>{{ $t('modelSettings.rerank.desc') }}</p>
|
||||
<p class="section-desc">{{ $t('modelSettings.rerank.desc') }}</p>
|
||||
</div>
|
||||
<t-button size="small" theme="primary" @click="openAddDialog('rerank')" class="add-model-btn">
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('rerank')">
|
||||
<template #icon>
|
||||
<t-icon name="add" class="add-icon" />
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
@@ -164,24 +204,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">
|
||||
<p class="empty-text">{{ $t('modelSettings.rerank.empty') }}</p>
|
||||
<t-button theme="default" variant="outline" size="small" @click="openAddDialog('rerank')">
|
||||
<div v-else class="empty-models">
|
||||
<p>{{ $t('modelSettings.rerank.empty') }}</p>
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('rerank')">
|
||||
<template #icon>
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VLLM 视觉模型 -->
|
||||
<div class="model-category-section" data-model-type="vllm">
|
||||
<div class="category-header">
|
||||
<div class="header-info">
|
||||
<div class="settings-group model-type-group" data-model-type="vllm">
|
||||
<div class="section-subheader">
|
||||
<div class="subheader-text">
|
||||
<h3>{{ $t('modelSettings.vllm.title') }}</h3>
|
||||
<p>{{ $t('modelSettings.vllm.desc') }}</p>
|
||||
<p class="section-desc">{{ $t('modelSettings.vllm.desc') }}</p>
|
||||
</div>
|
||||
<t-button size="small" theme="primary" @click="openAddDialog('vllm')" class="add-model-btn">
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('vllm')">
|
||||
<template #icon>
|
||||
<t-icon name="add" class="add-icon" />
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
@@ -213,24 +256,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">
|
||||
<p class="empty-text">{{ $t('modelSettings.vllm.empty') }}</p>
|
||||
<t-button theme="default" variant="outline" size="small" @click="openAddDialog('vllm')">
|
||||
<div v-else class="empty-models">
|
||||
<p>{{ $t('modelSettings.vllm.empty') }}</p>
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('vllm')">
|
||||
<template #icon>
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- STT 语音模型 -->
|
||||
<div class="model-category-section" data-model-type="asr">
|
||||
<div class="category-header">
|
||||
<div class="header-info">
|
||||
<div class="settings-group model-type-group" data-model-type="asr">
|
||||
<div class="section-subheader">
|
||||
<div class="subheader-text">
|
||||
<h3>{{ $t('modelSettings.asr.title') }}</h3>
|
||||
<p>{{ $t('modelSettings.asr.desc') }}</p>
|
||||
<p class="section-desc">{{ $t('modelSettings.asr.desc') }}</p>
|
||||
</div>
|
||||
<t-button size="small" theme="primary" @click="openAddDialog('asr')" class="add-model-btn">
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('asr')">
|
||||
<template #icon>
|
||||
<t-icon name="add" class="add-icon" />
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
@@ -261,9 +307,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">
|
||||
<p class="empty-text">{{ $t('modelSettings.asr.empty') }}</p>
|
||||
<t-button theme="default" variant="outline" size="small" @click="openAddDialog('asr')">
|
||||
<div v-else class="empty-models">
|
||||
<p>{{ $t('modelSettings.asr.empty') }}</p>
|
||||
<t-button theme="primary" size="small" @click="openAddDialog('asr')">
|
||||
<template #icon>
|
||||
<add-icon />
|
||||
</template>
|
||||
{{ $t('modelSettings.actions.addModel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
@@ -283,9 +332,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { AddIcon } from 'tdesign-icons-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import ModelEditorDialog from '@/components/ModelEditorDialog.vue'
|
||||
import { listModels, createModel, updateModel as updateModelAPI, deleteModel as deleteModelAPI, type ModelConfig } from '@/api/model'
|
||||
import { listModels, createModel, updateModel as updateModelAPI, deleteModel as deleteModelAPI, initializeWeKnoraCloud, getWeKnoraCloudStatus, type ModelConfig } from '@/api/model'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -294,6 +344,38 @@ const currentModelType = ref<'chat' | 'embedding' | 'rerank' | 'vllm' | 'asr'>('
|
||||
const editingModel = ref<any>(null)
|
||||
const loading = ref(true)
|
||||
|
||||
// WeKnoraCloud 配置
|
||||
const weKnoraCloudForm = ref({ appId: '', appSecret: '' })
|
||||
const weKnoraCloudLoading = ref(false)
|
||||
const weKnoraCloudNeedsReinit = ref(false)
|
||||
const weKnoraCloudReinitReason = ref('')
|
||||
|
||||
const handleWeKnoraCloudInit = async () => {
|
||||
if (!weKnoraCloudForm.value.appId || !weKnoraCloudForm.value.appSecret) {
|
||||
MessagePlugin.warning('请填写 APPID 和 APPSECRET')
|
||||
return
|
||||
}
|
||||
weKnoraCloudLoading.value = true
|
||||
try {
|
||||
const result = await initializeWeKnoraCloud({
|
||||
app_id: weKnoraCloudForm.value.appId,
|
||||
app_secret: weKnoraCloudForm.value.appSecret,
|
||||
})
|
||||
const updatedCount = result.models.filter((m: any) => m.action === 'updated').length
|
||||
const createdCount = result.models.filter((m: any) => m.action === 'created').length
|
||||
MessagePlugin.success(`初始化成功:新建 ${createdCount} 个,更新 ${updatedCount} 个模型`)
|
||||
weKnoraCloudForm.value.appId = ''
|
||||
weKnoraCloudForm.value.appSecret = ''
|
||||
weKnoraCloudNeedsReinit.value = false
|
||||
weKnoraCloudReinitReason.value = ''
|
||||
await loadModels()
|
||||
} catch (err: any) {
|
||||
MessagePlugin.error(err?.message || 'WeKnoraCloud 初始化失败')
|
||||
} finally {
|
||||
weKnoraCloudLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 模型列表数据
|
||||
const allModels = ref<ModelConfig[]>([])
|
||||
|
||||
@@ -351,6 +433,10 @@ const loadModels = async () => {
|
||||
// 直接获取所有模型,不分类型
|
||||
const models = await listModels()
|
||||
allModels.value = models
|
||||
// 检查 WeKnoraCloud 凭证状态
|
||||
const status = await getWeKnoraCloudStatus()
|
||||
weKnoraCloudNeedsReinit.value = status.needs_reinit
|
||||
weKnoraCloudReinitReason.value = status.reason || ''
|
||||
} catch (error: any) {
|
||||
console.error('加载模型列表失败:', error)
|
||||
MessagePlugin.error(error.message)
|
||||
@@ -553,63 +639,90 @@ onMounted(() => {
|
||||
.section-description {
|
||||
font-size: 14px;
|
||||
color: var(--td-text-color-secondary);
|
||||
margin: 0 0 20px 0;
|
||||
margin: 0 0 16px 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.model-category-section {
|
||||
.builtin-models-hint {
|
||||
margin-top: 4px;
|
||||
padding: 10px 12px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.builtin-hint-label {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-placeholder);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.builtin-hint-text {
|
||||
margin: 0 0 6px 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.builtin-hint-link {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-secondary);
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: var(--td-brand-color);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.model-type-group {
|
||||
margin-bottom: 32px;
|
||||
padding-bottom: 32px;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
|
||||
&:last-child {
|
||||
&:last-of-type {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.category-header {
|
||||
.section-subheader {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
.header-info {
|
||||
.subheader-text {
|
||||
flex: 1;
|
||||
|
||||
h3 {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-primary);
|
||||
margin: 0 0 4px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-secondary);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加模型按钮样式优化
|
||||
:deep(.add-model-btn) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-weight: 500;
|
||||
height: 32px;
|
||||
padding: 0 16px;
|
||||
font-size: 14px;
|
||||
flex-shrink: 0;
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
margin: 0 0 4px 0;
|
||||
}
|
||||
|
||||
.add-icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
.section-desc {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-secondary);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
:deep(.t-button) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,29 +736,24 @@ onMounted(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 16px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 6px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
transition: all 0.15s ease;
|
||||
border-radius: 8px;
|
||||
background: var(--td-bg-color-container);
|
||||
transition: border-color 0.2s ease, background-color 0.2s ease;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-brand-color);
|
||||
background: var(--td-bg-color-container);
|
||||
box-shadow: 0 1px 4px rgba(7, 192, 95, 0.08);
|
||||
}
|
||||
|
||||
// 内置模型样式
|
||||
&.builtin-model {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
border-color: var(--td-component-border);
|
||||
border-color: var(--td-component-stroke);
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-component-stroke);
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
box-shadow: none;
|
||||
border-color: var(--td-brand-color-light);
|
||||
}
|
||||
|
||||
.model-info {
|
||||
@@ -655,7 +763,7 @@ onMounted(() => {
|
||||
|
||||
.model-meta {
|
||||
.source-tag {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
background: var(--td-bg-color-container);
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
}
|
||||
@@ -708,8 +816,6 @@ onMounted(() => {
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
position: relative;
|
||||
z-index: 1001;
|
||||
|
||||
@@ -724,125 +830,20 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.model-card:hover .model-actions {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 48px 0;
|
||||
.empty-models {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 32px;
|
||||
text-align: center;
|
||||
color: var(--td-text-color-placeholder);
|
||||
border: 1px dashed var(--td-component-stroke);
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
|
||||
.empty-text {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
margin: 0 0 16px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.builtin-models-info {
|
||||
margin-top: 16px;
|
||||
|
||||
.info-box {
|
||||
background: var(--td-success-color-light);
|
||||
border: 1px solid var(--td-success-color-focus);
|
||||
border-left: 3px solid var(--td-brand-color);
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.info-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.info-icon {
|
||||
font-size: 16px;
|
||||
color: var(--td-brand-color);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--td-brand-color-active);
|
||||
}
|
||||
}
|
||||
|
||||
.info-content {
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
color: var(--td-success-color);
|
||||
|
||||
p {
|
||||
margin: 0 0 6px 0;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&.doc-link {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
.link-icon {
|
||||
font-size: 13px;
|
||||
color: var(--td-brand-color);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--td-brand-color);
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: color 0.15s;
|
||||
|
||||
&:hover {
|
||||
color: var(--td-brand-color-active);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TDesign 组件样式覆盖
|
||||
:deep(.t-button) {
|
||||
&.add-model-btn {
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
transition: all 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--td-brand-color);
|
||||
border-color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: var(--td-brand-color-active);
|
||||
border-color: var(--td-brand-color-active);
|
||||
}
|
||||
}
|
||||
|
||||
&.t-size-s {
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
border-radius: 6px;
|
||||
|
||||
&.t-button--variant-outline {
|
||||
color: var(--td-text-color-secondary);
|
||||
border-color: var(--td-component-stroke);
|
||||
|
||||
&:hover {
|
||||
color: var(--td-brand-color);
|
||||
border-color: var(--td-brand-color);
|
||||
background: rgba(7, 192, 95, 0.04);
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ const navItems = computed(() => [
|
||||
{ key: 'cos', label: t('settings.storage.cos') },
|
||||
{ key: 'tos', label: t('settings.storage.tos') },
|
||||
{ key: 's3', label: 'AWS S3' },
|
||||
{ key: 'oss', label: t('settings.storage.oss') },
|
||||
]
|
||||
},
|
||||
{ key: 'mcp', icon: 'tools', label: t('settings.mcpService') },
|
||||
|
||||
@@ -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="$t('settings.storage.engineOss')" />
|
||||
</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>{{ $t('settings.storage.ossTitle') }}</h3>
|
||||
<t-tag theme="success" variant="light" size="small">{{ $t('settings.storage.configurable') }}</t-tag>
|
||||
</div>
|
||||
<p>
|
||||
{{ $t('settings.storage.ossDesc') }}
|
||||
<a class="engine-link" href="https://oss.console.aliyun.com/" target="_blank" rel="noopener">{{ $t('settings.storage.console') }} ↗</a>
|
||||
<a class="engine-link" href="https://help.aliyun.com/zh/oss/" target="_blank" rel="noopener">{{ $t('settings.storage.docs') }} ↗</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.ossAccessKeyPlaceholder')"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<label>Secret Key</label>
|
||||
<t-input
|
||||
v-model="config.oss.secret_key"
|
||||
type="password"
|
||||
:placeholder="$t('settings.storage.ossSecretKeyPlaceholder')"
|
||||
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,18 @@ 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(),
|
||||
// Temp bucket fields: not exposed in UI; server manages these independently
|
||||
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 +841,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>
|
||||
|
||||
@@ -872,7 +999,7 @@ onMounted(loadAll)
|
||||
label {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-secondary)555;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
&--inline {
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
{{ systemInfo?.version || $t('system.unknown') }}
|
||||
<t-tag
|
||||
v-if="systemInfo?.edition"
|
||||
theme="default"
|
||||
:theme="systemInfo.edition === 'lite' ? 'primary' : 'default'"
|
||||
variant="light"
|
||||
size="small"
|
||||
style="margin-left: 8px;"
|
||||
>{{ systemInfo.edition || 'Standard' }}</t-tag>
|
||||
>{{ systemInfo.edition === 'lite' ? 'Lite' : 'Standard' }}</t-tag>
|
||||
<span v-if="systemInfo?.commit_id" class="commit-info">
|
||||
({{ systemInfo.commit_id }})
|
||||
</span>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<t-option v-for="pt in providerTypes" :key="pt.id" :value="pt.id" :label="pt.name">
|
||||
<div class="provider-option">
|
||||
<span>{{ pt.name }}</span>
|
||||
<t-tag v-if="pt.free" theme="success" size="small" variant="light">{{ t('webSearchSettings.free') }}</t-tag>
|
||||
<t-tag v-if="isProviderFree(pt)" theme="success" size="small" variant="light">{{ t('webSearchSettings.free') }}</t-tag>
|
||||
</div>
|
||||
</t-option>
|
||||
</t-select>
|
||||
@@ -113,7 +113,7 @@
|
||||
<div class="dialog-footer">
|
||||
<div class="footer-left">
|
||||
<t-button
|
||||
v-if="selectedProviderType && !selectedProviderType.free"
|
||||
v-if="selectedProviderType && !isProviderFree(selectedProviderType)"
|
||||
theme="default"
|
||||
variant="outline"
|
||||
:loading="testing"
|
||||
@@ -179,6 +179,10 @@ const selectedProviderType = computed(() => {
|
||||
return providerTypes.value.find(pt => pt.id === providerForm.value.provider)
|
||||
})
|
||||
|
||||
const isProviderFree = (providerType: WebSearchProviderTypeInfo) => {
|
||||
return !providerType.requires_api_key && !providerType.requires_engine_id
|
||||
}
|
||||
|
||||
// ===== Methods =====
|
||||
const onProviderTypeChange = () => {
|
||||
providerForm.value.parameters = {}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function AutoCheckForUpdates():Promise<void>;
|
||||
|
||||
export function CheckForUpdates():Promise<void>;
|
||||
|
||||
export function GetAPIBaseURL():Promise<string>;
|
||||
|
||||
export function GetAPILanBaseURL():Promise<string>;
|
||||
|
||||
export function GetDesktopHTTPBindPublicSetting():Promise<boolean>;
|
||||
|
||||
export function GetDesktopHTTPPortSetting():Promise<number>;
|
||||
|
||||
export function GetDesktopListenPublicActive():Promise<boolean>;
|
||||
|
||||
export function SetDesktopHTTPBindPublicSetting(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetDesktopHTTPPortSetting(arg1:number):Promise<void>;
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function AutoCheckForUpdates() {
|
||||
return window['go']['main']['App']['AutoCheckForUpdates']();
|
||||
}
|
||||
|
||||
export function CheckForUpdates() {
|
||||
return window['go']['main']['App']['CheckForUpdates']();
|
||||
}
|
||||
|
||||
export function GetAPIBaseURL() {
|
||||
return window['go']['main']['App']['GetAPIBaseURL']();
|
||||
}
|
||||
|
||||
export function GetAPILanBaseURL() {
|
||||
return window['go']['main']['App']['GetAPILanBaseURL']();
|
||||
}
|
||||
|
||||
export function GetDesktopHTTPBindPublicSetting() {
|
||||
return window['go']['main']['App']['GetDesktopHTTPBindPublicSetting']();
|
||||
}
|
||||
|
||||
export function GetDesktopHTTPPortSetting() {
|
||||
return window['go']['main']['App']['GetDesktopHTTPPortSetting']();
|
||||
}
|
||||
|
||||
export function GetDesktopListenPublicActive() {
|
||||
return window['go']['main']['App']['GetDesktopListenPublicActive']();
|
||||
}
|
||||
|
||||
export function SetDesktopHTTPBindPublicSetting(arg1) {
|
||||
return window['go']['main']['App']['SetDesktopHTTPBindPublicSetting'](arg1);
|
||||
}
|
||||
|
||||
export function SetDesktopHTTPPortSetting(arg1) {
|
||||
return window['go']['main']['App']['SetDesktopHTTPPortSetting'](arg1);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@wailsapp/runtime",
|
||||
"version": "2.0.0",
|
||||
"description": "Wails Javascript runtime library",
|
||||
"main": "runtime.js",
|
||||
"types": "runtime.d.ts",
|
||||
"scripts": {
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wailsapp/wails.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Wails",
|
||||
"Javascript",
|
||||
"Go"
|
||||
],
|
||||
"author": "Lea Anthony <lea.anthony@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/wailsapp/wails/issues"
|
||||
},
|
||||
"homepage": "https://github.com/wailsapp/wails#readme"
|
||||
}
|
||||
+330
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The electron alternative for Go
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
|
||||
export interface Position {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Size {
|
||||
w: number;
|
||||
h: number;
|
||||
}
|
||||
|
||||
export interface Screen {
|
||||
isCurrent: boolean;
|
||||
isPrimary: boolean;
|
||||
width : number
|
||||
height : number
|
||||
}
|
||||
|
||||
// Environment information such as platform, buildtype, ...
|
||||
export interface EnvironmentInfo {
|
||||
buildType: string;
|
||||
platform: string;
|
||||
arch: string;
|
||||
}
|
||||
|
||||
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
|
||||
// emits the given event. Optional data may be passed with the event.
|
||||
// This will trigger any event listeners.
|
||||
export function EventsEmit(eventName: string, ...data: any): void;
|
||||
|
||||
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
|
||||
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
|
||||
|
||||
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
|
||||
// sets up a listener for the given event name, but will only trigger a given number times.
|
||||
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
|
||||
|
||||
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
|
||||
// sets up a listener for the given event name, but will only trigger once.
|
||||
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
|
||||
|
||||
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
|
||||
// unregisters the listener for the given event name.
|
||||
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
|
||||
|
||||
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
|
||||
// unregisters all listeners.
|
||||
export function EventsOffAll(): void;
|
||||
|
||||
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
|
||||
// logs the given message as a raw message
|
||||
export function LogPrint(message: string): void;
|
||||
|
||||
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
|
||||
// logs the given message at the `trace` log level.
|
||||
export function LogTrace(message: string): void;
|
||||
|
||||
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
|
||||
// logs the given message at the `debug` log level.
|
||||
export function LogDebug(message: string): void;
|
||||
|
||||
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
|
||||
// logs the given message at the `error` log level.
|
||||
export function LogError(message: string): void;
|
||||
|
||||
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
|
||||
// logs the given message at the `fatal` log level.
|
||||
// The application will quit after calling this method.
|
||||
export function LogFatal(message: string): void;
|
||||
|
||||
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
|
||||
// logs the given message at the `info` log level.
|
||||
export function LogInfo(message: string): void;
|
||||
|
||||
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
|
||||
// logs the given message at the `warning` log level.
|
||||
export function LogWarning(message: string): void;
|
||||
|
||||
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
|
||||
// Forces a reload by the main application as well as connected browsers.
|
||||
export function WindowReload(): void;
|
||||
|
||||
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
|
||||
// Reloads the application frontend.
|
||||
export function WindowReloadApp(): void;
|
||||
|
||||
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
|
||||
// Sets the window AlwaysOnTop or not on top.
|
||||
export function WindowSetAlwaysOnTop(b: boolean): void;
|
||||
|
||||
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
|
||||
// *Windows only*
|
||||
// Sets window theme to system default (dark/light).
|
||||
export function WindowSetSystemDefaultTheme(): void;
|
||||
|
||||
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
|
||||
// *Windows only*
|
||||
// Sets window to light theme.
|
||||
export function WindowSetLightTheme(): void;
|
||||
|
||||
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
|
||||
// *Windows only*
|
||||
// Sets window to dark theme.
|
||||
export function WindowSetDarkTheme(): void;
|
||||
|
||||
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
|
||||
// Centers the window on the monitor the window is currently on.
|
||||
export function WindowCenter(): void;
|
||||
|
||||
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
|
||||
// Sets the text in the window title bar.
|
||||
export function WindowSetTitle(title: string): void;
|
||||
|
||||
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
|
||||
// Makes the window full screen.
|
||||
export function WindowFullscreen(): void;
|
||||
|
||||
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
|
||||
// Restores the previous window dimensions and position prior to full screen.
|
||||
export function WindowUnfullscreen(): void;
|
||||
|
||||
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
|
||||
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
||||
export function WindowIsFullscreen(): Promise<boolean>;
|
||||
|
||||
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
|
||||
// Sets the width and height of the window.
|
||||
export function WindowSetSize(width: number, height: number): void;
|
||||
|
||||
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
|
||||
// Gets the width and height of the window.
|
||||
export function WindowGetSize(): Promise<Size>;
|
||||
|
||||
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
|
||||
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
|
||||
// Setting a size of 0,0 will disable this constraint.
|
||||
export function WindowSetMaxSize(width: number, height: number): void;
|
||||
|
||||
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
|
||||
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
|
||||
// Setting a size of 0,0 will disable this constraint.
|
||||
export function WindowSetMinSize(width: number, height: number): void;
|
||||
|
||||
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
|
||||
// Sets the window position relative to the monitor the window is currently on.
|
||||
export function WindowSetPosition(x: number, y: number): void;
|
||||
|
||||
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
|
||||
// Gets the window position relative to the monitor the window is currently on.
|
||||
export function WindowGetPosition(): Promise<Position>;
|
||||
|
||||
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
|
||||
// Hides the window.
|
||||
export function WindowHide(): void;
|
||||
|
||||
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
|
||||
// Shows the window, if it is currently hidden.
|
||||
export function WindowShow(): void;
|
||||
|
||||
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
|
||||
// Maximises the window to fill the screen.
|
||||
export function WindowMaximise(): void;
|
||||
|
||||
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
|
||||
// Toggles between Maximised and UnMaximised.
|
||||
export function WindowToggleMaximise(): void;
|
||||
|
||||
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
|
||||
// Restores the window to the dimensions and position prior to maximising.
|
||||
export function WindowUnmaximise(): void;
|
||||
|
||||
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
|
||||
// Returns the state of the window, i.e. whether the window is maximised or not.
|
||||
export function WindowIsMaximised(): Promise<boolean>;
|
||||
|
||||
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
|
||||
// Minimises the window.
|
||||
export function WindowMinimise(): void;
|
||||
|
||||
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
|
||||
// Restores the window to the dimensions and position prior to minimising.
|
||||
export function WindowUnminimise(): void;
|
||||
|
||||
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
|
||||
// Returns the state of the window, i.e. whether the window is minimised or not.
|
||||
export function WindowIsMinimised(): Promise<boolean>;
|
||||
|
||||
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
|
||||
// Returns the state of the window, i.e. whether the window is normal or not.
|
||||
export function WindowIsNormal(): Promise<boolean>;
|
||||
|
||||
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
|
||||
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
|
||||
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
|
||||
|
||||
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
|
||||
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
|
||||
export function ScreenGetAll(): Promise<Screen[]>;
|
||||
|
||||
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
|
||||
// Opens the given URL in the system browser.
|
||||
export function BrowserOpenURL(url: string): void;
|
||||
|
||||
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
|
||||
// Returns information about the environment
|
||||
export function Environment(): Promise<EnvironmentInfo>;
|
||||
|
||||
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
|
||||
// Quits the application.
|
||||
export function Quit(): void;
|
||||
|
||||
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
|
||||
// Hides the application.
|
||||
export function Hide(): void;
|
||||
|
||||
// [Show](https://wails.io/docs/reference/runtime/intro#show)
|
||||
// Shows the application.
|
||||
export function Show(): void;
|
||||
|
||||
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
|
||||
// Returns the current text stored on clipboard
|
||||
export function ClipboardGetText(): Promise<string>;
|
||||
|
||||
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
||||
// Sets a text on the clipboard
|
||||
export function ClipboardSetText(text: string): Promise<boolean>;
|
||||
|
||||
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
|
||||
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
|
||||
|
||||
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
|
||||
// OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
export function OnFileDropOff() :void
|
||||
|
||||
// Check if the file path resolver is available
|
||||
export function CanResolveFilePaths(): boolean;
|
||||
|
||||
// Resolves file paths for an array of files
|
||||
export function ResolveFilePaths(files: File[]): void
|
||||
|
||||
// Notification types
|
||||
export interface NotificationOptions {
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle?: string; // macOS and Linux only
|
||||
body?: string;
|
||||
categoryId?: string;
|
||||
data?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface NotificationAction {
|
||||
id?: string;
|
||||
title?: string;
|
||||
destructive?: boolean; // macOS-specific
|
||||
}
|
||||
|
||||
export interface NotificationCategory {
|
||||
id?: string;
|
||||
actions?: NotificationAction[];
|
||||
hasReplyField?: boolean;
|
||||
replyPlaceholder?: string;
|
||||
replyButtonTitle?: string;
|
||||
}
|
||||
|
||||
// [InitializeNotifications](https://wails.io/docs/reference/runtime/notification#initializenotifications)
|
||||
// Initializes the notification service for the application.
|
||||
// This must be called before sending any notifications.
|
||||
export function InitializeNotifications(): Promise<void>;
|
||||
|
||||
// [CleanupNotifications](https://wails.io/docs/reference/runtime/notification#cleanupnotifications)
|
||||
// Cleans up notification resources and releases any held connections.
|
||||
export function CleanupNotifications(): Promise<void>;
|
||||
|
||||
// [IsNotificationAvailable](https://wails.io/docs/reference/runtime/notification#isnotificationavailable)
|
||||
// Checks if notifications are available on the current platform.
|
||||
export function IsNotificationAvailable(): Promise<boolean>;
|
||||
|
||||
// [RequestNotificationAuthorization](https://wails.io/docs/reference/runtime/notification#requestnotificationauthorization)
|
||||
// Requests notification authorization from the user (macOS only).
|
||||
export function RequestNotificationAuthorization(): Promise<boolean>;
|
||||
|
||||
// [CheckNotificationAuthorization](https://wails.io/docs/reference/runtime/notification#checknotificationauthorization)
|
||||
// Checks the current notification authorization status (macOS only).
|
||||
export function CheckNotificationAuthorization(): Promise<boolean>;
|
||||
|
||||
// [SendNotification](https://wails.io/docs/reference/runtime/notification#sendnotification)
|
||||
// Sends a basic notification with the given options.
|
||||
export function SendNotification(options: NotificationOptions): Promise<void>;
|
||||
|
||||
// [SendNotificationWithActions](https://wails.io/docs/reference/runtime/notification#sendnotificationwithactions)
|
||||
// Sends a notification with action buttons. Requires a registered category.
|
||||
export function SendNotificationWithActions(options: NotificationOptions): Promise<void>;
|
||||
|
||||
// [RegisterNotificationCategory](https://wails.io/docs/reference/runtime/notification#registernotificationcategory)
|
||||
// Registers a notification category that can be used with SendNotificationWithActions.
|
||||
export function RegisterNotificationCategory(category: NotificationCategory): Promise<void>;
|
||||
|
||||
// [RemoveNotificationCategory](https://wails.io/docs/reference/runtime/notification#removenotificationcategory)
|
||||
// Removes a previously registered notification category.
|
||||
export function RemoveNotificationCategory(categoryId: string): Promise<void>;
|
||||
|
||||
// [RemoveAllPendingNotifications](https://wails.io/docs/reference/runtime/notification#removeallpendingnotifications)
|
||||
// Removes all pending notifications from the notification center.
|
||||
export function RemoveAllPendingNotifications(): Promise<void>;
|
||||
|
||||
// [RemovePendingNotification](https://wails.io/docs/reference/runtime/notification#removependingnotification)
|
||||
// Removes a specific pending notification by its identifier.
|
||||
export function RemovePendingNotification(identifier: string): Promise<void>;
|
||||
|
||||
// [RemoveAllDeliveredNotifications](https://wails.io/docs/reference/runtime/notification#removealldeliverednotifications)
|
||||
// Removes all delivered notifications from the notification center.
|
||||
export function RemoveAllDeliveredNotifications(): Promise<void>;
|
||||
|
||||
// [RemoveDeliveredNotification](https://wails.io/docs/reference/runtime/notification#removedeliverednotification)
|
||||
// Removes a specific delivered notification by its identifier.
|
||||
export function RemoveDeliveredNotification(identifier: string): Promise<void>;
|
||||
|
||||
// [RemoveNotification](https://wails.io/docs/reference/runtime/notification#removenotification)
|
||||
// Removes a notification by its identifier (cross-platform convenience function).
|
||||
export function RemoveNotification(identifier: string): Promise<void>;
|
||||
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The electron alternative for Go
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
|
||||
export function LogPrint(message) {
|
||||
window.runtime.LogPrint(message);
|
||||
}
|
||||
|
||||
export function LogTrace(message) {
|
||||
window.runtime.LogTrace(message);
|
||||
}
|
||||
|
||||
export function LogDebug(message) {
|
||||
window.runtime.LogDebug(message);
|
||||
}
|
||||
|
||||
export function LogInfo(message) {
|
||||
window.runtime.LogInfo(message);
|
||||
}
|
||||
|
||||
export function LogWarning(message) {
|
||||
window.runtime.LogWarning(message);
|
||||
}
|
||||
|
||||
export function LogError(message) {
|
||||
window.runtime.LogError(message);
|
||||
}
|
||||
|
||||
export function LogFatal(message) {
|
||||
window.runtime.LogFatal(message);
|
||||
}
|
||||
|
||||
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
|
||||
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
|
||||
}
|
||||
|
||||
export function EventsOn(eventName, callback) {
|
||||
return EventsOnMultiple(eventName, callback, -1);
|
||||
}
|
||||
|
||||
export function EventsOff(eventName, ...additionalEventNames) {
|
||||
return window.runtime.EventsOff(eventName, ...additionalEventNames);
|
||||
}
|
||||
|
||||
export function EventsOffAll() {
|
||||
return window.runtime.EventsOffAll();
|
||||
}
|
||||
|
||||
export function EventsOnce(eventName, callback) {
|
||||
return EventsOnMultiple(eventName, callback, 1);
|
||||
}
|
||||
|
||||
export function EventsEmit(eventName) {
|
||||
let args = [eventName].slice.call(arguments);
|
||||
return window.runtime.EventsEmit.apply(null, args);
|
||||
}
|
||||
|
||||
export function WindowReload() {
|
||||
window.runtime.WindowReload();
|
||||
}
|
||||
|
||||
export function WindowReloadApp() {
|
||||
window.runtime.WindowReloadApp();
|
||||
}
|
||||
|
||||
export function WindowSetAlwaysOnTop(b) {
|
||||
window.runtime.WindowSetAlwaysOnTop(b);
|
||||
}
|
||||
|
||||
export function WindowSetSystemDefaultTheme() {
|
||||
window.runtime.WindowSetSystemDefaultTheme();
|
||||
}
|
||||
|
||||
export function WindowSetLightTheme() {
|
||||
window.runtime.WindowSetLightTheme();
|
||||
}
|
||||
|
||||
export function WindowSetDarkTheme() {
|
||||
window.runtime.WindowSetDarkTheme();
|
||||
}
|
||||
|
||||
export function WindowCenter() {
|
||||
window.runtime.WindowCenter();
|
||||
}
|
||||
|
||||
export function WindowSetTitle(title) {
|
||||
window.runtime.WindowSetTitle(title);
|
||||
}
|
||||
|
||||
export function WindowFullscreen() {
|
||||
window.runtime.WindowFullscreen();
|
||||
}
|
||||
|
||||
export function WindowUnfullscreen() {
|
||||
window.runtime.WindowUnfullscreen();
|
||||
}
|
||||
|
||||
export function WindowIsFullscreen() {
|
||||
return window.runtime.WindowIsFullscreen();
|
||||
}
|
||||
|
||||
export function WindowGetSize() {
|
||||
return window.runtime.WindowGetSize();
|
||||
}
|
||||
|
||||
export function WindowSetSize(width, height) {
|
||||
window.runtime.WindowSetSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetMaxSize(width, height) {
|
||||
window.runtime.WindowSetMaxSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetMinSize(width, height) {
|
||||
window.runtime.WindowSetMinSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetPosition(x, y) {
|
||||
window.runtime.WindowSetPosition(x, y);
|
||||
}
|
||||
|
||||
export function WindowGetPosition() {
|
||||
return window.runtime.WindowGetPosition();
|
||||
}
|
||||
|
||||
export function WindowHide() {
|
||||
window.runtime.WindowHide();
|
||||
}
|
||||
|
||||
export function WindowShow() {
|
||||
window.runtime.WindowShow();
|
||||
}
|
||||
|
||||
export function WindowMaximise() {
|
||||
window.runtime.WindowMaximise();
|
||||
}
|
||||
|
||||
export function WindowToggleMaximise() {
|
||||
window.runtime.WindowToggleMaximise();
|
||||
}
|
||||
|
||||
export function WindowUnmaximise() {
|
||||
window.runtime.WindowUnmaximise();
|
||||
}
|
||||
|
||||
export function WindowIsMaximised() {
|
||||
return window.runtime.WindowIsMaximised();
|
||||
}
|
||||
|
||||
export function WindowMinimise() {
|
||||
window.runtime.WindowMinimise();
|
||||
}
|
||||
|
||||
export function WindowUnminimise() {
|
||||
window.runtime.WindowUnminimise();
|
||||
}
|
||||
|
||||
export function WindowSetBackgroundColour(R, G, B, A) {
|
||||
window.runtime.WindowSetBackgroundColour(R, G, B, A);
|
||||
}
|
||||
|
||||
export function ScreenGetAll() {
|
||||
return window.runtime.ScreenGetAll();
|
||||
}
|
||||
|
||||
export function WindowIsMinimised() {
|
||||
return window.runtime.WindowIsMinimised();
|
||||
}
|
||||
|
||||
export function WindowIsNormal() {
|
||||
return window.runtime.WindowIsNormal();
|
||||
}
|
||||
|
||||
export function BrowserOpenURL(url) {
|
||||
window.runtime.BrowserOpenURL(url);
|
||||
}
|
||||
|
||||
export function Environment() {
|
||||
return window.runtime.Environment();
|
||||
}
|
||||
|
||||
export function Quit() {
|
||||
window.runtime.Quit();
|
||||
}
|
||||
|
||||
export function Hide() {
|
||||
window.runtime.Hide();
|
||||
}
|
||||
|
||||
export function Show() {
|
||||
window.runtime.Show();
|
||||
}
|
||||
|
||||
export function ClipboardGetText() {
|
||||
return window.runtime.ClipboardGetText();
|
||||
}
|
||||
|
||||
export function ClipboardSetText(text) {
|
||||
return window.runtime.ClipboardSetText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
*
|
||||
* @export
|
||||
* @callback OnFileDropCallback
|
||||
* @param {number} x - x coordinate of the drop
|
||||
* @param {number} y - y coordinate of the drop
|
||||
* @param {string[]} paths - A list of file paths.
|
||||
*/
|
||||
|
||||
/**
|
||||
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||
*
|
||||
* @export
|
||||
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
|
||||
*/
|
||||
export function OnFileDrop(callback, useDropTarget) {
|
||||
return window.runtime.OnFileDrop(callback, useDropTarget);
|
||||
}
|
||||
|
||||
/**
|
||||
* OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
*/
|
||||
export function OnFileDropOff() {
|
||||
return window.runtime.OnFileDropOff();
|
||||
}
|
||||
|
||||
export function CanResolveFilePaths() {
|
||||
return window.runtime.CanResolveFilePaths();
|
||||
}
|
||||
|
||||
export function ResolveFilePaths(files) {
|
||||
return window.runtime.ResolveFilePaths(files);
|
||||
}
|
||||
|
||||
export function InitializeNotifications() {
|
||||
return window.runtime.InitializeNotifications();
|
||||
}
|
||||
|
||||
export function CleanupNotifications() {
|
||||
return window.runtime.CleanupNotifications();
|
||||
}
|
||||
|
||||
export function IsNotificationAvailable() {
|
||||
return window.runtime.IsNotificationAvailable();
|
||||
}
|
||||
|
||||
export function RequestNotificationAuthorization() {
|
||||
return window.runtime.RequestNotificationAuthorization();
|
||||
}
|
||||
|
||||
export function CheckNotificationAuthorization() {
|
||||
return window.runtime.CheckNotificationAuthorization();
|
||||
}
|
||||
|
||||
export function SendNotification(options) {
|
||||
return window.runtime.SendNotification(options);
|
||||
}
|
||||
|
||||
export function SendNotificationWithActions(options) {
|
||||
return window.runtime.SendNotificationWithActions(options);
|
||||
}
|
||||
|
||||
export function RegisterNotificationCategory(category) {
|
||||
return window.runtime.RegisterNotificationCategory(category);
|
||||
}
|
||||
|
||||
export function RemoveNotificationCategory(categoryId) {
|
||||
return window.runtime.RemoveNotificationCategory(categoryId);
|
||||
}
|
||||
|
||||
export function RemoveAllPendingNotifications() {
|
||||
return window.runtime.RemoveAllPendingNotifications();
|
||||
}
|
||||
|
||||
export function RemovePendingNotification(identifier) {
|
||||
return window.runtime.RemovePendingNotification(identifier);
|
||||
}
|
||||
|
||||
export function RemoveAllDeliveredNotifications() {
|
||||
return window.runtime.RemoveAllDeliveredNotifications();
|
||||
}
|
||||
|
||||
export function RemoveDeliveredNotification(identifier) {
|
||||
return window.runtime.RemoveDeliveredNotification(identifier);
|
||||
}
|
||||
|
||||
export function RemoveNotification(identifier) {
|
||||
return window.runtime.RemoveNotification(identifier);
|
||||
}
|
||||
Reference in New Issue
Block a user