tycoding 11 месяцев назад
Родитель
Сommit
4ea0e4337a

+ 1 - 1
langchat-auth/src/main/java/cn/tycoding/langchat/auth/service/GlobalExceptionTranslator.java

@@ -81,7 +81,7 @@ public class GlobalExceptionTranslator {
     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
     public R handleError(Exception e) {
         e.printStackTrace();
-        return R.fail(e);
+        return R.fail("服务器异常");
     }
 
     @ExceptionHandler({MethodArgumentTypeMismatchException.class})

+ 16 - 7
langchat-common/src/main/java/cn/tycoding/langchat/common/task/TaskManager.java

@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2024 LangChat. TyCoding All Rights Reserved.
+ *
+ * Licensed under the GNU Affero General Public License, Version 3 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.gnu.org/licenses/agpl-3.0.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package cn.tycoding.langchat.common.task;
 
 import cn.tycoding.langchat.common.threadpool.AnalysisThreadPool;
@@ -12,7 +28,6 @@ import java.util.concurrent.Future;
 
 /**
  * @author GB
- * @desc
  * @since 2024-08-22
  */
 public class TaskManager {
@@ -20,9 +35,6 @@ public class TaskManager {
 
     /**
      * 提交任务
-     *
-     * @param id
-     * @param function
      */
     public static void submitTask(String id, Callable<?> function) {
         Future<?> future = AnalysisThreadPool.getThreadPool().submit(function);
@@ -33,9 +45,6 @@ public class TaskManager {
 
     /**
      * 弹出任务
-     *
-     * @param id
-     * @return
      */
     public void popTaskResult(String id) {
         TASK_MAP.remove(id);

+ 17 - 3
langchat-common/src/main/java/cn/tycoding/langchat/common/threadpool/AnalysisThreadPool.java

@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2024 LangChat. TyCoding All Rights Reserved.
+ *
+ * Licensed under the GNU Affero General Public License, Version 3 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.gnu.org/licenses/agpl-3.0.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package cn.tycoding.langchat.common.threadpool;
 
 import java.util.concurrent.Executors;
@@ -7,12 +23,9 @@ import java.util.concurrent.TimeUnit;
 
 /**
  * @author GB
- * @desc
  * @since 2024-08-22
  */
 public class AnalysisThreadPool {
-    volatile private static ThreadPoolExecutor EXECUTOR = null;
-
     /**
      * 根据cpu 数量动态配置核心线程数和最大线程数
      */
@@ -33,6 +46,7 @@ public class AnalysisThreadPool {
      * 非核心线程存活时间1s
      */
     private static final int KEEP_ALIVE = 1;
+    volatile private static ThreadPoolExecutor EXECUTOR = null;
 
     public static ThreadPoolExecutor getThreadPool() {
         if (null == EXECUTOR) {

+ 11 - 11
langchat-ui/src/views/channel/web/components/edit.vue

@@ -15,18 +15,18 @@
   -->
 
 <script lang="ts" setup>
-import {onMounted, ref, toRaw} from 'vue';
-import SvgIcon from '@/components/SvgIcon/index.vue';
-import {isNullOrWhitespace} from '@/utils/is';
-import {add, generateKey, getById, update} from '@/api/app/appWeb';
-import {list as getModelList} from '@/api/aigc/model';
-import {useDialog, useMessage} from 'naive-ui';
-import {useRouter} from 'vue-router';
-import {copyToClip} from '@/utils/copy';
-import ModelSelect from '@/views/channel/ModelSelect.vue';
-import AppSelect from '@/views/channel/AppSelect.vue';
+  import { onMounted, ref, toRaw } from 'vue';
+  import SvgIcon from '@/components/SvgIcon/index.vue';
+  import { isNullOrWhitespace } from '@/utils/is';
+  import { add, generateKey, getById, update } from '@/api/app/appWeb';
+  import { list as getModelList } from '@/api/aigc/model';
+  import { useDialog, useMessage } from 'naive-ui';
+  import { useRouter } from 'vue-router';
+  import { copyToClip } from '@/utils/copy';
+  import ModelSelect from '@/views/channel/ModelSelect.vue';
+  import AppSelect from '@/views/channel/AppSelect.vue';
 
-const emit = defineEmits(['reload']);
+  const emit = defineEmits(['reload']);
   const formRef = ref();
   const form = ref<any>({});
   const ms = useMessage();