From 6f3a07ee6198208e7acad36afadd69bafb67ceb2 Mon Sep 17 00:00:00 2001
From: VLOU <919070296@qq.com>
Date: Wed, 10 Apr 2024 23:14:25 +0800
Subject: [PATCH] =?UTF-8?q?[add]=E6=B7=BB=E5=8A=A0chatchat=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/app/settings/llm/ChatChat/index.tsx | 69 +++++++++++++++++++
frontend/src/app/settings/llm/index.tsx | 2 +
frontend/src/const/settings.ts | 4 ++
.../ChatInput/ActionBar/Tools/index.tsx | 3 +
frontend/src/locales/default/setting.ts | 16 +++++
frontend/src/types/settings/modelProvider.ts | 7 ++
6 files changed, 101 insertions(+)
create mode 100644 frontend/src/app/settings/llm/ChatChat/index.tsx
diff --git a/frontend/src/app/settings/llm/ChatChat/index.tsx b/frontend/src/app/settings/llm/ChatChat/index.tsx
new file mode 100644
index 00000000..1849cd65
--- /dev/null
+++ b/frontend/src/app/settings/llm/ChatChat/index.tsx
@@ -0,0 +1,69 @@
+import { Input, Flex } from 'antd';
+import { useTheme } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+import Avatar from 'next/image';
+
+import { imageUrl } from '@/const/url';
+
+import { ModelProvider } from '@/libs/agent-runtime';
+
+import Checker from '../components/Checker';
+import ProviderConfig from '../components/ProviderConfig';
+import { LLMProviderBaseUrlKey, LLMProviderConfigKey } from '../const';
+
+const providerKey = 'chatchat';
+
+const ChatChatProvider = memo(() => {
+ const { t } = useTranslation('setting');
+ const theme = useTheme();
+
+ console.log('----ttt---1-', t('llm.ChatChat.endpoint.title'))
+ console.log('----ttt---2-', t('llm.Ollama.endpoint.title'))
+ console.log('----ttt---3-', t)
+
+ return (
+ ,
+ desc: t('llm.ChatChat.endpoint.desc'),
+ label: t('llm.ChatChat.endpoint.title'),
+ name: [LLMProviderConfigKey, providerKey, LLMProviderBaseUrlKey],
+ },
+ {
+ children: (
+
+ ),
+ desc: t('llm.ChatChat.customModelName.desc'),
+ label: t('llm.ChatChat.customModelName.title'),
+ name: [LLMProviderConfigKey, providerKey, 'customModelName'],
+ },
+ {
+ children: ,
+ desc: t('llm.ChatChat.checker.desc'),
+ label: t('llm.checker.title'),
+ minWidth: undefined,
+ },
+ ]}
+ provider={providerKey}
+ title={
+
+
+ { 'ChatChat' }
+
+ }
+ />
+ );
+});
+
+export default ChatChatProvider;
diff --git a/frontend/src/app/settings/llm/index.tsx b/frontend/src/app/settings/llm/index.tsx
index 72ba4868..c085bc39 100644
--- a/frontend/src/app/settings/llm/index.tsx
+++ b/frontend/src/app/settings/llm/index.tsx
@@ -17,6 +17,7 @@ import Ollama from './Ollama';
import OpenAI from './OpenAI';
import Perplexity from './Perplexity';
import Zhipu from './Zhipu';
+import ChatChat from './ChatChat'
export default memo<{ showOllama: boolean }>(({ showOllama }) => {
const { t } = useTranslation('setting');
@@ -34,6 +35,7 @@ export default memo<{ showOllama: boolean }>(({ showOllama }) => {
{showOllama && }
+