feat(integrations): поле «Прокси» в форме интеграции (frontend)

- model.ts: config.proxyUrl в типе Integration.
- IntegrationForm.tsx: стейт proxyUrl, поле «Прокси» (placeholder
  http://user:pass@host:port) для всех провайдеров кроме WEB (виджет клиентский),
  proxyUrl в payload create/update.
This commit is contained in:
Andrey committed 2026-07-10 03:54:52 +03:00
1 parent 4f12d050ab
commit bf34db377d
2 files changed
+6 -2

No files matched your search

@@ -18,6 +18,7 @@ export function IntegrationForm({ initial, onClose, onSaved }: { initial: Integr
const [secret, setSecret] = useState("");
const [baseUrl, setBaseUrl] = useState(initial?.config.baseUrl ?? "");
const [defaultModel, setDefaultModel] = useState(initial?.config.defaultModel ?? "");
const [proxyUrl, setProxyUrl] = useState(initial?.config.proxyUrl ?? "");
const [channelId, setChannelId] = useState(initial?.channel ? String(initial.channel.id) : "");
const [channels, setChannels] = useState<ChannelOption[]>([]);
const [submitting, setSubmitting] = useState(false);
@@ -49,7 +50,7 @@ export function IntegrationForm({ initial, onClose, onSaved }: { initial: Integr
if (!ready) return;
setSubmitting(true);
setError(null);
const config = { baseUrl: baseUrl.trim(), defaultModel: defaultModel.trim() };
const config = { baseUrl: baseUrl.trim(), defaultModel: defaultModel.trim(), proxyUrl: proxyUrl.trim() };
const channel = isMessenger ? { channelId: channelId ? Number(channelId) : null } : {};
try {
if (isEdit) {
@@ -90,6 +91,9 @@ export function IntegrationForm({ initial, onClose, onSaved }: { initial: Integr
/>
)}
<FormField label="Base URL" value={baseUrl} onChange={setBaseUrl} placeholder={meta.defaultBaseUrl || "—"} />
{!isWeb && (
<FormField label="Прокси" value={proxyUrl} onChange={setProxyUrl} placeholder="http://user:pass@host:port — пусто, если без прокси" />
)}
{meta.hasModel && (
<FormField label="Модель по умолчанию" value={defaultModel} onChange={setDefaultModel} placeholder="anthropic/claude-sonnet-4.6" />
)}
@@ -10,7 +10,7 @@ export type Integration = {
provider: IntegrationProvider;
name: string;
hasSecret: boolean;
config: { baseUrl: string; defaultModel: string; botId: string; botUsername: string; botName: string };
config: { baseUrl: string; defaultModel: string; proxyUrl: string; botId: string; botUsername: string; botName: string };
channel: { id: number; code: string; name: string } | null;
status: IntegrationStatus;
lastCheckedAt: string | null;