mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-06-16 21:03:58 +08:00
refactor(providers): rename parseTextList
This commit is contained in:
@@ -23,12 +23,14 @@ export const withoutDisableAllModelsRule = (models?: string[]) => {
|
||||
return base;
|
||||
};
|
||||
|
||||
export const parseExcludedModels = (text: string): string[] =>
|
||||
export const parseTextList = (text: string): string[] =>
|
||||
text
|
||||
.split(/[\n,]+/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
export const parseExcludedModels = parseTextList;
|
||||
|
||||
export const excludedModelsToText = (models?: string[]) =>
|
||||
Array.isArray(models) ? models.join('\n') : '';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { SecondaryScreenShell } from '@/components/common/SecondaryScreenShell';
|
||||
import { apiCallApi, getApiCallErrorMessage } from '@/services/api';
|
||||
import { useNotificationStore } from '@/stores';
|
||||
import { buildHeaderObject } from '@/utils/headers';
|
||||
import { buildClaudeMessagesEndpoint, parseExcludedModels } from '@/components/providers/utils';
|
||||
import { buildClaudeMessagesEndpoint, parseTextList } from '@/components/providers/utils';
|
||||
import type { ClaudeEditOutletContext } from './AiProvidersClaudeEditLayout';
|
||||
import styles from './AiProvidersPage.module.scss';
|
||||
import layoutStyles from './AiProvidersEditLayout.module.scss';
|
||||
@@ -544,7 +544,7 @@ export function AiProvidersClaudeEditPage() {
|
||||
placeholder={t('ai_providers.claude_cloak_sensitive_words_placeholder')}
|
||||
value={(form.cloak.sensitiveWords ?? []).join('\n')}
|
||||
onChange={(e) => {
|
||||
const nextWords = parseExcludedModels(e.target.value);
|
||||
const nextWords = parseTextList(e.target.value);
|
||||
setForm((prev) => ({
|
||||
...prev,
|
||||
cloak: {
|
||||
|
||||
Reference in New Issue
Block a user