优化
This commit is contained in:
@@ -13,7 +13,7 @@ const BASE_URL = `${API_BASE.APP_TIK}`
|
||||
* @param {number} options.agentId - 智能体ID
|
||||
* @param {string} options.userText - 用户输入文案
|
||||
* @param {number} [options.level] - 改写级别/强度
|
||||
* @param {string} [options.modelType] - 模型类型:forecast_standard/forecast_meiju
|
||||
* @param {string} [options.modelType] - 模型类型:forecast_standard/forecast_pro
|
||||
* @param {AbortController} [options.ctrl] - 取消控制器
|
||||
* @param {Function} options.onMessage - 消息回调
|
||||
* @param {Function} [options.onError] - 错误回调
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -103,6 +103,14 @@ public class DifyClient {
|
||||
requestBody.put("conversation_id", conversationId != null ? conversationId : "");
|
||||
requestBody.put("user", "user-" + System.currentTimeMillis());
|
||||
|
||||
// 调试日志:打印完整请求体
|
||||
try {
|
||||
log.info("[chatStreamWithInputs] 请求URL: {}", apiUrl);
|
||||
log.info("[chatStreamWithInputs] 请求体: {}", objectMapper.writeValueAsString(requestBody));
|
||||
} catch (Exception e) {
|
||||
log.warn("[chatStreamWithInputs] 序列化请求体失败", e);
|
||||
}
|
||||
|
||||
AtomicReference<String> responseConversationId = new AtomicReference<>(conversationId);
|
||||
StringBuilder fullContent = new StringBuilder();
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ public class DifyServiceImpl implements DifyService {
|
||||
}
|
||||
|
||||
// 2. 根据 modelType 获取对应的积分配置
|
||||
AiModelTypeEnum modelTypeEnum = "forecast_meiju".equals(reqVO.getModelType())
|
||||
? AiModelTypeEnum.FORECAST_MEIJU
|
||||
AiModelTypeEnum modelTypeEnum = "forecast_pro".equals(reqVO.getModelType())
|
||||
? AiModelTypeEnum.FORECAST_PRO
|
||||
: AiModelTypeEnum.FORECAST_STANDARD;
|
||||
AiModelConfigDO config = pointsService.getConfig(
|
||||
AiPlatformEnum.DIFY.getPlatform(),
|
||||
@@ -176,6 +176,20 @@ public class DifyServiceImpl implements DifyService {
|
||||
inputs.put("userText", reqVO.getUserText());
|
||||
inputs.put("level", reqVO.getLevel());
|
||||
|
||||
// 调试日志
|
||||
log.info("[rewriteStream] 请求参数 - agentId: {}, modelType: {}", reqVO.getAgentId(), reqVO.getModelType());
|
||||
log.info("[rewriteStream] Agent信息 - id: {}, name: {}, systemPrompt长度: {}",
|
||||
agent.getId(), agent.getAgentName(),
|
||||
agent.getSystemPrompt() != null ? agent.getSystemPrompt().length() : 0);
|
||||
log.info("[rewriteStream] inputs参数 - userText长度: {}, level: {}",
|
||||
reqVO.getUserText() != null ? reqVO.getUserText().length() : 0,
|
||||
reqVO.getLevel());
|
||||
log.info("[rewriteStream] API配置 - apiKey前缀: {}..., consumePoints: {}",
|
||||
config.getApiKey() != null && config.getApiKey().length() > 10
|
||||
? config.getApiKey().substring(0, 10) + "***"
|
||||
: "null",
|
||||
config.getConsumePoints());
|
||||
|
||||
// 6. 返回调用参数
|
||||
return new ForecastRewriteContext(inputs, config.getApiKey(), config.getConsumePoints());
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ForecastRewriteReqVO {
|
||||
@Schema(description = "改写级别/强度", example = "50")
|
||||
private Integer level = 50;
|
||||
|
||||
@Schema(description = "模型类型:forecast_standard-标准版 forecast_meiju-美剧版", example = "forecast_standard")
|
||||
@Schema(description = "模型类型:forecast_standard-标准版 forecast_pro-pro版", example = "forecast_standard")
|
||||
private String modelType = "forecast_standard";
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public enum AiModelTypeEnum implements ArrayValuable<String> {
|
||||
|
||||
// ========== Forecast 文案改写 ==========
|
||||
FORECAST_STANDARD("forecast_standard", "文案改写-标准版", AiPlatformEnum.DIFY, "text"),
|
||||
FORECAST_MEIJU("forecast_meiju", "文案改写-Pro版", AiPlatformEnum.DIFY, "text"),
|
||||
FORECAST_PRO("forecast_pro", "文案改写-Pro版", AiPlatformEnum.DIFY, "text"),
|
||||
|
||||
// ========== 数字人模型 ==========
|
||||
DIGITAL_HUMAN_LATENTSYNC("latentsync", "LatentSync", AiPlatformEnum.DIGITAL_HUMAN, "video"),
|
||||
|
||||
Reference in New Issue
Block a user