Aiproxy (#3649)
* model config * feat: model config ui * perf: rename variable * feat: custom request url * perf: model buffer * perf: init model * feat: json model config * auto login * fix: ts * update packages * package * fix: dockerfile
This commit is contained in:
@@ -8,13 +8,13 @@ import {
|
||||
MenuItem,
|
||||
MenuItemProps,
|
||||
MenuList,
|
||||
useDisclosure,
|
||||
useOutsideClick
|
||||
useDisclosure
|
||||
} from '@chakra-ui/react';
|
||||
import React, { useRef } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyTag from '../Tag/index';
|
||||
import MyIcon from '../Icon';
|
||||
import MyAvatar from '../Avatar';
|
||||
|
||||
export type SelectProps<T = any> = {
|
||||
value: T[];
|
||||
@@ -26,6 +26,7 @@ export type SelectProps<T = any> = {
|
||||
}[];
|
||||
maxH?: number;
|
||||
onSelect: (val: T[]) => void;
|
||||
closeable?: boolean;
|
||||
} & Omit<ButtonProps, 'onSelect'>;
|
||||
|
||||
const MultipleSelect = <T = any,>({
|
||||
@@ -35,6 +36,7 @@ const MultipleSelect = <T = any,>({
|
||||
width = '100%',
|
||||
maxH = 400,
|
||||
onSelect,
|
||||
closeable = false,
|
||||
...props
|
||||
}: SelectProps<T>) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -106,19 +108,24 @@ const MultipleSelect = <T = any,>({
|
||||
if (!listItem) return null;
|
||||
|
||||
return (
|
||||
<MyTag key={i} colorSchema="blue" type={'borderFill'}>
|
||||
<MyTag className="tag-icon" key={i} colorSchema="blue" type={'borderFill'}>
|
||||
{listItem.label}
|
||||
{/* <MyIcon
|
||||
name={'common/closeLight'}
|
||||
ml={1}
|
||||
w="14px"
|
||||
cursor={'pointer'}
|
||||
onClickCapture={(e) => {
|
||||
console.log(111);
|
||||
e.stopPropagation();
|
||||
onclickItem(item);
|
||||
}}
|
||||
/> */}
|
||||
{closeable && (
|
||||
<MyIcon
|
||||
name={'common/closeLight'}
|
||||
ml={1}
|
||||
w="0.8rem"
|
||||
cursor={'pointer'}
|
||||
_hover={{
|
||||
color: 'red.500'
|
||||
}}
|
||||
onClick={(e) => {
|
||||
console.log(111);
|
||||
e.stopPropagation();
|
||||
onclickItem(item);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</MyTag>
|
||||
);
|
||||
})}
|
||||
@@ -164,10 +171,11 @@ const MultipleSelect = <T = any,>({
|
||||
fontSize={'sm'}
|
||||
gap={2}
|
||||
>
|
||||
{item.icon && <MyAvatar src={item.icon} w={'1rem'} borderRadius={'0'} />}
|
||||
<Box flex={'1 0 0'}>{item.label}</Box>
|
||||
<Box w={'0.8rem'} lineHeight={1}>
|
||||
{value.includes(item.value) && <MyIcon name={'price/right'} w={'1rem'} />}
|
||||
</Box>
|
||||
<Box>{item.label}</Box>
|
||||
</MenuItem>
|
||||
))}
|
||||
</MenuList>
|
||||
|
||||
@@ -4,12 +4,60 @@
|
||||
"api_key": "API key",
|
||||
"bills_and_invoices": "Bills",
|
||||
"channel": "Channel",
|
||||
"config_model": "Model configuration",
|
||||
"confirm_logout": "Confirm to log out?",
|
||||
"create_channel": "Add new channel",
|
||||
"create_model": "Add new model",
|
||||
"custom_model": "custom model",
|
||||
"default_model": "Default model",
|
||||
"logout": "Sign out",
|
||||
"model.active": "Active",
|
||||
"model.alias": "Alias",
|
||||
"model.alias_tip": "The name of the model displayed in the system is convenient for users to understand.",
|
||||
"model.censor": "Censor check",
|
||||
"model.censor_tip": "If sensitive verification is required, turn on this switch",
|
||||
"model.charsPointsPrice": "Chars Price",
|
||||
"model.charsPointsPrice_tip": "Combine the model input and output for Token billing. If the language model is configured with input and output billing separately, the input and output will be calculated separately.",
|
||||
"model.custom_cq_prompt": "Custom question classification prompt words",
|
||||
"model.custom_cq_prompt_tip": "Override the system's default question classification prompt words, which default to:\n\"\"\"\n请帮我执行一个“问题分类”任务,将问题分类为以下几种类型之一:\n\n\"\"\"\n{{typeList}}\n\"\"\"\n\n## 背景知识\n{{systemPrompt}}\n\n## 对话记录\n{{history}}\n\n## 开始任务\n\n现在,我们开始分类,我会给你一个\"问题\",请结合背景知识和对话记录,将问题分类到对应的类型中,并返回类型ID。\n\n问题:\"{{question}}\"\n类型ID=\n\"\"\"",
|
||||
"model.custom_extract_prompt": "Custom content extraction prompt words",
|
||||
"model.custom_extract_prompt_tip": "Override system prompt word, default is:\n\"\"\"\n你可以从 <对话记录></对话记录> 中提取指定 Json 信息,你仅需返回 Json 字符串,无需回答问题。\n<提取要求>\n{{description}}\n</提取要求>\n\n<提取规则>\n- 本次需提取的 json 字符串,需符合 JsonSchema 的规则。\n- type 代表数据类型; key 代表字段名; description 代表字段的描述; enum 是枚举值,代表可选的 value。\n- 如果没有可提取的内容,忽略该字段。\n</提取规则>\n\n<JsonSchema>\n{{json}}\n</JsonSchema>\n\n<对话记录>\n{{text}}\n</对话记录>\n\n提取的 json 字符串:\n\"\"\"",
|
||||
"model.dataset_process": "Dataset file parse",
|
||||
"model.default_config": "Body extra fields",
|
||||
"model.default_config_tip": "When initiating a conversation request, merge this configuration. \nFor example:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
|
||||
"model.default_system_chat_prompt": "Default prompt",
|
||||
"model.default_system_chat_prompt_tip": "When the model talks, it will carry this default prompt word.",
|
||||
"model.default_token": "Default tokens",
|
||||
"model.default_token_tip": "The length of the default text block of the index model must be less than the maximum length above",
|
||||
"model.delete_model_confirm": "Confirm to delete this model?",
|
||||
"model.edit_model": "Model parameter editing",
|
||||
"model.function_call": "Function Call",
|
||||
"model.function_call_tip": "If the model supports function calling, turn on this switch. \nTool calls have higher priority.",
|
||||
"model.input_price": "Input price",
|
||||
"model.input_price_tip": "Language model input price. If this item is configured, the model comprehensive price will be invalid.",
|
||||
"model.json_config": "File config",
|
||||
"model.json_config_confirm": "Confirm to use this configuration for override?",
|
||||
"model.json_config_tip": "Configure the model through the configuration file. After clicking Confirm, the entered configuration will be used for full coverage. Please ensure that the configuration file is entered correctly. \nIt is recommended to copy the current configuration file for backup before operation.",
|
||||
"model.max_quote": "KB max quote",
|
||||
"model.max_temperature": "Max temperature",
|
||||
"model.model_id": "Model ID",
|
||||
"model.model_id_tip": "The unique identifier of the model, that is, the value of the actual request to the service provider model, needs to correspond to the model in the OneAPI channel.",
|
||||
"model.output_price": "Output price",
|
||||
"model.output_price_tip": "The language model output price. If this item is configured, the model comprehensive price will be invalid.",
|
||||
"model.param_name": "Parameter name",
|
||||
"model.request_auth": "Custom token",
|
||||
"model.request_auth_tip": "When making a request to a custom request address, carry the request header: Authorization: Bearer xxx to make the request.",
|
||||
"model.request_url": "Custom url",
|
||||
"model.request_url_tip": "If this value is filled in, a request will be made directly to this address without going through OneAPI",
|
||||
"model.tool_choice": "Tool choice",
|
||||
"model.tool_choice_tip": "If the model supports tool calling, turn on this switch",
|
||||
"model.used_in_classify": "Used for problem classification",
|
||||
"model.used_in_extract_fields": "for text extraction",
|
||||
"model.used_in_tool_call": "Used for tool call nodes",
|
||||
"model.vision": "Vision model",
|
||||
"model.vision_tip": "If the model supports image recognition, turn on this switch.",
|
||||
"model.voices": "voice role",
|
||||
"model.voices_tip": "Configure multiple through an array, for example:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
|
||||
"model_provider": "Model Provider",
|
||||
"notifications": "Notify",
|
||||
"personal_information": "Personal",
|
||||
|
||||
@@ -922,6 +922,7 @@
|
||||
"model.search_name_placeholder": "Search by model name",
|
||||
"model.type.chat": "language model",
|
||||
"model.type.embedding": "Embedding",
|
||||
"model.type.reRank": "ReRank",
|
||||
"model.type.stt": "speech recognition",
|
||||
"model.type.tts": "TTS",
|
||||
"model_alicloud": "Ali Cloud",
|
||||
|
||||
@@ -4,12 +4,61 @@
|
||||
"api_key": "API 密钥",
|
||||
"bills_and_invoices": "账单与发票",
|
||||
"channel": "渠道",
|
||||
"config_model": "模型配置",
|
||||
"confirm_logout": "确认退出登录?",
|
||||
"create_channel": "新增渠道",
|
||||
"create_model": "新增模型",
|
||||
"custom_model": "自定义模型",
|
||||
"default_model": "预设模型",
|
||||
"logout": "登出",
|
||||
"model.active": "启用",
|
||||
"model.alias": "别名",
|
||||
"model.alias_tip": "模型在系统中展示的名字,方便用户理解",
|
||||
"model.censor": "启用敏感校验",
|
||||
"model.censor_tip": "如果需要进行敏感校验,则开启该开关",
|
||||
"model.charsPointsPrice": "模型综合价格",
|
||||
"model.charsPointsPrice_tip": "将模型输入和输出合并起来进行 Token 计费,语言模型如果单独配置了输入和输出计费,则按输入和输出分别计算",
|
||||
"model.custom_cq_prompt": "自定义问题分类提示词",
|
||||
"model.custom_cq_prompt_tip": "覆盖系统默认的问题分类提示词,默认为:\n",
|
||||
"model.custom_extract_prompt": "自定义内容提取提示词",
|
||||
"model.custom_extract_prompt_tip": "覆盖系统的提示词,默认为:\n\"\"\"\n你可以从 <对话记录></对话记录> 中提取指定 Json 信息,你仅需返回 Json 字符串,无需回答问题。\n<提取要求>\n{{description}}\n</提取要求>\n\n<提取规则>\n- 本次需提取的 json 字符串,需符合 JsonSchema 的规则。\n- type 代表数据类型; key 代表字段名; description 代表字段的描述; enum 是枚举值,代表可选的 value。\n- 如果没有可提取的内容,忽略该字段。\n</提取规则>\n\n<JsonSchema>\n{{json}}\n</JsonSchema>\n\n<对话记录>\n{{text}}\n</对话记录>\n\n提取的 json 字符串:\n\"\"\"",
|
||||
"model.dataset_process": "用于知识库文件处理",
|
||||
"model.default_config": "Body 额外字段",
|
||||
"model.default_config_tip": "发起对话请求时候,合并该配置。例如:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
|
||||
"model.default_system_chat_prompt": "默认提示词",
|
||||
"model.default_system_chat_prompt_tip": "模型对话时,都会携带该默认提示词",
|
||||
"model.default_token": "默认分块长度",
|
||||
"model.default_token_tip": "索引模型默认文本分块的长度,必须小于最大上文",
|
||||
"model.delete_model_confirm": "确认删除该模型?",
|
||||
"model.edit_model": "模型参数编辑",
|
||||
"model.function_call": "支持函数调用",
|
||||
"model.function_call_tip": "如果模型支持函数调用,则开启该开关。工具调用优先级更高。",
|
||||
"model.input_price": "模型输入价格",
|
||||
"model.input_price_tip": "语言模型输入价格,如果配置了该项,则模型综合价格会失效",
|
||||
"model.json_config": "配置文件",
|
||||
"model.json_config_confirm": "确认使用该配置进行覆盖?",
|
||||
"model.json_config_tip": "通过配置文件配置模型,点击确认后,会使用输入的配置进行全量覆盖,请确保配置文件输入正确。建议操作前,复制当前配置文件进行备份。",
|
||||
"model.max_quote": "知识库最大引用",
|
||||
"model.max_temperature": "最大温度",
|
||||
"model.model_id": "模型ID",
|
||||
"model.model_id_tip": "模型的唯一标识,也就是实际请求到服务商model 的值,需要与 OneAPI 渠道中的模型对应。",
|
||||
"model.output_price": "模型输出价格",
|
||||
"model.output_price_tip": "语言模型输出价格,如果配置了该项,则模型综合价格会失效",
|
||||
"model.param_name": "参数名",
|
||||
"model.request_auth": "自定义请求 Tokens",
|
||||
"model.request_auth_tip": "向自定义请求地址发起请求时候,携带请求头:Authorization: Bearer xxx 进行请求",
|
||||
"model.request_url": "自定义请求地址",
|
||||
"model.request_url_tip": "如果填写该值,则会直接向该地址发起请求,不经过 OneAPI",
|
||||
"model.tool_choice": "支持工具调用",
|
||||
"model.tool_choice_tip": "如果该模型支持工具调用,则开启该开关",
|
||||
"model.used_in_classify": "用于问题分类",
|
||||
"model.used_in_extract_fields": "用于文本提取",
|
||||
"model.used_in_query_extension": "用于问题优化",
|
||||
"model.used_in_tool_call": "用于工具调用节点",
|
||||
"model.vision": "支持图片识别",
|
||||
"model.vision_tip": "如果模型支持图片识别,则打开该开关。",
|
||||
"model.voices": "声音角色",
|
||||
"model.voices_tip": "通过一个数组配置多个,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
|
||||
"model_provider": "模型提供商",
|
||||
"notifications": "通知",
|
||||
"personal_information": "个人信息",
|
||||
|
||||
@@ -925,6 +925,7 @@
|
||||
"model.search_name_placeholder": "根据模型名搜索",
|
||||
"model.type.chat": "语言模型",
|
||||
"model.type.embedding": "索引模型",
|
||||
"model.type.reRank": "重排模型",
|
||||
"model.type.stt": "语音识别",
|
||||
"model.type.tts": "语音合成",
|
||||
"model_alicloud": "阿里云",
|
||||
|
||||
@@ -4,12 +4,59 @@
|
||||
"api_key": "API 金鑰",
|
||||
"bills_and_invoices": "帳單與發票",
|
||||
"channel": "頻道",
|
||||
"config_model": "模型配置",
|
||||
"confirm_logout": "確認登出登入?",
|
||||
"create_channel": "新增頻道",
|
||||
"create_model": "新增模型",
|
||||
"custom_model": "自訂模型",
|
||||
"default_model": "預設模型",
|
||||
"logout": "登出",
|
||||
"model.active": "啟用",
|
||||
"model.alias": "別名",
|
||||
"model.alias_tip": "模型在系統中展示的名字,方便使用者理解",
|
||||
"model.censor_tip": "如果需要進行敏感校驗,則開啟該開關",
|
||||
"model.charsPointsPrice": "模型綜合價格",
|
||||
"model.charsPointsPrice_tip": "將模型輸入和輸出合併起來進行 Token 計費,語言模型如果單獨配置了輸入和輸出計費,則按輸入和輸出分別計算",
|
||||
"model.custom_cq_prompt": "自訂問題分類提示詞",
|
||||
"model.custom_cq_prompt_tip": "覆蓋系統預設的問題分類提示詞,預設為:\n\"\"\"\n请帮我执行一个“问题分类”任务,将问题分类为以下几种类型之一:\n\n\"\"\"\n{{typeList}}\n\"\"\"\n\n## 背景知识\n{{systemPrompt}}\n\n## 对话记录\n{{history}}\n\n## 开始任务\n\n现在,我们开始分类,我会给你一个\"问题\",请结合背景知识和对话记录,将问题分类到对应的类型中,并返回类型ID。\n\n问题:\"{{question}}\"\n类型ID=\n\"\"\"",
|
||||
"model.custom_extract_prompt": "自訂內容提取提示詞",
|
||||
"model.custom_extract_prompt_tip": "覆蓋系統的提示詞,預設為:\n\"\"\"\n你可以从 <对话记录></对话记录> 中提取指定 Json 信息,你仅需返回 Json 字符串,无需回答问题。\n<提取要求>\n{{description}}\n</提取要求>\n\n<提取规则>\n- 本次需提取的 json 字符串,需符合 JsonSchema 的规则。\n- type 代表数据类型; key 代表字段名; description 代表字段的描述; enum 是枚举值,代表可选的 value。\n- 如果没有可提取的内容,忽略该字段。\n</提取规则>\n\n<JsonSchema>\n{{json}}\n</JsonSchema>\n\n<对话记录>\n{{text}}\n</对话记录>\n\n提取的 json 字符串:\n\"\"\"",
|
||||
"model.dataset_process": "用於知識庫文件處理",
|
||||
"model.default_config": "Body 額外字段",
|
||||
"model.default_config_tip": "發起對話請求時候,合併該配置。例如:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
|
||||
"model.default_system_chat_prompt": "預設提示詞",
|
||||
"model.default_system_chat_prompt_tip": "模型對話時,都會攜帶該預設提示詞",
|
||||
"model.default_token": "預設分塊長度",
|
||||
"model.default_token_tip": "索引模型預設文字分塊的長度,必須小於最大上文",
|
||||
"model.delete_model_confirm": "確認刪除該模型?",
|
||||
"model.edit_model": "模型參數編輯",
|
||||
"model.function_call": "支援函數調用",
|
||||
"model.function_call_tip": "如果模型支援函數調用,則開啟該開關。\n工具呼叫優先權更高。",
|
||||
"model.input_price": "模型輸入價格",
|
||||
"model.input_price_tip": "語言模型輸入價格,如果配置了該項,則模型綜合價格會失效",
|
||||
"model.json_config": "設定檔",
|
||||
"model.json_config_confirm": "確認使用該配置進行覆蓋?",
|
||||
"model.json_config_tip": "透過設定檔設定模型,點選確認後,會使用輸入的配置進行全量覆蓋,請確保設定檔輸入正確。\n建議操作前,複製目前設定檔進行備份。",
|
||||
"model.max_quote": "知識庫最大引用",
|
||||
"model.max_temperature": "最大溫度",
|
||||
"model.model_id": "模型ID",
|
||||
"model.model_id_tip": "模型的唯一標識,也就是實際請求到服務商model 的值,需要與 OneAPI 頻道中的模型對應。",
|
||||
"model.output_price": "模型輸出價格",
|
||||
"model.output_price_tip": "語言模型輸出價格,如果配置了該項,則模型綜合價格會失效",
|
||||
"model.param_name": "參數名",
|
||||
"model.request_auth": "自訂請求 Tokens",
|
||||
"model.request_auth_tip": "向自訂請求地址發起請求時候,攜帶請求頭:Authorization: Bearer xxx 進行請求",
|
||||
"model.request_url": "自訂請求地址",
|
||||
"model.request_url_tip": "如果填入該值,則會直接向該位址發起請求,不經過 OneAPI",
|
||||
"model.tool_choice": "支援工具調用",
|
||||
"model.tool_choice_tip": "如果該模型支援工具調用,則開啟該開關",
|
||||
"model.used_in_classify": "用於問題分類",
|
||||
"model.used_in_extract_fields": "用於文字擷取",
|
||||
"model.used_in_tool_call": "用於工具呼叫節點",
|
||||
"model.vision": "支援圖片識別",
|
||||
"model.vision_tip": "如果模型支援圖片識別,則開啟該開關。",
|
||||
"model.voices": "聲音角色",
|
||||
"model.voices_tip": "透過一個數組配置多個,例如:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
|
||||
"model_provider": "模型提供者",
|
||||
"notifications": "通知",
|
||||
"personal_information": "個人資訊",
|
||||
|
||||
@@ -922,6 +922,7 @@
|
||||
"model.provider": "模型提供者",
|
||||
"model.search_name_placeholder": "根據模型名搜尋",
|
||||
"model.type.chat": "語言模型",
|
||||
"model.type.reRank": "重排模型",
|
||||
"model.type.stt": "語音辨識",
|
||||
"model.type.tts": "語音合成",
|
||||
"model_alicloud": "阿里雲",
|
||||
|
||||
@@ -25,7 +25,7 @@ const { definePartsStyle: tablePart, defineMultiStyleConfig: tableMultiStyle } =
|
||||
const { definePartsStyle: radioParts, defineMultiStyleConfig: radioStyle } =
|
||||
createMultiStyleConfigHelpers(radioAnatomy.keys);
|
||||
|
||||
const shadowLight = '0px 0px 0px 2.4px rgba(51, 112, 255, 0.15)';
|
||||
export const shadowLight = '0px 0px 0px 2.4px rgba(51, 112, 255, 0.15)';
|
||||
|
||||
// 按键
|
||||
const Button = defineStyleConfig({
|
||||
|
||||
Reference in New Issue
Block a user