移动目录

This commit is contained in:
cherishsince 2024-04-14 13:37:16 +08:00
parent 98319f68c3
commit 3c371dd4db
5 changed files with 37 additions and 37 deletions

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.ai.controller.admin;
import cn.iocoder.yudao.framework.ai.chatqianwen.QianWenChatClient;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author fansili
* @since 1.0
* @time 2024/4/13 17:44
*/
@Tag(name = "AI模块")
@RestController
@RequestMapping("/ai-api")
@Slf4j
@AllArgsConstructor
public class ChatController {
//
// @Autowired
// private QianWenChatClient qianWenChatClient;
//
// @GetMapping("/chat")
// public String chat(@RequestParam("prompt") String prompt) {
// return qianWenChatClient.call(prompt);
// }
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.ai.controller.admin.chat;
import cn.iocoder.yudao.framework.ai.chat.ChatResponse;
import cn.iocoder.yudao.framework.ai.chat.prompt.Prompt;
import cn.iocoder.yudao.framework.ai.config.AiClient;
import cn.iocoder.yudao.framework.ai.config.YudaoAiClient;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author fansili
* @since 1.0
* @time 2024/4/13 17:44
*/
@Tag(name = "AI模块")
@RestController
@RequestMapping("/admin-api/ai")
@Slf4j
@AllArgsConstructor
public class ChatController {
private final AiClient aiClient;
@PostMapping("/chat")
public CommonResult<String> chat(@RequestParam("prompt") String prompt) {
ChatResponse callRes = aiClient.call(new Prompt(prompt), "qianWen");
return CommonResult.success(callRes.getResult().getOutput().getContent());
}
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.ai.controller.app.vo;
package cn.iocoder.yudao.module.ai.controller.app.chat.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.ai.controller.app.vo;
package cn.iocoder.yudao.module.ai.controller.app.chat.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.ai.controller.app.vo;
package cn.iocoder.yudao.module.ai.controller.app.chat.vo;
import lombok.Data;
import lombok.experimental.Accessors;