Merge upstream main and resolve conflicts

This commit is contained in:
Mao Meng
2026-04-14 14:13:00 +08:00
185 changed files with 13886 additions and 1507 deletions
+27 -2
View File
@@ -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 });
}
+15
View File
@@ -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'
}
}
}
/**
* 获取当前用户信息
*/
+4 -3
View File
@@ -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');
+1
View File
@@ -255,6 +255,7 @@ export function checkRemoteModel(modelConfig: {
modelName: string;
baseUrl: string;
apiKey?: string;
provider?: string;
}): Promise<{
available: boolean;
message?: string;
+42
View File
@@ -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 })
})
})
}
+14 -2
View File
@@ -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 {
+1 -1
View File
@@ -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