refactor(android):首页客户端下载 UI优化
parent
4fc46bcfb8
commit
28940732b6
|
|
@ -312,25 +312,27 @@
|
|||
- `uk_asr_model_default_enabled_tenant`锛歚(tenant_id) WHERE is_deleted = 0 AND status = 1 AND is_default = 1`
|
||||
|
||||
### 5.6 `biz_llm_models`锛圠LM 妯″瀷閰嶇疆琛級
|
||||
| 瀛楁 | 绫诲瀷 | 绾︽潫 | 璇存槑 |
|
||||
| --- | --- | --- | --- |
|
||||
| id | BIGSERIAL | PK | 涓婚敭ID |
|
||||
| tenant_id | BIGINT | NOT NULL, DEFAULT 0 | 绉熸埛ID |
|
||||
| model_name | VARCHAR(100) | NOT NULL | 妯″瀷鏄剧ず鍚嶇О |
|
||||
| provider | VARCHAR(50) | | 鎻愪緵鍟?|
|
||||
| base_url | VARCHAR(255) | | 鎺ュ彛鍩虹鍦板潃 |
|
||||
| api_path | VARCHAR(100) | | API 璺緞 |
|
||||
| api_key | VARCHAR(255) | | API 瀵嗛挜 |
|
||||
| model_code | VARCHAR(100) | | 妯″瀷浠g爜 |
|
||||
| temperature | DECIMAL(3,2) | DEFAULT 0.7 | 娓╁害鍙傛暟 |
|
||||
| top_p | DECIMAL(3,2) | DEFAULT 0.9 | Top P 鍙傛暟 |
|
||||
| is_default | SMALLINT | DEFAULT 0 | 榛樿妯″瀷鏍囪 |
|
||||
| sort_order | INTEGER | NOT NULL, DEFAULT 0 | 鎺掑簭鍊硷紝瓒婂皬瓒婇潬鍓?|
|
||||
| status | SMALLINT | DEFAULT 1 | 鐘舵€?|
|
||||
| remark | VARCHAR(255) | | 澶囨敞 |
|
||||
| created_at | TIMESTAMP(6) | NOT NULL, DEFAULT now() | 鍒涘缓鏃堕棿 |
|
||||
| updated_at | TIMESTAMP(6) | NOT NULL, DEFAULT now() | 鏇存柊鏃堕棿 |
|
||||
| is_deleted | SMALLINT | NOT NULL, DEFAULT 0 | 閫昏緫鍒犻櫎 |
|
||||
| 瀛楁 | 绫诲瀷 | 绾︽潫 | 璇存槑 |
|
||||
|------------------|--------------|-------------------------|--------------------------------------|
|
||||
| id | BIGSERIAL | PK | 涓婚敭ID |
|
||||
| tenant_id | BIGINT | NOT NULL, DEFAULT 0 | 绉熸埛ID |
|
||||
| model_name | VARCHAR(100) | NOT NULL | 妯″瀷鏄剧ず鍚嶇О |
|
||||
| provider | VARCHAR(50) | | 鎻愪緵鍟? |
|
||||
| base_url | VARCHAR(255) | | 鎺ュ彛鍩虹鍦板潃 |
|
||||
| api_path | VARCHAR(100) | | API 璺緞 |
|
||||
| api_key | VARCHAR(255) | | API 瀵嗛挜 |
|
||||
| model_code | VARCHAR(100) | | 妯″瀷浠g爜 |
|
||||
| temperature | DECIMAL(3,2) | DEFAULT 0.7 | 娓╁害鍙傛暟 |
|
||||
| top_p | DECIMAL(3,2) | DEFAULT 0.9 | Top P 鍙傛暟 |
|
||||
| reasoning_effort | VARCHAR(32) | | 推理强度: minimal/low/medium/high,空表示不下发 |
|
||||
| thinking_mode | VARCHAR(16) | DEFAULT 'auto' | 思考模式: auto/enabled/disabled |
|
||||
| is_default | SMALLINT | DEFAULT 0 | 榛樿妯″瀷鏍囪 |
|
||||
| sort_order | INTEGER | NOT NULL, DEFAULT 0 | 鎺掑簭鍊硷紝瓒婂皬瓒婇潬鍓? |
|
||||
| status | SMALLINT | DEFAULT 1 | 鐘舵€? |
|
||||
| remark | VARCHAR(255) | | 澶囨敞 |
|
||||
| created_at | TIMESTAMP(6) | NOT NULL, DEFAULT now() | 鍒涘缓鏃堕棿 |
|
||||
| updated_at | TIMESTAMP(6) | NOT NULL, DEFAULT now() | 鏇存柊鏃堕棿 |
|
||||
| is_deleted | SMALLINT | NOT NULL, DEFAULT 0 | 閫昏緫鍒犻櫎 |
|
||||
|
||||
绱㈠紩锛?- `idx_llm_model_tenant`锛歚(tenant_id)`
|
||||
- `idx_llm_model_default`锛歚(is_default) WHERE is_deleted = 0`
|
||||
|
|
|
|||
|
|
@ -413,6 +413,8 @@ CREATE TABLE biz_llm_models (
|
|||
temperature DECIMAL(3,2) DEFAULT 0.7,
|
||||
top_p DECIMAL(3,2) DEFAULT 0.9,
|
||||
max_tokens BIGINT NOT NULL DEFAULT 30000,
|
||||
reasoning_effort VARCHAR(32),
|
||||
thinking_mode VARCHAR(16) DEFAULT 'auto',
|
||||
is_default SMALLINT DEFAULT 0,
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
status SMALLINT DEFAULT 1,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.imeeting.controller.android;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.imeeting.service.android.AndroidDeviceBindingService;
|
||||
import com.imeeting.service.android.AndroidDeviceRegistrationService;
|
||||
import com.imeeting.support.AndroidRequestLogHelper;
|
||||
import com.unisbase.auth.JwtTokenProvider;
|
||||
import com.unisbase.common.ApiResponse;
|
||||
import com.unisbase.common.exception.BusinessException;
|
||||
import com.unisbase.common.exception.UnAuthException;
|
||||
import com.unisbase.dto.LoginRequest;
|
||||
import com.unisbase.dto.RefreshRequest;
|
||||
|
|
@ -50,14 +52,16 @@ public class AndroidAuthController {
|
|||
public ApiResponse<TokenResponse> login(@Valid @RequestBody LoginRequest request,
|
||||
@RequestHeader(value = "X-Android-Device-Id", required = false) String deviceId,
|
||||
@RequestHeader(value = "X-Android-App-Version", required = false) String appVersion,
|
||||
@RequestHeader(value = "X-Android-Platform", required = false) String platform) {
|
||||
@RequestHeader(value = "X-Android-Platform", required = false) String platform,
|
||||
@RequestHeader(value = "X-Android-Tenant-Code", required = false) String tenantCode
|
||||
) {
|
||||
AndroidRequestLogHelper.logRequest(log, "Android认证", "登录接口",
|
||||
"request", request,
|
||||
"deviceId", deviceId,
|
||||
"appVersion", appVersion,
|
||||
"platform", platform);
|
||||
if (!StringUtils.hasText(deviceId)) {
|
||||
throw new IllegalArgumentException("X-Android-Device-Id不能为空");
|
||||
throw new BusinessException("X-Android-Device-Id不能为空");
|
||||
}
|
||||
androidDeviceRegistrationService.requireRegistered(deviceId.trim());
|
||||
TokenResponse response = authService.login(request, true);
|
||||
|
|
@ -67,6 +71,12 @@ public class AndroidAuthController {
|
|||
response.getCurrentTenantId(),
|
||||
response.getUser().getUserId()
|
||||
);
|
||||
if (tenantCode != null) {
|
||||
boolean b = response.getAvailableTenants().stream().anyMatch(tenant -> tenant.getTenantCode().equals(tenantCode));
|
||||
if (!b) {
|
||||
throw new BusinessException(StrUtil.format("当前登录人不属于[{}]租户", tenantCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ApiResponse.ok(response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.imeeting.controller.biz;
|
||||
|
||||
import com.imeeting.dto.biz.ClientDownloadDTO;
|
||||
import com.imeeting.dto.biz.ClientDownloadLatestVO;
|
||||
import com.imeeting.entity.biz.ClientDownload;
|
||||
import com.imeeting.service.biz.ClientDownloadService;
|
||||
import com.unisbase.annotation.Anonymous;
|
||||
import com.unisbase.common.ApiResponse;
|
||||
import com.unisbase.common.annotation.Log;
|
||||
import com.unisbase.security.LoginUser;
|
||||
|
|
@ -51,6 +53,13 @@ public class ClientDownloadController {
|
|||
return ApiResponse.ok(data);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询各平台最新客户端安装包,登录页免登录下载")
|
||||
@GetMapping("/public/latest")
|
||||
@Anonymous
|
||||
public ApiResponse<List<ClientDownloadLatestVO>> latestByPlatform(@RequestParam(value = "platformCode", required = false) String platformCode) {
|
||||
return ApiResponse.ok(clientDownloadService.listLatestForDownload(platformCode));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增客户端下载包")
|
||||
@PostMapping
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@ public class AiModelDTO {
|
|||
@JsonProperty("max_tokens")
|
||||
@Schema(description = "最大输出 token 数")
|
||||
private Long maxTokens;
|
||||
|
||||
@Schema(description = "推理强度: minimal/low/medium/high,空表示不下发")
|
||||
private String reasoningEffort;
|
||||
|
||||
@Schema(description = "思考模式: auto/enabled/disabled,auto 表示跟随模型默认")
|
||||
private String thinkingMode;
|
||||
|
||||
@Schema(description = "媒体配置")
|
||||
private Map<String, Object> mediaConfig;
|
||||
@Schema(description = "是否默认")
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ public class AiModelVO {
|
|||
@JsonProperty("max_tokens")
|
||||
@Schema(description = "最大输出 token 数")
|
||||
private Long maxTokens;
|
||||
@Schema(description = "推理强度: minimal/low/medium/high,空表示不下发")
|
||||
private String reasoningEffort;
|
||||
@Schema(description = "思考模式: auto/enabled/disabled,auto 表示跟随模型默认")
|
||||
private String thinkingMode;
|
||||
@Schema(description = "多媒体配置")
|
||||
private Map<String, Object> mediaConfig;
|
||||
@Schema(description = "是否为默认模型")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.imeeting.dto.biz;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "登录页客户端下载项,平台列表以数据字典为准")
|
||||
@Data
|
||||
public class ClientDownloadLatestVO {
|
||||
@Schema(description = "平台编码,取自数据字典 client_platform 下级字典项值")
|
||||
private String platformCode;
|
||||
@Schema(description = "平台名称,取自数据字典字典项标签")
|
||||
private String platformName;
|
||||
@Schema(description = "平台类型,固定为桌面端 DESKTOP")
|
||||
private String platformType;
|
||||
@Schema(description = "最新版本号,无安装包时为空")
|
||||
private String version;
|
||||
@Schema(description = "最新版本编码,无安装包时为空")
|
||||
private Long versionCode;
|
||||
@Schema(description = "下载地址,无安装包时为空")
|
||||
private String downloadUrl;
|
||||
@Schema(description = "安装包大小,单位字节,无安装包时为空")
|
||||
private Long fileSize;
|
||||
@Schema(description = "是否存在可下载安装包,false 时前端提示暂无安装包")
|
||||
private Boolean hasPackage;
|
||||
}
|
||||
|
|
@ -48,6 +48,12 @@ public class LlmModel extends BaseEntity {
|
|||
@Schema(description = "最大输出 token 数")
|
||||
private Long maxTokens;
|
||||
|
||||
@Schema(description = "推理强度: minimal/low/medium/high,空表示不下发")
|
||||
private String reasoningEffort;
|
||||
|
||||
@Schema(description = "思考模式: auto/enabled/disabled,auto 表示跟随模型默认")
|
||||
private String thinkingMode;
|
||||
|
||||
@Schema(description = "是否默认模型")
|
||||
private Integer isDefault;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.imeeting.event;
|
||||
|
||||
/**
|
||||
* 实时会议发布端激活事件。
|
||||
*
|
||||
* <p>实时会话状态服务在发布端连接激活时发布本事件,推送订阅等下游能力通过监听事件接入,
|
||||
* 会话状态服务不再直接依赖推送订阅管理器,避免 Spring Bean 循环依赖。
|
||||
*/
|
||||
public record RealtimeMeetingSessionActivatedEvent(Long meetingId) {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.imeeting.event;
|
||||
|
||||
/**
|
||||
* 实时会话结束事件。
|
||||
*
|
||||
* <p>实时会话状态服务清理会话状态时发布本事件,推送订阅等下游能力通过监听事件回收资源,
|
||||
* 会话状态服务不再直接依赖推送订阅管理器,避免 Spring Bean 循环依赖。
|
||||
*/
|
||||
public record RealtimeMeetingSessionClosedEvent(Long meetingId) {
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.imeeting.listener;
|
||||
|
||||
import com.imeeting.event.RealtimeMeetingSessionActivatedEvent;
|
||||
import com.imeeting.event.RealtimeMeetingSessionClosedEvent;
|
||||
import com.imeeting.service.realtime.RealtimeMeetingPushSubscriptionManager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 实时会议推送订阅生命周期监听器。
|
||||
*
|
||||
* <p>把实时会话状态事件翻译成推送订阅的挂载与回收。Spring 事件默认同步执行,
|
||||
* 时序与原先会话状态服务直接调用推送订阅管理器一致;异常只记录日志,不阻断会议状态流转。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RealtimeMeetingPushSubscriptionListener {
|
||||
|
||||
private final RealtimeMeetingPushSubscriptionManager realtimeMeetingPushSubscriptionManager;
|
||||
|
||||
/**
|
||||
* 发布端激活会话后,把该会议参会人当前在线的推送长连接挂载为订阅者。
|
||||
*/
|
||||
@EventListener
|
||||
public void onSessionActivated(RealtimeMeetingSessionActivatedEvent event) {
|
||||
try {
|
||||
realtimeMeetingPushSubscriptionManager.onMeetingActivated(event.meetingId());
|
||||
} catch (Exception ex) {
|
||||
log.warn("Failed to attach realtime push subscriptions, meetingId={}", event.meetingId(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时会话结束后,回收该会议的全部推送订阅与配额。
|
||||
*/
|
||||
@EventListener
|
||||
public void onSessionClosed(RealtimeMeetingSessionClosedEvent event) {
|
||||
try {
|
||||
realtimeMeetingPushSubscriptionManager.onMeetingClosed(event.meetingId());
|
||||
} catch (Exception ex) {
|
||||
log.warn("Failed to release realtime push subscriptions, meetingId={}", event.meetingId(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.imeeting.service.biz;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.imeeting.dto.biz.ClientDownloadDTO;
|
||||
import com.imeeting.dto.biz.ClientDownloadLatestVO;
|
||||
import com.imeeting.entity.biz.ClientDownload;
|
||||
import com.unisbase.security.LoginUser;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -13,6 +14,11 @@ import java.util.Map;
|
|||
public interface ClientDownloadService extends IService<ClientDownload> {
|
||||
List<ClientDownload> listForAdmin(LoginUser loginUser, String platformCode, Integer status);
|
||||
|
||||
/**
|
||||
* 查询登录页桌面端下载列表,平台项来自数据字典,无安装包时 hasPackage 为 false。
|
||||
*/
|
||||
List<ClientDownloadLatestVO> listLatestForDownload(String platformCode);
|
||||
|
||||
ClientDownload create(ClientDownloadDTO dto, LoginUser loginUser);
|
||||
|
||||
ClientDownload update(Long id, ClientDownloadDTO dto, LoginUser loginUser);
|
||||
|
|
@ -20,4 +26,4 @@ public interface ClientDownloadService extends IService<ClientDownload> {
|
|||
void removeClient(Long id, LoginUser loginUser);
|
||||
|
||||
Map<String, Object> uploadPackage(String platformCode, MultipartFile file) throws IOException;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.imeeting.mapper.biz.LlmModelMapper;
|
|||
import com.imeeting.service.biz.AiModelService;
|
||||
import com.imeeting.service.biz.SpeakerAsrSyncService;
|
||||
import com.imeeting.service.biz.TenantModelActivationService;
|
||||
import com.imeeting.support.LlmReasoningThinkingSupport;
|
||||
import com.unisbase.dto.PageResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -405,6 +406,7 @@ public class AiModelServiceImpl implements AiModelService {
|
|||
if (dto.getTopP() != null) {
|
||||
body.put("top_p", dto.getTopP());
|
||||
}
|
||||
LlmReasoningThinkingSupport.applyChatCompletionParams(body, dto.getReasoningEffort(), dto.getThinkingMode());
|
||||
body.put("response_format", Map.of("type", "json_object"));
|
||||
body.put("messages", buildConnectivityTestMessages(dto.getTestMessage()));
|
||||
|
||||
|
|
@ -1188,6 +1190,8 @@ public class AiModelServiceImpl implements AiModelService {
|
|||
entity.setTemperature(dto.getTemperature() == null ? BigDecimal.valueOf(0.2) : dto.getTemperature());
|
||||
entity.setTopP(dto.getTopP() == null ? BigDecimal.valueOf(0.9) : dto.getTopP());
|
||||
entity.setMaxTokens(resolveMaxTokens(dto.getMaxTokens()));
|
||||
entity.setReasoningEffort(LlmReasoningThinkingSupport.normalizeReasoningEffort(dto.getReasoningEffort()));
|
||||
entity.setThinkingMode(LlmReasoningThinkingSupport.normalizeThinkingMode(dto.getThinkingMode()));
|
||||
entity.setIsDefault(dto.getIsDefault());
|
||||
entity.setStatus(dto.getStatus());
|
||||
entity.setSortOrder(normalizeSortOrder(dto.getSortOrder()));
|
||||
|
|
@ -1300,6 +1304,8 @@ public class AiModelServiceImpl implements AiModelService {
|
|||
vo.setTemperature(entity.getTemperature());
|
||||
vo.setTopP(entity.getTopP());
|
||||
vo.setMaxTokens(resolveMaxTokens(entity.getMaxTokens()));
|
||||
vo.setReasoningEffort(entity.getReasoningEffort());
|
||||
vo.setThinkingMode(entity.getThinkingMode());
|
||||
vo.setIsDefault(entity.getIsDefault());
|
||||
vo.setStatus(entity.getStatus());
|
||||
vo.setScope(Long.valueOf(0L).equals(entity.getTenantId()) ? "PLATFORM" : "TENANT");
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.imeeting.mapper.biz.MeetingMapper;
|
|||
import com.imeeting.mapper.biz.MeetingTranscriptMapper;
|
||||
import com.imeeting.service.android.AndroidMeetingPushService;
|
||||
import com.imeeting.service.biz.*;
|
||||
import com.imeeting.support.LlmReasoningThinkingSupport;
|
||||
import com.imeeting.support.TaskSecurityContextRunner;
|
||||
import com.imeeting.support.redis.MeetingAsrPermitCache;
|
||||
import com.imeeting.support.redis.MeetingLockCache;
|
||||
|
|
@ -1310,6 +1311,7 @@ public class AiTaskServiceImpl extends ServiceImpl<AiTaskMapper, AiTask> impleme
|
|||
req.put("model", llmModel.getModelCode());
|
||||
req.put("temperature", llmModel.getTemperature());
|
||||
req.put("max_tokens", llmModel.getMaxTokens() == null ? 30000L : llmModel.getMaxTokens());
|
||||
LlmReasoningThinkingSupport.applyChatCompletionParams(req, llmModel.getReasoningEffort(), llmModel.getThinkingMode());
|
||||
req.put("messages", List.of(
|
||||
Map.of("role", "system", "content", meetingSummaryPromptAssembler.buildSystemMessage(taskRecord.getTaskConfig())),
|
||||
Map.of("role", "user", "content", meetingSummaryPromptAssembler.buildUserMessage(taskRecord.getTaskConfig(), meeting, summarySource, userPrompt))
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.imeeting.dto.biz.ClientDownloadDTO;
|
||||
import com.imeeting.dto.biz.ClientDownloadLatestVO;
|
||||
import com.imeeting.entity.biz.ClientDownload;
|
||||
import com.imeeting.mapper.biz.ClientDownloadMapper;
|
||||
import com.imeeting.service.biz.ClientDownloadService;
|
||||
import com.imeeting.support.ApkManifestParser;
|
||||
import com.unisbase.dto.SysDictItemDTO;
|
||||
import com.unisbase.security.LoginUser;
|
||||
import com.unisbase.service.SysDictItemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -20,17 +24,39 @@ import java.nio.file.Files;
|
|||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ClientDownloadServiceImpl extends ServiceImpl<ClientDownloadMapper, ClientDownload> implements ClientDownloadService {
|
||||
|
||||
private static final long GLOBAL_TENANT_ID = 0L;
|
||||
|
||||
/**
|
||||
* 数据字典 client_platform 桌面端子项值,同时作为下级字典的 type_code
|
||||
*/
|
||||
private static final String DESKTOP_PLATFORM_TYPE = "DESKTOP";
|
||||
|
||||
private static final String FAMILY_WINDOWS = "WINDOWS";
|
||||
|
||||
private static final String FAMILY_MACOS = "MACOS";
|
||||
|
||||
private static final String FAMILY_HARMONYOS = "HARMONYOS";
|
||||
|
||||
private static final String FAMILY_LINUX = "LINUX";
|
||||
|
||||
private final SysDictItemService sysDictItemService;
|
||||
|
||||
@Value("${unisbase.app.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
|
|
@ -52,6 +78,62 @@ public class ClientDownloadServiceImpl extends ServiceImpl<ClientDownloadMapper,
|
|||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClientDownloadLatestVO> listLatestForDownload(String platformCode) {
|
||||
return buildLatestDownloadList(listLatestDesktopPackages(platformCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按数据字典顺序组装桌面端最新下载项,与数据库查询解耦便于单元测试校验匹配规则。
|
||||
*/
|
||||
List<ClientDownloadLatestVO> buildLatestDownloadList(List<ClientDownload> packages) {
|
||||
// 版本号倒序在内存中完成,避免不同数据库对 NULL 版本号的排序差异影响最新版本判定
|
||||
List<ClientDownload> ordered = new ArrayList<>(packages);
|
||||
ordered.sort(latestVersionOrder());
|
||||
Map<String, ClientDownload> latestByFamily = new HashMap<>();
|
||||
for (ClientDownload item : ordered) {
|
||||
latestByFamily.putIfAbsent(platformFamily(item.getPlatformCode()), item);
|
||||
}
|
||||
|
||||
// 平台按钮以数据字典为准,字典里存在但暂无安装包的平台同样返回,由前端提示暂无安装包
|
||||
List<ClientDownloadLatestVO> result = new ArrayList<>();
|
||||
Set<String> dictFamilies = new HashSet<>();
|
||||
for (SysDictItemDTO dictItem : desktopDictItems()) {
|
||||
String family = platformFamily(dictItem.getItemValue());
|
||||
if (!dictFamilies.add(family)) {
|
||||
continue;
|
||||
}
|
||||
ClientDownload latest = latestByFamily.get(family);
|
||||
ClientDownloadLatestVO vo = new ClientDownloadLatestVO();
|
||||
vo.setPlatformCode(dictItem.getItemValue());
|
||||
vo.setPlatformName(dictItem.getItemLabel());
|
||||
vo.setPlatformType(DESKTOP_PLATFORM_TYPE);
|
||||
vo.setHasPackage(latest != null && !isBlank(latest.getDownloadUrl()));
|
||||
if (latest != null) {
|
||||
vo.setVersion(latest.getVersion());
|
||||
vo.setVersionCode(latest.getVersionCode());
|
||||
vo.setDownloadUrl(latest.getDownloadUrl());
|
||||
vo.setFileSize(latest.getFileSize());
|
||||
}
|
||||
result.add(vo);
|
||||
}
|
||||
|
||||
if (!dictFamilies.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 字典不可用时才回退为按安装包渲染;字典正常时以字典为准,停用字典项即可隐藏平台
|
||||
Set<String> appendedFamilies = new HashSet<>();
|
||||
for (ClientDownload item : ordered) {
|
||||
String family = platformFamily(item.getPlatformCode());
|
||||
if (!appendedFamilies.add(family)) {
|
||||
continue;
|
||||
}
|
||||
result.add(toLatestVO(item, item.getPlatformName()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ClientDownload create(ClientDownloadDTO dto, LoginUser loginUser) {
|
||||
|
|
@ -224,4 +306,119 @@ public class ClientDownloadServiceImpl extends ServiceImpl<ClientDownloadMapper,
|
|||
String trimmed = value.trim();
|
||||
return trimmed.isEmpty() ? null : trimmed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询启用且标记为最新的桌面端安装包,platform_type 为空的历史数据按桌面端兼容处理。
|
||||
*/
|
||||
private List<ClientDownload> listLatestDesktopPackages(String platformCode) {
|
||||
LambdaQueryWrapper<ClientDownload> wrapper = new LambdaQueryWrapper<ClientDownload>()
|
||||
.eq(ClientDownload::getStatus, 1)
|
||||
.eq(ClientDownload::getIsLatest, 1)
|
||||
.eq(ClientDownload::getTenantId, GLOBAL_TENANT_ID);
|
||||
|
||||
// 平台编码按平台族匹配,兼容调用方与库内混用 WIN/WINDOWS 等写法
|
||||
String wantedFamily = isBlank(platformCode) ? null : platformFamily(platformCode);
|
||||
List<ClientDownload> desktopPackages = new ArrayList<>();
|
||||
for (ClientDownload item : this.list(wrapper)) {
|
||||
if (!isDesktopPlatformType(item.getPlatformType(), item.getPlatformCode())) {
|
||||
continue;
|
||||
}
|
||||
if (wantedFamily != null && !wantedFamily.equals(platformFamily(item.getPlatformCode()))) {
|
||||
continue;
|
||||
}
|
||||
desktopPackages.add(item);
|
||||
}
|
||||
return desktopPackages;
|
||||
}
|
||||
|
||||
/**
|
||||
* platform_type 为空时按平台编码兜底判定,避免编码无法识别的移动端、终端包混入桌面端下载列表。
|
||||
*/
|
||||
boolean isDesktopPlatformType(String platformType, String platformCode) {
|
||||
if (!isBlank(platformType)) {
|
||||
return DESKTOP_PLATFORM_TYPE.equalsIgnoreCase(platformType.trim());
|
||||
}
|
||||
return isKnownDesktopFamily(platformCode);
|
||||
}
|
||||
|
||||
private boolean isKnownDesktopFamily(String platformCode) {
|
||||
String family = platformFamily(platformCode);
|
||||
return FAMILY_WINDOWS.equals(family) || FAMILY_MACOS.equals(family)
|
||||
|| FAMILY_HARMONYOS.equals(family) || FAMILY_LINUX.equals(family);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取桌面端平台字典项,字典异常时返回空列表,登录页回退为按安装包渲染。
|
||||
*/
|
||||
private List<SysDictItemDTO> desktopDictItems() {
|
||||
try {
|
||||
List<SysDictItemDTO> items = sysDictItemService.getItemsByTypeCode(DESKTOP_PLATFORM_TYPE);
|
||||
return items == null ? Collections.emptyList() : items;
|
||||
} catch (Exception e) {
|
||||
log.warn("读取桌面端平台字典 {} 失败,登录页下载列表回退为安装包数据: {}",
|
||||
DESKTOP_PLATFORM_TYPE, e.getMessage());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 版本号倒序且空版本号排在最后,同版本号按主键倒序,用于判定同一平台族的最新记录。
|
||||
*/
|
||||
private Comparator<ClientDownload> latestVersionOrder() {
|
||||
return (left, right) -> {
|
||||
int byVersion = compareVersionDesc(left.getVersionCode(), right.getVersionCode());
|
||||
return byVersion != 0 ? byVersion : compareVersionDesc(left.getId(), right.getId());
|
||||
};
|
||||
}
|
||||
|
||||
private int compareVersionDesc(Long value, Long other) {
|
||||
if (value == null) {
|
||||
return other == null ? 0 : 1;
|
||||
}
|
||||
if (other == null) {
|
||||
return -1;
|
||||
}
|
||||
return Long.compare(other, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 归一化平台编码,兼容不同环境字典与安装包混用 WIN/WINDOWS、MAC/MACOS 等写法。
|
||||
*/
|
||||
private String platformFamily(String platformCode) {
|
||||
if (isBlank(platformCode)) {
|
||||
return "";
|
||||
}
|
||||
String code = platformCode.trim().toUpperCase(Locale.ROOT);
|
||||
if (code.contains("WINDOW") || "WIN".equals(code) || "PC".equals(code)) {
|
||||
return FAMILY_WINDOWS;
|
||||
}
|
||||
if ("MAC".equals(code) || "MACOS".equals(code) || "OSX".equals(code)
|
||||
|| code.contains("MACOS") || code.contains("DARWIN")) {
|
||||
return FAMILY_MACOS;
|
||||
}
|
||||
if (code.contains("HARMONY") || code.contains("HMOS")) {
|
||||
return FAMILY_HARMONYOS;
|
||||
}
|
||||
if (isLinuxFamily(code)) {
|
||||
return FAMILY_LINUX;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
private boolean isLinuxFamily(String code) {
|
||||
return code.contains("LINUX") || code.contains("UBUNTU") || code.contains("DEBIAN");
|
||||
}
|
||||
|
||||
private ClientDownloadLatestVO toLatestVO(ClientDownload entity, String platformName) {
|
||||
ClientDownloadLatestVO vo = new ClientDownloadLatestVO();
|
||||
vo.setPlatformCode(entity.getPlatformCode());
|
||||
vo.setPlatformName(isBlank(platformName) ? entity.getPlatformCode() : platformName);
|
||||
vo.setPlatformType(DESKTOP_PLATFORM_TYPE);
|
||||
vo.setVersion(entity.getVersion());
|
||||
vo.setVersionCode(entity.getVersionCode());
|
||||
vo.setDownloadUrl(entity.getDownloadUrl());
|
||||
vo.setFileSize(entity.getFileSize());
|
||||
vo.setHasPackage(!isBlank(entity.getDownloadUrl()));
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.imeeting.dto.biz.MeetingSummaryOrchestrationTriggerResultVO;
|
|||
import com.imeeting.entity.biz.AiTask;
|
||||
import com.imeeting.entity.biz.Meeting;
|
||||
import com.imeeting.service.biz.AiModelService;
|
||||
import com.imeeting.support.LlmReasoningThinkingSupport;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -201,6 +202,8 @@ public class MeetingExternalSummaryWebhookTrigger {
|
|||
config.put("temperature", model.getTemperature());
|
||||
config.put("topP", model.getTopP());
|
||||
config.put("max_tokens", model.getMaxTokens() == null ? 30000L : model.getMaxTokens());
|
||||
config.put("reasoning_effort", LlmReasoningThinkingSupport.resolveReasoningEffort(model.getReasoningEffort()));
|
||||
config.put("enable_thinking", LlmReasoningThinkingSupport.resolveEnableThinking(model.getThinkingMode()));
|
||||
return config;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.imeeting.mapper.biz.MeetingTranscriptChapterVersionMapper;
|
|||
import com.imeeting.mapper.biz.MeetingTranscriptMapper;
|
||||
import com.imeeting.service.biz.AiModelService;
|
||||
import com.imeeting.service.biz.MeetingTranscriptChapterService;
|
||||
import com.imeeting.support.LlmReasoningThinkingSupport;
|
||||
import com.unisbase.service.SysParamService;
|
||||
import com.unisbase.service.SysParamService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -336,6 +337,7 @@ public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptCha
|
|||
requestBody.put("model", llmModel.getModelCode());
|
||||
requestBody.put("temperature", llmModel.getTemperature());
|
||||
requestBody.put("max_tokens", llmModel.getMaxTokens() == null ? 30000L : llmModel.getMaxTokens());
|
||||
LlmReasoningThinkingSupport.applyChatCompletionParams(requestBody, llmModel.getReasoningEffort(), llmModel.getThinkingMode());
|
||||
requestBody.put("messages", List.of(
|
||||
Map.of("role", "system", "content", renderChapterSystemPrompt()),
|
||||
Map.of("role", "user", "content", renderChapterUserPrompt(transcripts))
|
||||
|
|
@ -1016,6 +1018,7 @@ public class MeetingTranscriptChapterServiceImpl implements MeetingTranscriptCha
|
|||
requestBody.put("model", llmModel.getModelCode());
|
||||
requestBody.put("temperature", llmModel.getTemperature());
|
||||
requestBody.put("max_tokens", llmModel.getMaxTokens() == null ? 30000L : llmModel.getMaxTokens());
|
||||
LlmReasoningThinkingSupport.applyChatCompletionParams(requestBody, llmModel.getReasoningEffort(), llmModel.getThinkingMode());
|
||||
requestBody.put("messages", List.of(
|
||||
Map.of("role", "system", "content", renderChapterSystemPrompt()),
|
||||
Map.of("role", "user", "content", renderChapterUserPrompt(transcripts))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,538 @@
|
|||
package com.imeeting.service.realtime;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.imeeting.common.MeetingConstants;
|
||||
import com.imeeting.dto.android.AndroidGrpcConnectionDetailVO;
|
||||
import com.imeeting.dto.biz.RealtimeMeetingSessionState;
|
||||
import com.imeeting.entity.biz.Meeting;
|
||||
import com.imeeting.enums.MeetingPushTypeEnum;
|
||||
import com.imeeting.grpc.push.PushMessage;
|
||||
import com.imeeting.service.android.AndroidGatewayPushService;
|
||||
import com.imeeting.service.biz.MeetingAccessService;
|
||||
import com.imeeting.service.realtime.impl.LocalRealtimeAsrChannel;
|
||||
import com.imeeting.support.redis.RealtimeMeetingSessionCache;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* 实时会议转写推送订阅管理。
|
||||
*
|
||||
* <p>订阅通道只有一条:push.proto 的设备推送长连接。长连接建立即视为尝试订阅,是否下发按 user_id 判定,
|
||||
* 只有会议创建人、主持人以及 biz_meetings.participants 命中的用户才会收到推送;判定只看 user_id 是否命中
|
||||
* 参会人集合,不要求推送连接的授权租户与会议租户一致。realtime gRPC 只承载发布端音频,不再承担订阅职责。
|
||||
*
|
||||
* <p>同一用户在不同设备上的推送长连接互相独立、全部保留并各自下发;正在发布音频的设备经 realtime gRPC
|
||||
* 自行收流,不再重复下发推送。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RealtimeMeetingPushSubscriptionManager {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
private static final String DEFAULT_TITLE = "实时转写";
|
||||
private static final long INFO_REFRESH_MILLIS = 15_000L;
|
||||
private static final Duration LIVE_MEETING_TTL = Duration.ofSeconds(120);
|
||||
|
||||
private final AndroidGatewayPushService androidGatewayPushService;
|
||||
private final RealtimeMeetingEventHub eventHub;
|
||||
private final RealtimeMeetingSubscriptionQuota subscriptionQuota;
|
||||
private final RealtimeMeetingTranscriptCacheService transcriptCacheService;
|
||||
private final MeetingAccessService meetingAccessService;
|
||||
private final RealtimeMeetingSessionCache sessionCache;
|
||||
|
||||
@Value("${imeeting.realtime.max-subscribers-per-meeting:200}")
|
||||
private int maxSubscribersPerMeeting = 200;
|
||||
|
||||
private final ConcurrentMap<Long, LiveMeeting> liveMeetings = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 发布端激活会议时写入跨实例活跃索引,并把该会议参会人当前在线的推送长连接挂接为订阅者。
|
||||
*/
|
||||
public void onMeetingActivated(Long meetingId) {
|
||||
if (meetingId == null) {
|
||||
return;
|
||||
}
|
||||
sessionCache.markLive(meetingId, LIVE_MEETING_TTL);
|
||||
LiveMeeting live = ensureLocalLive(meetingId);
|
||||
if (live == null) {
|
||||
return;
|
||||
}
|
||||
int attached = attachUserConnections(live, null);
|
||||
log.info("Realtime meeting marked live for push, meetingId={}, eligibleUsers={}, attached={}",
|
||||
meetingId, live.userIds.size(), attached);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会议实时会话结束时回收该会议的全部推送订阅。
|
||||
*/
|
||||
public void onMeetingClosed(Long meetingId) {
|
||||
if (meetingId == null) {
|
||||
return;
|
||||
}
|
||||
sessionCache.clearLive(meetingId);
|
||||
LiveMeeting live = liveMeetings.remove(meetingId);
|
||||
if (live == null) {
|
||||
return;
|
||||
}
|
||||
int released;
|
||||
synchronized (live) {
|
||||
released = live.byConnectionId.size();
|
||||
for (Subscription subscription : live.byConnectionId.values()) {
|
||||
subscriptionQuota.release(meetingId, subscription.member());
|
||||
}
|
||||
live.byConnectionId.clear();
|
||||
detachHub(live);
|
||||
}
|
||||
log.info("Realtime meeting closed, push subscriptions released, meetingId={}, released={}", meetingId, released);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送长连接建立即尝试订阅:只挂接该用户作为创建人、主持人或参会人的进行中实时会议。
|
||||
*
|
||||
* <p>下发资格只按 user_id 是否命中参会人集合判定。推送连接的授权租户可能来自设备授权而非登录租户,
|
||||
* 因此不能拿租户相等作为前置条件,否则会漏掉合法参会人;租户只用于日志定位。
|
||||
*/
|
||||
public void onPushConnectionOpened(Long tenantId, Long userId, String deviceId, String connectionId) {
|
||||
if (userId == null || isBlank(deviceId) || isBlank(connectionId)) {
|
||||
log.info("Skip realtime push subscription for push connection without user, deviceId={}, connectionId={}",
|
||||
deviceId, connectionId);
|
||||
return;
|
||||
}
|
||||
Set<Long> liveMeetingIds = resolveLiveMeetingIds();
|
||||
int attached = 0;
|
||||
for (Long meetingId : liveMeetingIds) {
|
||||
LiveMeeting live = ensureLocalLive(meetingId);
|
||||
if (live == null) {
|
||||
continue;
|
||||
}
|
||||
if (!live.userIds.contains(userId)) {
|
||||
log.info("Realtime push subscription skipped for non-participant, meetingId={}, userId={}, deviceId={}, connectionTenantId={}, meetingTenantId={}",
|
||||
meetingId, userId, deviceId, tenantId, live.tenantId);
|
||||
continue;
|
||||
}
|
||||
Subscription subscription = attach(live, deviceId, userId, connectionId);
|
||||
if (subscription != null) {
|
||||
attached++;
|
||||
replayHistory(live, subscription);
|
||||
}
|
||||
}
|
||||
log.info("Realtime push subscription attempt finished, userId={}, deviceId={}, connectionId={}, connectionTenantId={}, liveMeetings={}, attached={}",
|
||||
userId, deviceId, connectionId, tenantId, liveMeetingIds.size(), attached);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送长连接关闭时释放它承载的全部订阅;其他设备与其他连接不受影响。
|
||||
*/
|
||||
public void onPushConnectionClosed(String connectionId) {
|
||||
if (isBlank(connectionId)) {
|
||||
return;
|
||||
}
|
||||
for (LiveMeeting live : liveMeetings.values()) {
|
||||
Subscription subscription;
|
||||
synchronized (live) {
|
||||
subscription = live.byConnectionId.get(connectionId);
|
||||
}
|
||||
if (subscription != null) {
|
||||
detach(live, subscription, "connection-closed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本实例需要跟踪的实时会议:Redis 活跃索引(跨实例)与本机已登记的会议。
|
||||
*/
|
||||
private Set<Long> resolveLiveMeetingIds() {
|
||||
Set<Long> meetingIds = new LinkedHashSet<>(sessionCache.listLiveMeetingIds());
|
||||
meetingIds.addAll(liveMeetings.keySet());
|
||||
return meetingIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确保本实例跟踪该会议的推送订阅;会话已结束或已回收时清理本机状态并返回 null。
|
||||
*/
|
||||
private LiveMeeting ensureLocalLive(Long meetingId) {
|
||||
RealtimeMeetingSessionState state = sessionCache.getState(meetingId);
|
||||
String status = state == null ? null : state.getStatus();
|
||||
if (state == null || "COMPLETED".equals(status)) {
|
||||
onMeetingClosed(meetingId);
|
||||
return null;
|
||||
}
|
||||
LiveMeeting live = liveMeetings.computeIfAbsent(meetingId, LiveMeeting::new);
|
||||
live.status = status;
|
||||
synchronized (live) {
|
||||
refreshInfoLocked(live);
|
||||
refreshPublisherDeviceLocked(live);
|
||||
}
|
||||
return live;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录正在发布音频的设备,写入 Redis 供其它实例共享,发布端自身不再重复收推送。
|
||||
*/
|
||||
public void markPublisherDevice(Long meetingId, String deviceId) {
|
||||
if (meetingId == null || isBlank(deviceId)) {
|
||||
return;
|
||||
}
|
||||
String publisherDeviceId = deviceId.trim();
|
||||
LiveMeeting live = liveMeetings.get(meetingId);
|
||||
if (live != null) {
|
||||
live.publisherDeviceId = publisherDeviceId;
|
||||
}
|
||||
sessionCache.savePublisherDevice(meetingId, publisherDeviceId, LIVE_MEETING_TTL);
|
||||
log.info("Realtime publisher device recorded, meetingId={}, deviceId={}", meetingId, publisherDeviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布设备断开后清除标记,让它重新按参会人身份接收推送。
|
||||
*/
|
||||
public void clearPublisherDevice(Long meetingId, String deviceId) {
|
||||
if (meetingId == null || isBlank(deviceId)) {
|
||||
return;
|
||||
}
|
||||
String publisherDeviceId = deviceId.trim();
|
||||
LiveMeeting live = liveMeetings.get(meetingId);
|
||||
if (live != null && publisherDeviceId.equals(live.publisherDeviceId)) {
|
||||
live.publisherDeviceId = null;
|
||||
}
|
||||
sessionCache.clearPublisherDevice(meetingId, publisherDeviceId);
|
||||
log.info("Realtime publisher device cleared, meetingId={}, deviceId={}", meetingId, publisherDeviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布设备以 Redis 为准,让不承载发布连接的实例也能抑制发布端重复收流;调用方持有会议锁。
|
||||
*/
|
||||
private void refreshPublisherDeviceLocked(LiveMeeting live) {
|
||||
String publisherDeviceId = sessionCache.getPublisherDevice(live.meetingId);
|
||||
if (isBlank(publisherDeviceId)) {
|
||||
live.publisherDeviceId = null;
|
||||
return;
|
||||
}
|
||||
live.publisherDeviceId = publisherDeviceId.trim();
|
||||
sessionCache.savePublisherDevice(live.meetingId, live.publisherDeviceId, LIVE_MEETING_TTL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 续约配额槽位、刷新参会人、回收已结束会议与不再具备资格的订阅。
|
||||
*/
|
||||
@Scheduled(fixedDelayString = "${imeeting.realtime.push-subscription-sweep-millis:15000}")
|
||||
public void sweepLiveMeetings() {
|
||||
for (Long meetingId : resolveLiveMeetingIds()) {
|
||||
try {
|
||||
LiveMeeting live = ensureLocalLive(meetingId);
|
||||
if (live == null) {
|
||||
continue;
|
||||
}
|
||||
sessionCache.markLive(meetingId, LIVE_MEETING_TTL);
|
||||
sweepMeeting(live);
|
||||
} catch (Exception ex) {
|
||||
log.warn("Failed to sweep realtime push subscriptions, meetingId={}", meetingId, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sweepMeeting(LiveMeeting live) {
|
||||
synchronized (live) {
|
||||
live.byConnectionId.values().forEach(subscription ->
|
||||
subscriptionQuota.renew(live.meetingId, subscription.member()));
|
||||
}
|
||||
int detached = 0;
|
||||
for (Subscription subscription : live.byConnectionId.values()) {
|
||||
if (!live.userIds.contains(subscription.userId())) {
|
||||
detach(live, subscription, "not-participant");
|
||||
detached++;
|
||||
}
|
||||
}
|
||||
int attached = attachUserConnections(live, null);
|
||||
if (attached > 0 || detached > 0) {
|
||||
log.info("Realtime push subscriptions reconciled, meetingId={}, attached={}, detached={}",
|
||||
live.meetingId, attached, detached);
|
||||
}
|
||||
// 判空与移除必须与 attach 持有同一把会议锁,否则刚挂上的订阅会被误回收成不在册状态(配额不再释放)。
|
||||
synchronized (live) {
|
||||
if (live.byConnectionId.isEmpty() && !"ACTIVE".equals(live.status)) {
|
||||
liveMeetings.remove(live.meetingId, live);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把用户当前在线的推送长连接挂到该会议;onlyUserId 为空表示全部参会人。
|
||||
*/
|
||||
private int attachUserConnections(LiveMeeting live, Long onlyUserId) {
|
||||
int attached = 0;
|
||||
for (Long userId : live.userIds) {
|
||||
if (onlyUserId != null && !onlyUserId.equals(userId)) {
|
||||
continue;
|
||||
}
|
||||
for (AndroidGrpcConnectionDetailVO connection : androidGatewayPushService.listUserConnections(userId)) {
|
||||
Subscription subscription = attach(live, connection.getDeviceId(), userId, connection.getConnectionId());
|
||||
if (subscription == null) {
|
||||
continue;
|
||||
}
|
||||
attached++;
|
||||
replayHistory(live, subscription);
|
||||
}
|
||||
}
|
||||
return attached;
|
||||
}
|
||||
|
||||
private Subscription attach(LiveMeeting live, String deviceId, Long userId, String connectionId) {
|
||||
if (isBlank(deviceId) || isBlank(connectionId)) {
|
||||
return null;
|
||||
}
|
||||
synchronized (live) {
|
||||
if (liveMeetings.get(live.meetingId) != live) {
|
||||
// 会议已被回收(sweep / close),拒绝新订阅,避免产生不在册的无主订阅占位。
|
||||
return null;
|
||||
}
|
||||
if (live.byConnectionId.containsKey(connectionId)) {
|
||||
return null;
|
||||
}
|
||||
if (live.byConnectionId.size() >= maxSubscribersPerMeeting) {
|
||||
RealtimeMeetingMetrics.subscriberRejected("push");
|
||||
log.warn("Realtime push subscription rejected by per-meeting cap, meetingId={}, deviceId={}, cap={}",
|
||||
live.meetingId, deviceId, maxSubscribersPerMeeting);
|
||||
return null;
|
||||
}
|
||||
String member = subscriptionQuota.member(connectionId);
|
||||
if (!subscriptionQuota.tryAcquire(live.meetingId, member)) {
|
||||
RealtimeMeetingMetrics.subscriberRejected("push");
|
||||
log.warn("Realtime push subscription rejected by subscriber quota, meetingId={}, deviceId={}",
|
||||
live.meetingId, deviceId);
|
||||
return null;
|
||||
}
|
||||
if (live.consumer == null && !attachHub(live)) {
|
||||
subscriptionQuota.release(live.meetingId, member);
|
||||
RealtimeMeetingMetrics.subscriberRejected("push");
|
||||
log.warn("Realtime push subscription rejected by event hub, meetingId={}, deviceId={}",
|
||||
live.meetingId, deviceId);
|
||||
return null;
|
||||
}
|
||||
Subscription subscription = new Subscription(connectionId, deviceId.trim(), userId, member);
|
||||
live.byConnectionId.put(connectionId, subscription);
|
||||
RealtimeMeetingMetrics.subscriberOpened("push");
|
||||
log.info("Realtime push subscription attached, meetingId={}, deviceId={}, userId={}, connectionId={}",
|
||||
live.meetingId, deviceId, userId, connectionId);
|
||||
return subscription;
|
||||
}
|
||||
}
|
||||
|
||||
private void detach(LiveMeeting live, Subscription subscription, String reason) {
|
||||
synchronized (live) {
|
||||
if (!live.byConnectionId.remove(subscription.connectionId(), subscription)) {
|
||||
return;
|
||||
}
|
||||
subscriptionQuota.release(live.meetingId, subscription.member());
|
||||
if (live.byConnectionId.isEmpty()) {
|
||||
detachHub(live);
|
||||
}
|
||||
}
|
||||
RealtimeMeetingMetrics.subscriberClosed("push");
|
||||
log.info("Realtime push subscription detached, meetingId={}, deviceId={}, userId={}, connectionId={}, reason={}",
|
||||
live.meetingId, subscription.deviceId(), subscription.userId(), subscription.connectionId(), reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每个会议只挂一个事件总线消费者,扇出到该会议在本实例上的推送连接;调用方持有会议锁。
|
||||
*/
|
||||
private boolean attachHub(LiveMeeting live) {
|
||||
Consumer<String> consumer = payload -> deliverAll(live, payload);
|
||||
if (!eventHub.trySubscribe(live.meetingId, consumer, Math.max(maxSubscribersPerMeeting, 1))) {
|
||||
return false;
|
||||
}
|
||||
live.consumer = consumer;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void detachHub(LiveMeeting live) {
|
||||
if (live.consumer != null) {
|
||||
eventHub.unsubscribe(live.meetingId, live.consumer);
|
||||
live.consumer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void deliverAll(LiveMeeting live, String payload) {
|
||||
if (live.byConnectionId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PushMessage message = buildPushMessage(live.meetingId, live.title, payload);
|
||||
String publisherDeviceId = live.publisherDeviceId;
|
||||
for (Subscription subscription : live.byConnectionId.values()) {
|
||||
if (publisherDeviceId != null && publisherDeviceId.equals(subscription.deviceId())) {
|
||||
// 发布设备正在 realtime gRPC 上收流,避免同一转写重复下发。
|
||||
continue;
|
||||
}
|
||||
push(live.meetingId, subscription, message, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void replayHistory(LiveMeeting live, Subscription subscription) {
|
||||
try {
|
||||
var items = transcriptCacheService.listOrderedItems(live.meetingId);
|
||||
for (var item : items) {
|
||||
push(live.meetingId, subscription,
|
||||
buildPushMessage(live.meetingId, live.title, LocalRealtimeAsrChannel.buildFrontendTranscriptMessage(item)), true);
|
||||
}
|
||||
log.info("Realtime transcripts replayed over push, meetingId={}, deviceId={}, connectionId={}, count={}",
|
||||
live.meetingId, subscription.deviceId(), subscription.connectionId(), items.size());
|
||||
} catch (Exception ex) {
|
||||
log.warn("Failed to replay realtime transcripts over push, meetingId={}, deviceId={}",
|
||||
live.meetingId, subscription.deviceId(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void push(Long meetingId, Subscription subscription, PushMessage message, boolean replay) {
|
||||
if (!androidGatewayPushService.pushToConnection(subscription.connectionId(), message)) {
|
||||
RealtimeMeetingMetrics.pushDeliveryMissed();
|
||||
log.warn("Realtime transcript push has no live connection, meetingId={}, deviceId={}, connectionId={}, replay={}",
|
||||
meetingId, subscription.deviceId(), subscription.connectionId(), replay);
|
||||
return;
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Realtime transcript pushed, meetingId={}, deviceId={}, connectionId={}, replay={}, messageId={}",
|
||||
meetingId, subscription.deviceId(), subscription.connectionId(), replay, message.getMessageId());
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshInfoLocked(LiveMeeting live) {
|
||||
if (live.infoLoadedAt > 0 && System.currentTimeMillis() - live.infoLoadedAt < INFO_REFRESH_MILLIS) {
|
||||
return;
|
||||
}
|
||||
Meeting meeting = loadRealtimeMeeting(live.meetingId);
|
||||
if (meeting != null) {
|
||||
applyMeetingInfo(live, meeting);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyMeetingInfo(LiveMeeting live, Meeting meeting) {
|
||||
live.tenantId = meeting.getTenantId();
|
||||
live.title = isBlank(meeting.getTitle()) ? DEFAULT_TITLE : meeting.getTitle().trim();
|
||||
Set<Long> userIds = new LinkedHashSet<>();
|
||||
if (meeting.getCreatorId() != null) {
|
||||
userIds.add(meeting.getCreatorId());
|
||||
}
|
||||
if (meeting.getHostUserId() != null) {
|
||||
userIds.add(meeting.getHostUserId());
|
||||
}
|
||||
if (!isBlank(meeting.getParticipants())) {
|
||||
for (String token : meeting.getParticipants().split(",")) {
|
||||
Long userId = parseUserId(token);
|
||||
if (userId != null) {
|
||||
userIds.add(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
live.userIds = userIds;
|
||||
live.infoLoadedAt = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private Meeting loadRealtimeMeeting(Long meetingId) {
|
||||
try {
|
||||
Meeting meeting = meetingAccessService.requireMeetingIgnoreTenant(meetingId);
|
||||
if (meeting == null) {
|
||||
log.warn("Realtime meeting not found, meetingId={}", meetingId);
|
||||
return null;
|
||||
}
|
||||
if (!MeetingConstants.TYPE_REALTIME.equalsIgnoreCase(meeting.getMeetingType())) {
|
||||
log.warn("Meeting is not a realtime meeting, meetingId={}, meetingType={}", meetingId, meeting.getMeetingType());
|
||||
return null;
|
||||
}
|
||||
return meeting;
|
||||
} catch (Exception ex) {
|
||||
log.warn("Failed to load meeting for realtime push subscription, meetingId={}", meetingId, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private PushMessage buildPushMessage(Long meetingId, String meetingTitle, String payload) {
|
||||
return PushMessage.newBuilder()
|
||||
.setMessageId("realtime_transcript:" + meetingId + ":" + UUID.randomUUID())
|
||||
.setTimestamp(System.currentTimeMillis())
|
||||
.setType(MeetingPushTypeEnum.MEETING_REALTIME_TRANSCRIPT.getCode())
|
||||
.setTitle(isBlank(meetingTitle) ? DEFAULT_TITLE : meetingTitle.trim())
|
||||
.setContent(buildContent(meetingId, payload))
|
||||
.setNeedAck(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转写报文保持与实时通道一致,只在顶层补 meetingId 供客户端按会议分流。
|
||||
*/
|
||||
private String buildContent(Long meetingId, String payload) {
|
||||
String text = payload == null ? "" : payload;
|
||||
if (meetingId == null) {
|
||||
return text;
|
||||
}
|
||||
try {
|
||||
JsonNode node = OBJECT_MAPPER.readTree(text);
|
||||
if (node instanceof ObjectNode objectNode) {
|
||||
objectNode.put("meetingId", meetingId);
|
||||
return OBJECT_MAPPER.writeValueAsString(objectNode);
|
||||
}
|
||||
} catch (JsonProcessingException ex) {
|
||||
log.debug("Realtime transcript payload is not a json object, wrap as text");
|
||||
}
|
||||
ObjectNode wrapper = OBJECT_MAPPER.createObjectNode();
|
||||
wrapper.put("meetingId", meetingId);
|
||||
wrapper.put("text", text);
|
||||
return wrapper.toString();
|
||||
}
|
||||
|
||||
private boolean isBlank(String value) {
|
||||
return value == null || value.isBlank();
|
||||
}
|
||||
|
||||
/**
|
||||
* 参会人按逗号分隔的用户 ID 解析,兼容残留引号与中括号,非法值只忽略不中断。
|
||||
*/
|
||||
private Long parseUserId(String token) {
|
||||
if (token == null) {
|
||||
return null;
|
||||
}
|
||||
String value = token.trim().replace("\"", "").replace("[", "").replace("]", "").trim();
|
||||
if (value.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Long.valueOf(value);
|
||||
} catch (NumberFormatException ex) {
|
||||
log.debug("Ignore non numeric participant id, value={}", value);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private record Subscription(String connectionId, String deviceId, Long userId, String member) {
|
||||
}
|
||||
|
||||
private final class LiveMeeting {
|
||||
|
||||
private final Long meetingId;
|
||||
private final ConcurrentMap<String, Subscription> byConnectionId = new ConcurrentHashMap<>();
|
||||
private volatile Long tenantId;
|
||||
private volatile String title = DEFAULT_TITLE;
|
||||
private volatile Set<Long> userIds = Set.of();
|
||||
private volatile String status;
|
||||
private volatile String publisherDeviceId;
|
||||
private volatile long infoLoadedAt;
|
||||
private Consumer<String> consumer;
|
||||
|
||||
private LiveMeeting(Long meetingId) {
|
||||
this.meetingId = meetingId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.imeeting.support;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* LLM 推理强度与思考模式的取值约束与请求参数下发。
|
||||
*
|
||||
* <p>业务约定:推理强度按 OpenAI 兼容协议下发 reasoning_effort;思考模式下发 enable_thinking 布尔值。
|
||||
* 推理强度为空、或思考模式为 auto 时不写入请求体,保证历史模型配置的调用行为完全不变。</p>
|
||||
*/
|
||||
public final class LlmReasoningThinkingSupport {
|
||||
|
||||
/**
|
||||
* 允许的推理强度取值,直接作为请求体 reasoning_effort
|
||||
*/
|
||||
public static final List<String> REASONING_EFFORTS = List.of("minimal", "low", "medium", "high");
|
||||
/**
|
||||
* 思考模式:跟随模型默认,不下发 enable_thinking
|
||||
*/
|
||||
public static final String THINKING_MODE_AUTO = "auto";
|
||||
/**
|
||||
* 思考模式:显式开启,下发 enable_thinking=true
|
||||
*/
|
||||
public static final String THINKING_MODE_ENABLED = "enabled";
|
||||
/**
|
||||
* 思考模式:显式关闭,下发 enable_thinking=false
|
||||
*/
|
||||
public static final String THINKING_MODE_DISABLED = "disabled";
|
||||
/**
|
||||
* 允许的思考模式取值
|
||||
*/
|
||||
public static final List<String> THINKING_MODES =
|
||||
List.of(THINKING_MODE_AUTO, THINKING_MODE_ENABLED, THINKING_MODE_DISABLED);
|
||||
|
||||
private LlmReasoningThinkingSupport() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置时归一化推理强度,空值表示不下发,非法取值直接拒绝。
|
||||
*/
|
||||
public static String normalizeReasoningEffort(String reasoningEffort) {
|
||||
String normalized = trimToLowerCase(reasoningEffort);
|
||||
if (normalized == null) {
|
||||
return null;
|
||||
}
|
||||
if (!REASONING_EFFORTS.contains(normalized)) {
|
||||
throw new RuntimeException("推理强度仅支持:" + String.join("/", REASONING_EFFORTS));
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置时归一化思考模式,空值按 auto 处理,非法取值直接拒绝。
|
||||
*/
|
||||
public static String normalizeThinkingMode(String thinkingMode) {
|
||||
String normalized = trimToLowerCase(thinkingMode);
|
||||
if (normalized == null) {
|
||||
return THINKING_MODE_AUTO;
|
||||
}
|
||||
if (!THINKING_MODES.contains(normalized)) {
|
||||
throw new RuntimeException("思考模式仅支持:" + String.join("/", THINKING_MODES));
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把模型配置的推理强度与思考模式附加到 chat/completions 请求体。
|
||||
*/
|
||||
public static void applyChatCompletionParams(Map<String, Object> body, String reasoningEffort, String thinkingMode) {
|
||||
if (body == null) {
|
||||
return;
|
||||
}
|
||||
String resolvedReasoningEffort = resolveReasoningEffort(reasoningEffort);
|
||||
if (resolvedReasoningEffort != null) {
|
||||
body.put("reasoning_effort", resolvedReasoningEffort);
|
||||
}
|
||||
Boolean enableThinking = resolveEnableThinking(thinkingMode);
|
||||
if (enableThinking != null) {
|
||||
body.put("enable_thinking", enableThinking);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求体 reasoning_effort 取值,未配置返回 null。
|
||||
*/
|
||||
public static String resolveReasoningEffort(String reasoningEffort) {
|
||||
return trimToLowerCase(reasoningEffort);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求体 enable_thinking 取值,auto 或空返回 null 表示不下发。
|
||||
*/
|
||||
public static Boolean resolveEnableThinking(String thinkingMode) {
|
||||
String normalized = trimToLowerCase(thinkingMode);
|
||||
if (THINKING_MODE_ENABLED.equals(normalized)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (THINKING_MODE_DISABLED.equals(normalized)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String trimToLowerCase(String value) {
|
||||
String trimmed = StrUtil.trimToNull(value);
|
||||
return trimmed == null ? null : trimmed.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 564 KiB |
|
|
@ -0,0 +1,8 @@
|
|||
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="32" height="32" viewBox="0 0 32 32"
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Frame">
|
||||
<path id="Vector"
|
||||
d="M5.63174 9.29132C5.63174 9.29132 3.33414 11.4929 3.20827 13.8204V14.2556C3.30854 16.1351 4.72721 17.2423 4.72721 17.2423C7.00347 19.4695 12.516 22.2705 13.8109 22.9041C13.8109 22.9041 13.8856 22.9425 13.9347 22.8913L13.9603 22.8423V22.7932C10.4253 15.0897 5.63601 9.28918 5.63601 9.28918L5.63174 9.29132ZM13.0749 24.7964C13.0493 24.6961 12.9512 24.6961 12.9512 24.6961L3.76721 25.0204C4.76134 26.7996 6.44241 28.1671 8.19601 27.7575C9.39067 27.446 12.1299 25.5431 13.0259 24.8945C13.1005 24.8327 13.0749 24.7836 13.0749 24.7836V24.7964ZM13.1752 23.8257C9.14321 21.0993 1.32667 16.9308 1.32667 16.9308C1.16108 17.4549 1.07339 18.0004 1.06641 18.55V18.6353C1.06641 19.9687 1.56347 20.9009 1.56347 20.9009C2.15243 22.1492 3.19317 23.1274 4.47547 23.638C5.34801 24.0113 6.21841 24.0241 6.21841 24.0241C6.36774 24.0497 11.6925 24.0241 13.1112 24.0241C13.1752 24.0241 13.2115 23.9601 13.2115 23.9601V23.8876C13.2115 23.8492 13.1752 23.8236 13.1752 23.8236V23.8257ZM12.3411 5.61985C11.4586 5.84475 10.6715 6.34679 10.0955 7.05219C9.51953 7.75759 9.18499 8.62915 9.14107 9.53878V10.0508C9.17947 10.7975 9.34161 11.3564 9.34161 11.3564C10.1629 14.966 14.1437 20.8753 15.0035 22.1212C15.0675 22.1831 15.1272 22.1574 15.1272 22.1574C15.151 22.1473 15.1711 22.1298 15.1845 22.1076C15.1979 22.0854 15.204 22.0596 15.2019 22.0337C16.5224 8.84332 13.8237 5.33398 13.8237 5.33398C13.4248 5.35958 12.3432 5.61985 12.3432 5.61985H12.3411ZM22.6685 8.44438C22.6685 8.44438 22.0584 6.20438 19.6328 5.60705C19.6328 5.60705 18.9224 5.43425 18.1757 5.33398C18.1757 5.33398 15.4643 8.83052 16.7827 22.0465C16.7955 22.1318 16.8573 22.1446 16.8573 22.1446C16.9427 22.183 16.9811 22.1084 16.9811 22.1084C17.8771 20.8262 21.8344 14.9404 22.6429 11.3564C22.6429 11.3564 23.0909 9.61345 22.6685 8.44438ZM19.0355 24.7089C19.0355 24.7089 18.948 24.7089 18.9224 24.7729C18.9224 24.7729 18.9117 24.8583 18.9608 24.8945C19.8312 25.5303 22.5064 27.3841 23.7885 27.7575C23.7885 27.7575 23.9869 27.8215 24.3219 27.8321H24.4989C25.3565 27.8065 26.8627 27.3713 28.2323 25.0204L19.0227 24.7089H19.0355ZM28.7784 14.2428C28.9533 11.6807 26.3635 9.30412 26.3635 9.29132C26.3635 9.29132 21.5741 15.0897 18.0648 22.7313C18.0648 22.7313 18.0264 22.8295 18.0904 22.8913L18.1395 22.9041H18.2141C19.5325 22.2449 25.0088 19.4567 27.2723 17.2551C27.2723 17.2551 28.7037 16.0967 28.7784 14.2428ZM30.6707 16.9073C30.6707 16.9073 22.8563 21.0993 18.8243 23.8129C18.8243 23.8129 18.7603 23.862 18.7859 23.9494C18.7859 23.9494 18.8243 24.0241 18.8733 24.0241C20.3176 24.0241 25.7917 24.0241 25.9283 23.9985C25.9283 23.9985 26.6387 23.9751 27.5091 23.638C27.5091 23.638 29.4504 23.0172 30.4595 20.8134C30.4595 20.8134 31.3661 19.0086 30.6707 16.9073Z"
|
||||
fill="black"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 15 KiB |
|
|
@ -0,0 +1,8 @@
|
|||
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="32" height="32" viewBox="0 0 32 32"
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Frame">
|
||||
<path id="Vector"
|
||||
d="M28.4272 22.9874C28.3895 23.1018 27.8004 25.1565 26.353 27.2693C25.1003 29.0919 23.805 30.9291 21.7592 30.9614C19.7473 30.9968 19.1035 29.761 16.8064 29.761C14.5123 29.761 13.7911 30.9291 11.8897 30.9968C9.92412 31.0772 8.41161 29.0059 7.15416 27.1923C4.58429 23.4771 2.60555 16.6642 5.25935 12.0985C6.56507 9.81405 8.91198 8.36197 11.4677 8.3223C13.3936 8.2859 15.2261 9.62698 16.3958 9.62698C17.5976 9.62698 19.8143 8.00425 22.1528 8.24704C23.1319 8.28875 25.8707 8.65637 27.6353 11.2139C27.4964 11.3083 24.3583 13.1602 24.3932 16.9293C24.4404 21.4796 28.3847 22.9719 28.4272 22.9874ZM20.6225 5.80967C21.677 4.52331 22.37 2.75507 22.1877 0.999023C20.682 1.05808 18.8475 1.99896 17.7572 3.27769C16.7932 4.39333 15.9435 6.18911 16.1805 7.92477C17.8535 8.02638 19.5736 7.04869 20.6225 5.80967Z"
|
||||
fill="black"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
|
@ -0,0 +1,8 @@
|
|||
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="32" height="32" viewBox="0 0 32 32"
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Frame">
|
||||
<path id="Vector"
|
||||
d="M16.3638 26.3783L29 28.4457V16.771H16.3638V26.3792V26.3783ZM16.3638 5.09625V14.6747H29V3L16.3638 5.09625ZM3 14.6747H13.6853V5.44562L3 7.22138V14.6747ZM3 24.282L13.6853 26.0289V16.77H3V24.282Z"
|
||||
fill="#000000"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 457 B |
|
|
@ -14,6 +14,8 @@ export interface AiModelVO {
|
|||
temperature?: number;
|
||||
topP?: number;
|
||||
max_tokens?: number;
|
||||
reasoningEffort?: string;
|
||||
thinkingMode?: string;
|
||||
mediaConfig?: Record<string, any>;
|
||||
isDefault: number;
|
||||
status: number;
|
||||
|
|
@ -49,6 +51,8 @@ export interface AiModelDTO {
|
|||
temperature?: number;
|
||||
topP?: number;
|
||||
max_tokens?: number;
|
||||
reasoningEffort?: string;
|
||||
thinkingMode?: string;
|
||||
mediaConfig?: Record<string, any>;
|
||||
isDefault: number;
|
||||
status: number;
|
||||
|
|
@ -160,6 +164,8 @@ export const testLlmModelConnectivity = (data: {
|
|||
temperature?: number;
|
||||
topP?: number;
|
||||
max_tokens?: number;
|
||||
reasoningEffort?: string;
|
||||
thinkingMode?: string;
|
||||
testMessage: string;
|
||||
}) => {
|
||||
return http.post<{ code: string; data: boolean; msg: string }>(
|
||||
|
|
|
|||
|
|
@ -76,3 +76,24 @@ export async function uploadClientPackage(platformCode: string, file: File) {
|
|||
});
|
||||
return resp.data.data as ClientUploadResult;
|
||||
}
|
||||
|
||||
/** 登录页桌面端下载项,平台列表由后端数据字典驱动 */
|
||||
export interface ClientLatestDownload {
|
||||
platformCode: string;
|
||||
platformName?: string;
|
||||
platformType?: string;
|
||||
version?: string;
|
||||
versionCode?: number;
|
||||
downloadUrl?: string;
|
||||
fileSize?: number;
|
||||
hasPackage?: boolean;
|
||||
}
|
||||
|
||||
/** 查询各平台最新可下载安装包(登录页免登录),平台项来自数据字典 */
|
||||
export async function fetchLatestClientDownloads(platformCode?: string) {
|
||||
const resp = await http.get("/api/clients/public/latest", {
|
||||
params: platformCode ? {platformCode} : undefined,
|
||||
suppressErrorToast: true
|
||||
});
|
||||
return (resp.data?.data || []) as ClientLatestDownload[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ const AUTH_WHITELIST = [
|
|||
"/sys/auth/device-code",
|
||||
"/sys/auth/password-policy/public",
|
||||
"/sys/auth/password-recovery/send-code",
|
||||
"/sys/auth/password-recovery/reset"
|
||||
"/sys/auth/password-recovery/reset",
|
||||
"/api/clients/public/latest"
|
||||
];
|
||||
const API_SUCCESS_CODE = "200";
|
||||
const REFRESH_AHEAD_MS = 60 * 1000;
|
||||
|
|
@ -85,7 +86,8 @@ function persistTokens(data: { accessToken: string; refreshToken: string }) {
|
|||
}
|
||||
|
||||
function isAuthWhitelistRequest(url?: string) {
|
||||
return AUTH_WHITELIST.some((path) => (url || "").includes(path));
|
||||
const path = (url || "").split("?")[0];
|
||||
return AUTH_WHITELIST.some((item) => path === item || path.endsWith(item));
|
||||
}
|
||||
|
||||
async function refreshAccessToken(): Promise<string | null> {
|
||||
|
|
@ -167,9 +169,14 @@ http.interceptors.response.use(
|
|||
}
|
||||
|
||||
if (error.response && (error.response.status === 401 || error.response.status === 403)) {
|
||||
clearAuthStorage();
|
||||
window.location.href = "/login?timeout=1";
|
||||
return Promise.reject(error);
|
||||
// 免登录白名单接口失败时不能清除已存在的登录态,也不跳转登录页
|
||||
if (!isAuthWhitelistRequest(originalRequest.url)) {
|
||||
clearAuthStorage();
|
||||
if (!window.location.pathname.startsWith("/login")) {
|
||||
window.location.href = "/login?timeout=1";
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
const body = error.response?.data;
|
||||
|
|
|
|||
|
|
@ -109,12 +109,18 @@
|
|||
"submit": "Login Now",
|
||||
"loggingIn": "Logging in...",
|
||||
"demoAccount": "Demo Account",
|
||||
"heroTitle1": "Intelligent Meeting",
|
||||
"heroTitle1": "Intelligent Meeting ",
|
||||
"heroTitle2": "Real-time Voice",
|
||||
"heroTitle3": "System",
|
||||
"heroTitle3": " System",
|
||||
"heroDesc": "Full-process automated meeting records, voiceprint recognition, and smart summaries. Next-gen solution for team collaboration efficiency.",
|
||||
"enterpriseSecurity": "Enterprise Security",
|
||||
"multiLang": "Multi-language Support",
|
||||
"downloadClient": "Download Desktop Client",
|
||||
"platformWindows": "Windows",
|
||||
"platformMacos": "macOS",
|
||||
"platformHarmony": "HarmonyOS",
|
||||
"platformLinux": "Linux",
|
||||
"noPackage": "No installation package available",
|
||||
"loginTimeout": "Login timeout, please log in again"
|
||||
},
|
||||
"devices": {
|
||||
|
|
|
|||
|
|
@ -115,6 +115,12 @@
|
|||
"heroDesc": "全流程自动化会议记录,声纹识别与智能摘要。提升团队协作效率的新一代解决方案。",
|
||||
"enterpriseSecurity": "企业级安全",
|
||||
"multiLang": "多语言支持",
|
||||
"downloadClient": "下载桌面客户端",
|
||||
"platformWindows": "Windows",
|
||||
"platformMacos": "macOS",
|
||||
"platformHarmony": "鸿蒙",
|
||||
"platformLinux": "Linux",
|
||||
"noPackage": "暂无安装包",
|
||||
"loginTimeout": "登录超时,请重新登录"
|
||||
},
|
||||
"devices": {
|
||||
|
|
|
|||
|
|
@ -5,16 +5,26 @@
|
|||
}
|
||||
|
||||
.login-left {
|
||||
flex: 1.1;
|
||||
flex: 0 0 60.42%;
|
||||
background: #f9fafe;
|
||||
padding: 56px 64px;
|
||||
padding: 59px 67px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-left-bg {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 110vh;
|
||||
height: 110vw;
|
||||
transform: translate(-50%, -50%) rotate(90deg);
|
||||
background: url("/static/login/login-bg.png") center / cover no-repeat;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -35,18 +45,18 @@
|
|||
}
|
||||
|
||||
.login-hero {
|
||||
margin-top: -40px;
|
||||
margin-top: 171px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 36px;
|
||||
font-size: 50px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
line-height: 46px;
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: 16px;
|
||||
max-width: 605px;
|
||||
letter-spacing: 0;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.hero-accent {
|
||||
|
|
@ -56,9 +66,75 @@
|
|||
|
||||
.hero-desc {
|
||||
font-size: 16px;
|
||||
line-height: 1.8;
|
||||
line-height: 30px;
|
||||
color: #596275;
|
||||
max-width: 440px;
|
||||
max-width: 605px;
|
||||
}
|
||||
|
||||
.login-download {
|
||||
margin-top: 150px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.download-title {
|
||||
font-size: 21px;
|
||||
line-height: 30px;
|
||||
letter-spacing: -0.33px;
|
||||
color: #000;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.download-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.download-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 24px;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
transition: background-image 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.download-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.download-name {
|
||||
font-size: 20px;
|
||||
line-height: 30px;
|
||||
letter-spacing: -0.33px;
|
||||
color: #000;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.download-item:hover,
|
||||
.download-item.is-active {
|
||||
background-image: linear-gradient(124.68deg, #5cbbff 1.57%, #1677ff 59.96%);
|
||||
box-shadow: 0 6px 16px rgba(22, 119, 255, 0.2);
|
||||
}
|
||||
|
||||
.download-item:hover .download-name,
|
||||
.download-item.is-active .download-name {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.download-item:hover .download-icon,
|
||||
.download-item.is-active .download-icon {
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
|
||||
.download-item:focus-visible {
|
||||
outline: 2px solid #1677ff;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.login-left-footer {
|
||||
|
|
@ -66,7 +142,8 @@
|
|||
align-items: center;
|
||||
gap: 12px;
|
||||
color: #8c97a8;
|
||||
font-size: 13px;
|
||||
font-size: 14px;
|
||||
margin-top: auto;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +165,7 @@
|
|||
|
||||
.login-container {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
.login-header {
|
||||
|
|
@ -113,7 +190,8 @@
|
|||
}
|
||||
|
||||
.login-form .ant-input-affix-wrapper-lg {
|
||||
padding: 10px 16px;
|
||||
padding: 11px 16px;
|
||||
border-color: #e6e6e6;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +203,7 @@
|
|||
.captcha-image-btn {
|
||||
padding: 0;
|
||||
width: 120px;
|
||||
height: 46px;
|
||||
height: 48px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
|
|
@ -160,7 +238,7 @@
|
|||
}
|
||||
|
||||
.login-submit-btn {
|
||||
height: 48px;
|
||||
height: 50px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
border-radius: 4px;
|
||||
|
|
@ -179,12 +257,41 @@
|
|||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
@media (max-width: 1360px) {
|
||||
.download-list {
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.download-item {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.login-left {
|
||||
padding: 48px;
|
||||
}
|
||||
.hero-title {
|
||||
font-size: 36px;
|
||||
line-height: 44px;
|
||||
}
|
||||
|
||||
.login-hero {
|
||||
margin-top: 96px;
|
||||
}
|
||||
|
||||
.login-download {
|
||||
margin-top: 88px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 760px) {
|
||||
.login-hero {
|
||||
margin-top: 64px;
|
||||
}
|
||||
|
||||
.login-download {
|
||||
margin-top: 56px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,78 @@
|
|||
import { Button, Checkbox, Form, Input, Typography, message } from "antd";
|
||||
import { LockOutlined, ReloadOutlined, SafetyOutlined, UserOutlined } from "@ant-design/icons";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import {useCallback, useEffect, useMemo, useState} from "react";
|
||||
import {Link as RouterLink} from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getCurrentUser, getOpenPlatformConfig, getSystemParamValue } from "@/api";
|
||||
import { fetchCaptcha, login, type CaptchaResponse } from "@/api/auth";
|
||||
import {fetchLatestClientDownloads, type ClientLatestDownload} from "@/api/business/client";
|
||||
import type { SysPlatformConfig } from "@/types";
|
||||
import "./index.less";
|
||||
|
||||
const {Title, Text} = Typography;
|
||||
|
||||
type PlatformStyle = {
|
||||
/** 样式编码,仅用于图标与文案映射 */
|
||||
code: string;
|
||||
nameKey: string;
|
||||
icon: string;
|
||||
/** 字典项编码匹配规则,兼容各环境 WIN/WINDOWS 等写法 */
|
||||
codePattern: RegExp;
|
||||
/** 浏览器 UA 匹配规则,用于高亮当前设备对应的下载项 */
|
||||
uaPattern: RegExp;
|
||||
};
|
||||
|
||||
const PLATFORM_STYLES: PlatformStyle[] = [
|
||||
{
|
||||
code: "windows",
|
||||
nameKey: "login.platformWindows",
|
||||
icon: "/static/login/platform-windows.svg",
|
||||
codePattern: /windows|win32|win64|^win$|^pc$/i,
|
||||
uaPattern: /windows|win32|win64/i
|
||||
},
|
||||
{
|
||||
code: "macos",
|
||||
nameKey: "login.platformMacos",
|
||||
icon: "/static/login/platform-macos.svg",
|
||||
codePattern: /mac|darwin|osx/i,
|
||||
uaPattern: /macintosh|mac os x/i
|
||||
},
|
||||
{
|
||||
code: "harmonyos",
|
||||
nameKey: "login.platformHarmony",
|
||||
icon: "/static/login/platform-harmony.svg",
|
||||
codePattern: /harmony|hmos/i,
|
||||
uaPattern: /harmonyos|openharmony/i
|
||||
},
|
||||
{
|
||||
code: "linux",
|
||||
nameKey: "login.platformLinux",
|
||||
icon: "/static/login/platform-linux.svg",
|
||||
codePattern: /linux|ubuntu|debian|deepin|kylin|uos|nfs/i,
|
||||
uaPattern: /linux|ubuntu|debian|fedora/i
|
||||
}
|
||||
];
|
||||
|
||||
/** 字典未维护对应图标时的兜底图标 */
|
||||
const DEFAULT_PLATFORM_ICON = "/static/login/platform-linux.svg";
|
||||
|
||||
function platformStyleOf(platformCode?: string): PlatformStyle | undefined {
|
||||
const code = (platformCode || "").trim();
|
||||
if (!code) {
|
||||
return undefined;
|
||||
}
|
||||
return PLATFORM_STYLES.find((style) => style.codePattern.test(code));
|
||||
}
|
||||
|
||||
function detectStyleCode() {
|
||||
const source = `${navigator.userAgent} ${navigator.platform || ""}`;
|
||||
if (/android|iphone|ipad|mobile/i.test(source)) {
|
||||
return "";
|
||||
}
|
||||
const matched = PLATFORM_STYLES.find((style) => style.uaPattern.test(source));
|
||||
return matched?.code || "";
|
||||
}
|
||||
|
||||
type LoginFormValues = {
|
||||
username: string;
|
||||
password: string;
|
||||
|
|
@ -24,6 +87,9 @@ export default function Login() {
|
|||
const [captchaEnabled, setCaptchaEnabled] = useState(true);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [platformConfig, setPlatformConfig] = useState<SysPlatformConfig | null>(null);
|
||||
const [clientPackages, setClientPackages] = useState<ClientLatestDownload[]>([]);
|
||||
const [loginBgFailed, setLoginBgFailed] = useState(false);
|
||||
const [logoFailed, setLogoFailed] = useState(false);
|
||||
const [form] = Form.useForm<LoginFormValues>();
|
||||
|
||||
const loadCaptcha = useCallback(async () => {
|
||||
|
|
@ -63,6 +129,66 @@ export default function Login() {
|
|||
}
|
||||
}, [t]);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
fetchLatestClientDownloads()
|
||||
.then((list) => {
|
||||
if (active) {
|
||||
setClientPackages(list);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (active) {
|
||||
setClientPackages([]);
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const url = platformConfig?.loginBgUrl;
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
const image = new Image();
|
||||
image.onload = () => setLoginBgFailed(false);
|
||||
image.onerror = () => setLoginBgFailed(true);
|
||||
image.src = url;
|
||||
return () => {
|
||||
image.onload = null;
|
||||
image.onerror = null;
|
||||
};
|
||||
}, [platformConfig?.loginBgUrl]);
|
||||
|
||||
const activeStyleCode = useMemo(() => detectStyleCode(), []);
|
||||
|
||||
// 字典项与当前访问设备匹配时高亮对应按钮,避免用户下载错平台
|
||||
const activePlatformCode = useMemo(() => {
|
||||
if (!activeStyleCode) {
|
||||
return "";
|
||||
}
|
||||
const matched = clientPackages.find((item) => platformStyleOf(item.platformCode)?.code === activeStyleCode);
|
||||
return matched?.platformCode || "";
|
||||
}, [activeStyleCode, clientPackages]);
|
||||
|
||||
const handleDownloadClient = (item: ClientLatestDownload) => {
|
||||
const downloadUrl = item.downloadUrl;
|
||||
// 兼容未返回 hasPackage 的旧版后端:有下载地址即视为有安装包
|
||||
if (!downloadUrl || item.hasPackage === false) {
|
||||
message.warning(t("login.noPackage"));
|
||||
return;
|
||||
}
|
||||
const link = document.createElement("a");
|
||||
link.href = downloadUrl;
|
||||
link.target = "_blank";
|
||||
link.rel = "noopener noreferrer";
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
|
||||
const onFinish = async (values: LoginFormValues) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
|
@ -112,16 +238,19 @@ export default function Login() {
|
|||
}
|
||||
};
|
||||
|
||||
const loginStyle = platformConfig?.loginBgUrl
|
||||
const loginBgUrl = platformConfig?.loginBgUrl && !loginBgFailed ? platformConfig.loginBgUrl : "";
|
||||
const logoUrl = platformConfig?.logoUrl && !logoFailed ? platformConfig.logoUrl : "/logo.svg";
|
||||
|
||||
const loginStyle = loginBgUrl
|
||||
? {
|
||||
backgroundImage: `url(${platformConfig.loginBgUrl})`,
|
||||
backgroundImage: `url(${loginBgUrl})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
position: "relative" as const
|
||||
}
|
||||
: {};
|
||||
|
||||
const leftStyle = platformConfig?.loginBgUrl
|
||||
const leftStyle = loginBgUrl
|
||||
? {
|
||||
...loginStyle,
|
||||
background: "rgba(255, 255, 255, 0.2)",
|
||||
|
|
@ -129,7 +258,7 @@ export default function Login() {
|
|||
}
|
||||
: {};
|
||||
|
||||
const rightStyle = platformConfig?.loginBgUrl
|
||||
const rightStyle = loginBgUrl
|
||||
? {
|
||||
background: "rgba(255, 255, 255, 0.85)",
|
||||
backdropFilter: "blur(20px)"
|
||||
|
|
@ -139,22 +268,51 @@ export default function Login() {
|
|||
return (
|
||||
<div className="login-page" style={loginStyle}>
|
||||
<div className="login-left" style={leftStyle}>
|
||||
{!loginBgUrl ? <div className="login-left-bg" aria-hidden="true"/> : null}
|
||||
<div className="login-brand">
|
||||
<img src={platformConfig?.logoUrl || "/logo.svg"} alt="Logo" className="brand-logo-img" />
|
||||
<img
|
||||
src={logoUrl}
|
||||
alt="Logo"
|
||||
className="brand-logo-img"
|
||||
onError={() => setLogoFailed(true)}
|
||||
/>
|
||||
<span className="brand-name">{platformConfig?.projectName || "UnisBase"}</span>
|
||||
</div>
|
||||
|
||||
<div className="login-hero">
|
||||
<h1 className="hero-title">
|
||||
{t("login.heroTitle1")}
|
||||
<br />
|
||||
<span className="hero-accent">{t("login.heroTitle2")}</span>
|
||||
<br />
|
||||
{t("login.heroTitle3")}
|
||||
</h1>
|
||||
<p className="hero-desc">{platformConfig?.systemDescription || t("login.heroDesc")}</p>
|
||||
</div>
|
||||
|
||||
{clientPackages.length > 0 ? (
|
||||
<div className="login-download">
|
||||
<div className="download-title">{t("login.downloadClient")}</div>
|
||||
<div className="download-list">
|
||||
{clientPackages.map((item, index) => {
|
||||
const style = platformStyleOf(item.platformCode);
|
||||
return (
|
||||
<button
|
||||
key={item.platformCode + "-" + index}
|
||||
type="button"
|
||||
className={`download-item${item.platformCode === activePlatformCode ? " is-active" : ""}`}
|
||||
title={item.version || undefined}
|
||||
onClick={() => handleDownloadClient(item)}
|
||||
>
|
||||
<img className="download-icon" src={style?.icon || DEFAULT_PLATFORM_ICON} alt=""/>
|
||||
<span className="download-name">
|
||||
{item.platformName || (style ? t(style.nameKey) : item.platformCode)}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="login-left-footer">
|
||||
<div className="footer-item">{t("login.enterpriseSecurity")}</div>
|
||||
<div className="footer-divider" aria-hidden="true" />
|
||||
|
|
|
|||
|
|
@ -79,6 +79,15 @@ const PROVIDER_BASE_URL_MAP: Record<string, string> = {
|
|||
|
||||
const DEFAULT_LLM_TEST_MESSAGE = "请只返回固定成功结果,用于 LLM 连通性测试。";
|
||||
|
||||
/** 与后端 LlmReasoningThinkingSupport 保持一致的可选取值 */
|
||||
const REASONING_EFFORT_OPTIONS = ["minimal", "low", "medium", "high"];
|
||||
|
||||
const THINKING_MODE_OPTIONS = [
|
||||
{value: "auto", label: "跟随模型默认"},
|
||||
{value: "enabled", label: "开启思考"},
|
||||
{value: "disabled", label: "关闭思考"},
|
||||
];
|
||||
|
||||
const AiModels: React.FC = () => {
|
||||
const { message } = App.useApp();
|
||||
const [form] = Form.useForm();
|
||||
|
|
@ -199,6 +208,7 @@ const AiModels: React.FC = () => {
|
|||
form.setFieldsValue({
|
||||
...record,
|
||||
modelType: record.modelType,
|
||||
thinkingMode: record.thinkingMode || "auto",
|
||||
speakerModel: record.mediaConfig?.speakerModel,
|
||||
svThreshold: record.mediaConfig?.svThreshold,
|
||||
tencentAppId: record.mediaConfig?.tencentAppId,
|
||||
|
|
@ -222,6 +232,7 @@ const AiModels: React.FC = () => {
|
|||
sortOrder: 0,
|
||||
temperature: 0.2,
|
||||
topP: 0.9,
|
||||
thinkingMode: "auto",
|
||||
apiPath: "/v1/chat/completions",
|
||||
svThreshold: 0.45,
|
||||
});
|
||||
|
|
@ -324,6 +335,8 @@ const AiModels: React.FC = () => {
|
|||
temperature: values.temperature,
|
||||
topP: values.topP,
|
||||
max_tokens: values.max_tokens,
|
||||
reasoningEffort: values.reasoningEffort || undefined,
|
||||
thinkingMode: values.thinkingMode || undefined,
|
||||
isDefault: values.isDefaultChecked ? 1 : 0,
|
||||
status: values.statusChecked ? 1 : 0,
|
||||
sortOrder: values.sortOrder ?? 0,
|
||||
|
|
@ -349,7 +362,7 @@ const AiModels: React.FC = () => {
|
|||
const handleTestConnectivity = async () => {
|
||||
if (activeType === "LLM") {
|
||||
const values = await form.validateFields(["provider", "baseUrl", "apiPath", "modelCode", "max_tokens"]);
|
||||
const extraValues = form.getFieldsValue(["apiKey", "temperature", "topP", "max_tokens"]);
|
||||
const extraValues = form.getFieldsValue(["apiKey", "temperature", "topP", "max_tokens", "reasoningEffort", "thinkingMode"]);
|
||||
setConnectivityLoading(true);
|
||||
try {
|
||||
await testLlmModelConnectivity({
|
||||
|
|
@ -361,6 +374,8 @@ const AiModels: React.FC = () => {
|
|||
temperature: extraValues.temperature,
|
||||
topP: extraValues.topP,
|
||||
max_tokens: extraValues.max_tokens,
|
||||
reasoningEffort: extraValues.reasoningEffort,
|
||||
thinkingMode: extraValues.thinkingMode,
|
||||
testMessage: DEFAULT_LLM_TEST_MESSAGE,
|
||||
});
|
||||
message.success("LLM 连通性测试成功");
|
||||
|
|
@ -808,6 +823,38 @@ const AiModels: React.FC = () => {
|
|||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={16} className="app-responsive-form-row">
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item
|
||||
name="reasoningEffort"
|
||||
label="推理强度"
|
||||
tooltip="对应请求参数 reasoning_effort,留空则不下发"
|
||||
>
|
||||
<Select allowClear placeholder="不设置">
|
||||
{REASONING_EFFORT_OPTIONS.map((effort) => (
|
||||
<Option key={effort} value={effort}>
|
||||
{effort}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item
|
||||
name="thinkingMode"
|
||||
label="思考模式"
|
||||
tooltip="对应请求参数 enable_thinking,auto 表示跟随模型默认不下发"
|
||||
>
|
||||
<Select>
|
||||
{THINKING_MODE_OPTIONS.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue