| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.smartreview.configure;
- import lombok.Data;
- import org.springframework.boot.context.properties.ConfigurationProperties;
- import org.springframework.stereotype.Component;
- import java.util.Map;
- /**
- * DashScope配置(直接调用AI模型)
- */
- @Data
- @Component
- @ConfigurationProperties("dashscope")
- public class DashScopeConfig {
- /**
- * API密钥
- */
- private String apiKey;
- /**
- * 默认模型名称
- */
- private String model = "qwen-plus";
- /**
- * 各功能使用的模型配置
- */
- private Map<String, String> models;
- /**
- * 获取指定功能的模型名称
- */
- public String getModel(String functionKey) {
- if (models != null && models.containsKey(functionKey)) {
- String modelName = models.get(functionKey);
- if (modelName != null && !modelName.isBlank()) {
- return modelName;
- }
- }
- return model;
- }
- /**
- * 获取知识点提取模型
- */
- public String getKnowledgeExtractorModel() {
- return getModel("knowledge-extractor");
- }
- /**
- * 获取题目生成模型
- */
- public String getQuestionGeneratorModel() {
- return getModel("question-generator");
- }
- /**
- * 获取答案批改模型
- */
- public String getAnswerGraderModel() {
- return getModel("answer-grader");
- }
- /**
- * 获取复习助教模型
- */
- public String getReviewAssistantModel() {
- return getModel("review-assistant");
- }
- /**
- * 获取对话标题生成模型
- */
- public String getTitleGeneratorModel() {
- return getModel("title-generator");
- }
- }
|