leutu
2024-06-25 12aae5acd8449d896278e4274c245b4a9a69aafb
src/main/java/com/yb/controller/AiController.java
@@ -41,7 +41,7 @@
    @GetMapping("/chat")
    @Operation(summary = "大模型对话")
    public String chat(@RequestParam(value = "message",defaultValue = "Hi") String message){
        return chatModel.call("请用中文回答如下问题,如果有地名出现,回到内容包括经纬度并使用json返回,"+message);
        return chatModel.call(message);
    }
    @GetMapping("/intent")
@@ -72,21 +72,25 @@
    @GetMapping("/mix")
    @Operation(summary = "意图与大模型请求")
    public String mix(@RequestParam(value = "message",defaultValue = "Hi") String message){
        String json = okHttpUtil.postFastgpt(message);
        String json = okHttpUtil.getMessage(intent+"="+message);
        System.out.println(message);
//        JSONObject jsonObject = JSONObject.parseObject(json);
        Map<String,String> hashMap = new HashMap<>() ;
        String place = null ;
        if( json != null) {
        iteraJson(json,hashMap);
        String place = hashMap.get("place");
            place = hashMap.get("place");
        }
        if( place != null ){
            String llm = chatModel.call("请用中文回答如下问题,如果有地名出现,回到内容包括经纬度并使用json返回,"+place);
            String llm = chatModel.call(place);
           hashMap.put("content",llm);
          json =   JSON.toJSON(hashMap).toString() ;
        }else{
            json = hashMap.put("content", chatModel.call("请用中文回答如下问题,如果有地名出现,回到内容包括经纬度并使用json返回,"+message));
            json = hashMap.put("content", chatModel.call(message));
        }
        hashMap.put("code","200");
        System.out.println(JSON.toJSON(hashMap).toString());
        System.out.println("====================================");
        return JSON.toJSON(hashMap).toString() ;
@@ -98,7 +102,7 @@
    @Operation(summary = "知识库查询")
    public String fastgpt(@RequestParam(value = "message",defaultValue = "三维实景") String message){
        okHttpUtil.requesFast(message);
        //okHttpUtil.requesFast(message);
        String json = okHttpUtil.requesFast(message);
        return  json ;