| | |
| | | private GenerationParam generationParam; |
| | | |
| | | private static final String apiKey = "sk-babdcf8799144134915cee2683794b2f"; |
| | | private static final String model = "qwen-plus"; |
| | | // private static final String model = "qwen-plus"; |
| | | private static final String model = "qwen3-14b-ft-202509031002-7446"; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | |
| | | List<Message> messages = getMessages(dto); |
| | | Generation gen = new Generation(); |
| | | generationParam.setMessages(messages); |
| | | generationParam.setEnableThinking( false); |
| | | FebsResponse febsResponse = new FebsResponse(); |
| | | try { |
| | | GenerationResult result = gen.call(generationParam); |
| | |
| | | generationParam.setMessages(messages); |
| | | generationParam.setResultFormat(GenerationParam.ResultFormat.MESSAGE); |
| | | generationParam.setEnableThinking( true); |
| | | generationParam.setIncrementalOutput(true); |
| | | generationParam.setIncrementalOutput( true); |
| | | Flowable<GenerationResult> result; |
| | | try { |
| | | result = gen.streamCall(generationParam); |
| | |
| | | Generation gen = new Generation(); |
| | | generationParam.setMessages(messages); |
| | | generationParam.setResultFormat(GenerationParam.ResultFormat.MESSAGE); |
| | | generationParam.setIncrementalOutput(true); |
| | | generationParam.setIncrementalOutput( true); |
| | | generationParam.setEnableThinking( false); |
| | | Flowable<GenerationResult> result; |
| | | try { |
| | | result = gen.streamCall(generationParam); |
| | |
| | | .map(message -> { |
| | | HashMap<String, String> stringStringHashMap = new HashMap<>(); |
| | | if (StrUtil.isNotEmpty(message.getOutput().getChoices().get(0).getMessage().getContent())){ |
| | | stringStringHashMap.put(LlmStrategyContextEnum.CONTENT.name(),message.getOutput().getChoices().get(0).getMessage().getContent()); |
| | | String content = message.getOutput().getChoices().get(0).getMessage().getContent(); |
| | | System.out.print( content); |
| | | stringStringHashMap.put(LlmStrategyContextEnum.CONTENT.name(),content); |
| | | } |
| | | return new FebsResponse().success().data(stringStringHashMap); |
| | | }) |