feat: implement BYOK (Bring Your Own Key) feature for AI providers (#4727)
* feat: implement BYOK (Bring Your Own Key) feature for AI providers - Added BYOK section in AI settings to manage custom API keys. - Introduced components for adding, editing, and deleting BYOK providers. - Updated translations for BYOK-related UI elements. - Modified existing components to support new BYOK functionality. Signed-off-by: Innei <tukon479@gmail.com> * feat: enhance BYOK provider support and update UI elements - Added support for the "OpenRouter" BYOK provider in relevant components. - Updated translations for security-related UI elements to reflect new descriptions. - Adjusted styling in settings components for improved visual consistency. Signed-off-by: Innei <tukon479@gmail.com> * feat: refine BYOK provider management and enhance UI - Introduced a new constants file for BYOK provider options. - Updated the ByokProviderModalContent to filter available providers based on configured ones. - Enhanced the ByokSection to manage provider addition and editing more effectively. - Adjusted table styling in the PlanComparisonTable for improved readability. - Added new translation keys for "AI Bring Your Own Key" in multiple languages. Signed-off-by: Innei <tukon479@gmail.com> --------- Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -352,7 +352,7 @@ export const ScheduleConfig = memo<ScheduleConfigProps>(
|
||||
<SelectTrigger className="h-6 justify-between rounded-[4px] border-0 bg-material-opaque px-1.5 py-0 text-xs hover:bg-mix-accent/background-1/4">
|
||||
<SelectValue placeholder={t("schedule.day_placeholder")} />
|
||||
</SelectTrigger>
|
||||
<SelectContent position="item-aligned">
|
||||
<SelectContent>
|
||||
{dayOfWeekOptions.map((option) => (
|
||||
<SelectItem key={option.value} value={option.value}>
|
||||
{t(option.label)}
|
||||
@@ -409,7 +409,7 @@ export const ScheduleConfig = memo<ScheduleConfigProps>(
|
||||
<SelectTrigger className="h-6 justify-between rounded-[4px] border-0 bg-material-opaque px-1.5 py-0 text-xs hover:bg-mix-accent/background-1/4">
|
||||
<SelectValue placeholder={t("schedule.day_placeholder")} />
|
||||
</SelectTrigger>
|
||||
<SelectContent position="item-aligned">
|
||||
<SelectContent>
|
||||
{dayOfMonthOptions.map((option) => (
|
||||
<SelectItem key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
|
||||
@@ -64,7 +64,7 @@ export const SettingSectionTitle: FC<{
|
||||
data-setting-section={sectionId}
|
||||
data-highlighted={isHighlighted ? "true" : undefined}
|
||||
className={cn(
|
||||
"relative shrink-0 text-headline font-bold text-text/80 first:mt-0",
|
||||
"relative shrink-0 text-headline font-bold text-text/60 first:mt-0",
|
||||
margin === "compact" ? "mb-2 mt-8" : "mb-4 mt-10",
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { setAISetting, useAISettingValue } from "~/atoms/settings/ai"
|
||||
|
||||
import { createDefineSettingItem } from "../helper/builder"
|
||||
import { createSettingBuilder } from "../helper/setting-builder"
|
||||
import { ByokSection } from "./ai/byok"
|
||||
import { MCPServicesSection } from "./ai/mcp/MCPServicesSection"
|
||||
import { UserMemorySection } from "./ai/memory"
|
||||
import { PanelStyleSection } from "./ai/PanelStyleSection"
|
||||
@@ -76,6 +77,12 @@ export const SettingAI = () => {
|
||||
},
|
||||
MCPServicesSection,
|
||||
|
||||
{
|
||||
type: "title",
|
||||
value: t("byok.title"),
|
||||
},
|
||||
ByokSection,
|
||||
|
||||
{
|
||||
type: "title",
|
||||
value: t("usage_analysis.title"),
|
||||
@@ -96,12 +103,10 @@ const AISecurityDisclosureSection = () => {
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<i className="i-mgc-safety-certificate-cute-re size-4 text-green" />
|
||||
<Label className="text-sm font-medium text-text">
|
||||
{t("integration.mcp.security.title")}
|
||||
</Label>
|
||||
<Label className="text-sm font-medium text-text">{t("integration.security.title")}</Label>
|
||||
</div>
|
||||
<p className="text-xs leading-relaxed text-text-secondary">
|
||||
{t("integration.mcp.security.description")}
|
||||
{t("integration.security.description")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.jsx"
|
||||
import type { UserByokProviderConfig } from "@follow/shared/settings/interface"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
interface ByokProviderItemProps {
|
||||
provider: UserByokProviderConfig
|
||||
onDelete: () => void
|
||||
onEdit: () => void
|
||||
}
|
||||
|
||||
const PROVIDER_LABELS: Record<string, string> = {
|
||||
openai: "OpenAI",
|
||||
google: "Google",
|
||||
"vercel-ai-gateway": "Vercel AI Gateway",
|
||||
openrouter: "OpenRouter",
|
||||
}
|
||||
|
||||
export const ByokProviderItem = ({ provider, onEdit, onDelete }: ByokProviderItemProps) => {
|
||||
const { t } = useTranslation("ai")
|
||||
|
||||
const providerLabel = PROVIDER_LABELS[provider.provider] || provider.provider
|
||||
|
||||
return (
|
||||
<div className="group -ml-3 rounded-lg border border-border p-3 transition-colors hover:bg-material-medium">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<h4 className="text-sm font-medium text-text">{providerLabel}</h4>
|
||||
<span className="inline-flex rounded-full bg-accent/10 px-2 py-1 text-xs text-accent">
|
||||
{t("byok.providers.configured")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="ml-4 flex items-center gap-1 opacity-60 transition-opacity group-hover:opacity-100">
|
||||
<Tooltip delayDuration={300}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="ghost" size="sm" onClick={onEdit}>
|
||||
<i className="i-mgc-edit-cute-re size-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("byok.providers.edit")}</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip delayDuration={300}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="ghost" size="sm" onClick={onDelete}>
|
||||
<i className="i-mgc-delete-2-cute-re size-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("byok.providers.delete")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { Label } from "@follow/components/ui/label/index.jsx"
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@follow/components/ui/select/index.js"
|
||||
import type { ByokProviderName, UserByokProviderConfig } from "@follow/shared/settings/interface"
|
||||
import { useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { PROVIDER_OPTIONS } from "./constants"
|
||||
|
||||
interface ByokProviderModalContentProps {
|
||||
provider: UserByokProviderConfig | null
|
||||
configuredProviders?: ByokProviderName[]
|
||||
onSave: (provider: UserByokProviderConfig) => void
|
||||
onCancel: () => void
|
||||
}
|
||||
|
||||
const EMPTY_CONFIGURED_PROVIDERS: ByokProviderName[] = []
|
||||
|
||||
export const ByokProviderModalContent = ({
|
||||
provider,
|
||||
configuredProviders = EMPTY_CONFIGURED_PROVIDERS,
|
||||
onSave,
|
||||
onCancel,
|
||||
}: ByokProviderModalContentProps) => {
|
||||
const { t } = useTranslation("ai")
|
||||
|
||||
// Filter out already configured providers, but keep the current one if editing
|
||||
const availableProviders = PROVIDER_OPTIONS.filter(
|
||||
(option) => !configuredProviders.includes(option.value) || option.value === provider?.provider,
|
||||
)
|
||||
|
||||
// Get the first available provider or fallback to the current one
|
||||
const defaultProvider = availableProviders[0]?.value ?? provider?.provider ?? "openai"
|
||||
|
||||
const [formData, setFormData] = useState<UserByokProviderConfig>({
|
||||
provider: provider?.provider ?? defaultProvider,
|
||||
baseURL: provider?.baseURL ?? null,
|
||||
apiKey: provider?.apiKey ?? null,
|
||||
headers: provider?.headers ?? {},
|
||||
})
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
if (!formData.provider) {
|
||||
return
|
||||
}
|
||||
onSave(formData)
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="min-w-[40ch] space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="provider">{t("byok.providers.form.provider")}</Label>
|
||||
<Select
|
||||
value={formData.provider}
|
||||
disabled={availableProviders.length === 0}
|
||||
onValueChange={(value) =>
|
||||
setFormData({ ...formData, provider: value as ByokProviderName })
|
||||
}
|
||||
>
|
||||
<SelectTrigger id="provider">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{availableProviders.map((option) => (
|
||||
<SelectItem key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="baseURL">{t("byok.providers.form.base_url")}</Label>
|
||||
<Input
|
||||
id="baseURL"
|
||||
type="url"
|
||||
placeholder={t("byok.providers.form.base_url_placeholder")}
|
||||
value={formData.baseURL ?? ""}
|
||||
onChange={(e) =>
|
||||
setFormData({
|
||||
...formData,
|
||||
baseURL: e.target.value || null,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<p className="text-xs text-text-secondary">{t("byok.providers.form.base_url_help")}</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="apiKey">{t("byok.providers.form.api_key")}</Label>
|
||||
<Input
|
||||
id="apiKey"
|
||||
type="password"
|
||||
placeholder={t("byok.providers.form.api_key_placeholder")}
|
||||
value={formData.apiKey ?? ""}
|
||||
onChange={(e) =>
|
||||
setFormData({
|
||||
...formData,
|
||||
apiKey: e.target.value || null,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<p className="text-xs text-text-secondary">{t("byok.providers.form.api_key_help")}</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button type="button" variant="ghost" onClick={onCancel}>
|
||||
{t("words.cancel", { ns: "common" })}
|
||||
</Button>
|
||||
<Button type="submit">{t("words.save", { ns: "common" })}</Button>
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { Label } from "@follow/components/ui/label/index.jsx"
|
||||
import { Switch } from "@follow/components/ui/switch/index.jsx"
|
||||
import type { UserByokProviderConfig } from "@follow/shared/settings/interface"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { toast } from "sonner"
|
||||
|
||||
import { getAISettings, setAISetting, useAISettingValue } from "~/atoms/settings/ai"
|
||||
import { useDialog, useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
|
||||
import { ByokProviderItem } from "./ByokProviderItem"
|
||||
import { ByokProviderModalContent } from "./ByokProviderModalContent"
|
||||
import { PROVIDER_OPTIONS } from "./constants"
|
||||
|
||||
export const ByokSection = () => {
|
||||
const { t } = useTranslation("ai")
|
||||
const aiSettings = useAISettingValue()
|
||||
const byok = aiSettings.byok ?? { enabled: false, providers: [] }
|
||||
const { present } = useModalStack()
|
||||
const { ask } = useDialog()
|
||||
|
||||
const handleToggleEnabled = (enabled: boolean) => {
|
||||
setAISetting("byok", {
|
||||
...byok,
|
||||
enabled,
|
||||
})
|
||||
}
|
||||
|
||||
const handleAddProvider = () => {
|
||||
const currentByok = getAISettings().byok ?? { enabled: false, providers: [] }
|
||||
const configuredProviders = currentByok.providers.map((p) => p.provider)
|
||||
|
||||
present({
|
||||
title: t("byok.providers.add_title"),
|
||||
content: ({ dismiss }: { dismiss: () => void }) => (
|
||||
<ByokProviderModalContent
|
||||
provider={null}
|
||||
configuredProviders={configuredProviders}
|
||||
onSave={(provider) => {
|
||||
const updatedByok = getAISettings().byok ?? { enabled: false, providers: [] }
|
||||
setAISetting("byok", {
|
||||
...updatedByok,
|
||||
providers: [...updatedByok.providers, provider],
|
||||
})
|
||||
toast.success(t("byok.providers.added"))
|
||||
dismiss()
|
||||
}}
|
||||
onCancel={dismiss}
|
||||
/>
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
const handleEditProvider = (index: number, provider: UserByokProviderConfig) => {
|
||||
const currentByok = getAISettings().byok ?? { enabled: false, providers: [] }
|
||||
// Exclude the current provider being edited from configured list
|
||||
const configuredProviders = currentByok.providers
|
||||
.filter((_, i) => i !== index)
|
||||
.map((p) => p.provider)
|
||||
|
||||
present({
|
||||
title: t("byok.providers.edit_title"),
|
||||
content: ({ dismiss }: { dismiss: () => void }) => (
|
||||
<ByokProviderModalContent
|
||||
provider={provider}
|
||||
configuredProviders={configuredProviders}
|
||||
onSave={(updatedProvider) => {
|
||||
const updatedByok = getAISettings().byok ?? { enabled: false, providers: [] }
|
||||
const updatedProviders = [...updatedByok.providers]
|
||||
updatedProviders[index] = updatedProvider
|
||||
setAISetting("byok", {
|
||||
...updatedByok,
|
||||
providers: updatedProviders,
|
||||
})
|
||||
toast.success(t("byok.providers.updated"))
|
||||
dismiss()
|
||||
}}
|
||||
onCancel={dismiss}
|
||||
/>
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
const handleDeleteProvider = async (index: number) => {
|
||||
const confirmed = await ask({
|
||||
title: t("byok.providers.delete_title"),
|
||||
message: t("byok.providers.delete_message"),
|
||||
confirmText: t("words.delete", { ns: "common" }),
|
||||
cancelText: t("words.cancel", { ns: "common" }),
|
||||
variant: "danger",
|
||||
})
|
||||
|
||||
if (confirmed) {
|
||||
const currentByok = getAISettings().byok ?? { enabled: false, providers: [] }
|
||||
const updatedProviders = currentByok.providers.filter((_, i) => i !== index)
|
||||
setAISetting("byok", {
|
||||
...currentByok,
|
||||
providers: updatedProviders,
|
||||
})
|
||||
toast.success(t("byok.providers.deleted"))
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-1">
|
||||
<Label className="text-sm font-medium text-text">{t("byok.enabled")}</Label>
|
||||
<div className="text-xs text-text-secondary">{t("byok.description")}</div>
|
||||
</div>
|
||||
<Switch checked={byok.enabled} onCheckedChange={handleToggleEnabled} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{byok.enabled && (
|
||||
<>
|
||||
<div className="flex items-center justify-between">
|
||||
<Label className="text-sm font-medium text-text">{t("byok.providers.title")}</Label>
|
||||
{byok.providers.length < PROVIDER_OPTIONS.length && (
|
||||
<Button variant="outline" size="sm" onClick={handleAddProvider}>
|
||||
<i className="i-mgc-add-cute-re mr-2 size-4" />
|
||||
{t("byok.providers.add")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{byok.providers.length === 0 && (
|
||||
<div className="py-8 text-center">
|
||||
<div className="mx-auto mb-3 flex size-12 items-center justify-center rounded-full bg-fill-secondary">
|
||||
<i className="i-mgc-key-2-cute-re size-6 text-text" />
|
||||
</div>
|
||||
<h4 className="mb-1 text-sm font-medium text-text">
|
||||
{t("byok.providers.empty.title")}
|
||||
</h4>
|
||||
<p className="text-xs text-text-secondary">{t("byok.providers.empty.description")}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="!mt-2 space-y-4">
|
||||
{byok.providers.map((provider, index) => (
|
||||
<ByokProviderItem
|
||||
key={index}
|
||||
provider={provider}
|
||||
onDelete={() => handleDeleteProvider(index)}
|
||||
onEdit={() => handleEditProvider(index, provider)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { ByokProviderName } from "@follow/shared/settings/interface"
|
||||
|
||||
export const PROVIDER_OPTIONS: { value: ByokProviderName; label: string }[] = [
|
||||
{ value: "openai", label: "OpenAI" },
|
||||
{ value: "google", label: "Google" },
|
||||
{ value: "vercel-ai-gateway", label: "Vercel AI Gateway" },
|
||||
{ value: "openrouter", label: "OpenRouter" },
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
export { ByokSection } from "./ByokSection"
|
||||
+1
-1
@@ -93,7 +93,7 @@ export const MCPServiceModalContent = ({
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select transport type" />
|
||||
</SelectTrigger>
|
||||
<SelectContent position="item-aligned">
|
||||
<SelectContent>
|
||||
<SelectItem value="streamable-http">Streamable HTTP</SelectItem>
|
||||
<SelectItem value="sse">Server-Sent Events</SelectItem>
|
||||
</SelectContent>
|
||||
|
||||
@@ -499,7 +499,7 @@ const PlanComparisonTable = ({ plans }: { plans: PaymentPlan[] }) => {
|
||||
index % 2 === 0 ? "bg-background" : "bg-fill-secondary/20",
|
||||
)}
|
||||
>
|
||||
<td className="sticky left-0 z-10 bg-inherit px-4 py-3 text-xs font-medium">
|
||||
<td className="sticky left-0 z-10 bg-inherit px-4 py-3 text-sm font-medium">
|
||||
{t(`plan.features.${featureKey}`, { defaultValue: featureKey })}
|
||||
</td>
|
||||
{plans.map((plan) => {
|
||||
|
||||
@@ -27,8 +27,8 @@ export const UserProBadge = ({
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
<i className={cn("i-mgc-power block", iconClassName)} />
|
||||
{withText && <span className="text-xs">{UserRoleName[role]}</span>}
|
||||
<i className={cn("i-mgc-power block text-folo", iconClassName)} />
|
||||
{withText && <span className="text-xs text-folo">{UserRoleName[role]}</span>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,32 @@
|
||||
"analytics.usage_history": "Usage History",
|
||||
"analytics.usage_patterns": "Usage Patterns",
|
||||
"analytics.usage_trends": "Usage Trends (Last 30 Days)",
|
||||
"byok.description": "Use your own API keys for AI providers to have more control over costs and usage.",
|
||||
"byok.enabled": "Enable BYOK",
|
||||
"byok.providers.add": "Add Provider",
|
||||
"byok.providers.add_title": "Add BYOK Provider",
|
||||
"byok.providers.added": "Provider added successfully",
|
||||
"byok.providers.configured": "Configured",
|
||||
"byok.providers.delete": "Delete provider",
|
||||
"byok.providers.delete_message": "Are you sure you want to delete this provider? This action cannot be undone.",
|
||||
"byok.providers.delete_title": "Delete Provider",
|
||||
"byok.providers.deleted": "Provider deleted successfully",
|
||||
"byok.providers.edit": "Edit provider",
|
||||
"byok.providers.edit_title": "Edit BYOK Provider",
|
||||
"byok.providers.empty.description": "Add your own API keys for AI providers to use your own infrastructure.",
|
||||
"byok.providers.empty.title": "No Providers Configured",
|
||||
"byok.providers.form.api_key": "API Key",
|
||||
"byok.providers.form.api_key_help": "Your API key will be stored securely and encrypted.",
|
||||
"byok.providers.form.api_key_placeholder": "Enter your API key",
|
||||
"byok.providers.form.base_url": "Base URL",
|
||||
"byok.providers.form.base_url_help": "Optional. Leave empty to use the default API endpoint.",
|
||||
"byok.providers.form.base_url_placeholder": "e.g. https://api.openai.com/v1",
|
||||
"byok.providers.form.provider": "Provider",
|
||||
"byok.providers.headers_count": "header(s)",
|
||||
"byok.providers.no_api_key": "No API key set",
|
||||
"byok.providers.title": "Providers",
|
||||
"byok.providers.updated": "Provider updated successfully",
|
||||
"byok.title": "Bring Your Own Key (BYOK)",
|
||||
"chat.history.auto_title": "{{- datetime}} chat",
|
||||
"clear_chat": "Clear Chat",
|
||||
"clear_chat_message": "Are you sure you want to clear all history? This action will permanently delete all content, including all chat logs and data, and cannot be undone.",
|
||||
@@ -80,6 +106,8 @@
|
||||
"integration.mcp.services.empty.description": "Connect MCP services to extend AI capabilities with external tools, APIs, and data sources.",
|
||||
"integration.mcp.services.empty.title": "No MCP Services Connected",
|
||||
"integration.mcp.services.title": "MCP Services",
|
||||
"integration.security.description": "OAuth authentication tokens and AI BYOK API keys are securely stored using AES-GCM-256 encryption to protect your credentials and ensure data privacy.",
|
||||
"integration.security.title": "Security Disclosure",
|
||||
"integration.title": "Integration",
|
||||
"memories.actions.load_more": "Load more",
|
||||
"memories.actions.loading": "Loading...",
|
||||
|
||||
@@ -22,6 +22,32 @@
|
||||
"analytics.usage_history": "使用履歴",
|
||||
"analytics.usage_patterns": "使用パターン",
|
||||
"analytics.usage_trends": "使用傾向(過去30日)",
|
||||
"byok.description": "AIプロバイダーに独自のAPIキーを使用して、コストと使用量をより細かく制御できます。",
|
||||
"byok.enabled": "BYOKを有効にする",
|
||||
"byok.providers.add": "プロバイダーを追加",
|
||||
"byok.providers.add_title": "BYOKプロバイダーを追加",
|
||||
"byok.providers.added": "プロバイダーが正常に追加されました",
|
||||
"byok.providers.configured": "設定済み",
|
||||
"byok.providers.delete": "プロバイダーを削除",
|
||||
"byok.providers.delete_message": "このプロバイダーを削除してもよろしいですか?この操作は元に戻すことはできません。",
|
||||
"byok.providers.delete_title": "プロバイダーを削除",
|
||||
"byok.providers.deleted": "プロバイダーが正常に削除されました",
|
||||
"byok.providers.edit": "プロバイダーを編集",
|
||||
"byok.providers.edit_title": "BYOKプロバイダーを編集",
|
||||
"byok.providers.empty.description": "独自のインフラストラクチャを使用するために、AIプロバイダーに独自のAPIキーを追加します。",
|
||||
"byok.providers.empty.title": "プロバイダーが設定されていません",
|
||||
"byok.providers.form.api_key": "APIキー",
|
||||
"byok.providers.form.api_key_help": "APIキーは安全に保存され、暗号化されます。",
|
||||
"byok.providers.form.api_key_placeholder": "APIキーを入力",
|
||||
"byok.providers.form.base_url": "ベースURL",
|
||||
"byok.providers.form.base_url_help": "オプション。空のままにすると、デフォルトのAPIエンドポイントが使用されます。",
|
||||
"byok.providers.form.base_url_placeholder": "例:https://api.openai.com/v1",
|
||||
"byok.providers.form.provider": "プロバイダー",
|
||||
"byok.providers.headers_count": "個のカスタムヘッダー",
|
||||
"byok.providers.no_api_key": "APIキーが設定されていません",
|
||||
"byok.providers.title": "プロバイダー",
|
||||
"byok.providers.updated": "プロバイダーが正常に更新されました",
|
||||
"byok.title": "Bring Your Own Key (BYOK)",
|
||||
"chat.history.auto_title": "{{- datetime}} のチャット",
|
||||
"clear_chat": "Chat をクリア",
|
||||
"clear_chat_message": "本当にすべての履歴をクリアしてもよろしいですか?この操作はすべてのコンテンツ、Chat ログ、データを永久に削除し、元に戻すことはできません。",
|
||||
@@ -74,6 +100,8 @@
|
||||
"integration.mcp.services.empty.description": "MCPサービスに接続して、外部ツール、API、データソースでAI機能を拡張します。",
|
||||
"integration.mcp.services.empty.title": "MCPサービスが接続されていません",
|
||||
"integration.mcp.services.title": "MCPサービス",
|
||||
"integration.security.description": "OAuth認証トークンとAI BYOK APIキーは、AES-GCM-256暗号化を使用して安全に保存され、資格情報を保護し、データのプライバシーを確保します。",
|
||||
"integration.security.title": "セキュリティ開示",
|
||||
"integration.title": "統合",
|
||||
"memories.actions.load_more": "さらに読み込む",
|
||||
"memories.actions.loading": "読み込み中...",
|
||||
|
||||
@@ -22,6 +22,32 @@
|
||||
"analytics.usage_history": "使用历史",
|
||||
"analytics.usage_patterns": "使用模式",
|
||||
"analytics.usage_trends": "使用趋势(最近 30 天)",
|
||||
"byok.description": "使用您自己的 AI 提供商 API 密钥,以便更好地控制成本和用量。",
|
||||
"byok.enabled": "启用 BYOK",
|
||||
"byok.providers.add": "添加提供商",
|
||||
"byok.providers.add_title": "添加 BYOK 提供商",
|
||||
"byok.providers.added": "提供商添加成功",
|
||||
"byok.providers.configured": "已配置",
|
||||
"byok.providers.delete": "删除提供商",
|
||||
"byok.providers.delete_message": "确定要删除此提供商吗?此操作无法撤销。",
|
||||
"byok.providers.delete_title": "删除提供商",
|
||||
"byok.providers.deleted": "提供商删除成功",
|
||||
"byok.providers.edit": "编辑提供商",
|
||||
"byok.providers.edit_title": "编辑 BYOK 提供商",
|
||||
"byok.providers.empty.description": "添加您自己的 AI 提供商 API 密钥以使用您自己的基础设施。",
|
||||
"byok.providers.empty.title": "未配置提供商",
|
||||
"byok.providers.form.api_key": "API 密钥",
|
||||
"byok.providers.form.api_key_help": "您的 API 密钥将被安全存储和加密。",
|
||||
"byok.providers.form.api_key_placeholder": "输入您的 API 密钥",
|
||||
"byok.providers.form.base_url": "基础 URL",
|
||||
"byok.providers.form.base_url_help": "可选。留空以使用默认 API 端点。",
|
||||
"byok.providers.form.base_url_placeholder": "例如:https://api.openai.com/v1",
|
||||
"byok.providers.form.provider": "提供商",
|
||||
"byok.providers.headers_count": "个自定义请求头",
|
||||
"byok.providers.no_api_key": "未设置 API 密钥",
|
||||
"byok.providers.title": "提供商",
|
||||
"byok.providers.updated": "提供商更新成功",
|
||||
"byok.title": "自带密钥 (BYOK)",
|
||||
"chat.history.auto_title": "{{- datetime}} 聊天",
|
||||
"clear_chat": "清空对话",
|
||||
"clear_chat_message": "确定要清空所有历史记录吗?此操作将永久删除所有内容,包括所有聊天记录和数据,且无法撤销。",
|
||||
@@ -76,6 +102,8 @@
|
||||
"integration.mcp.services.empty.description": "连接 MCP 服务以通过外部工具、API 和数据源扩展 AI 功能。",
|
||||
"integration.mcp.services.empty.title": "未连接 MCP 服务",
|
||||
"integration.mcp.services.title": "MCP 服务",
|
||||
"integration.security.description": "OAuth 认证令牌和 AI BYOK API 密钥使用 AES-GCM-256 加密技术安全存储,以保护您的凭据并确保数据隐私。",
|
||||
"integration.security.title": "安全声明",
|
||||
"integration.title": "集成",
|
||||
"memories.actions.load_more": "加载更多",
|
||||
"memories.actions.loading": "加载中...",
|
||||
|
||||
@@ -20,6 +20,32 @@
|
||||
"analytics.usage_history": "使用歷史",
|
||||
"analytics.usage_patterns": "使用模式",
|
||||
"analytics.usage_trends": "使用趨勢(最近30天)",
|
||||
"byok.description": "使用您自己的 AI 提供商 API 金鑰,以便更好地控制成本和用量。",
|
||||
"byok.enabled": "啟用 BYOK",
|
||||
"byok.providers.add": "新增提供商",
|
||||
"byok.providers.add_title": "新增 BYOK 提供商",
|
||||
"byok.providers.added": "提供商新增成功",
|
||||
"byok.providers.configured": "已設定",
|
||||
"byok.providers.delete": "刪除提供商",
|
||||
"byok.providers.delete_message": "確定要刪除此提供商嗎?此操作無法撤銷。",
|
||||
"byok.providers.delete_title": "刪除提供商",
|
||||
"byok.providers.deleted": "提供商刪除成功",
|
||||
"byok.providers.edit": "編輯提供商",
|
||||
"byok.providers.edit_title": "編輯 BYOK 提供商",
|
||||
"byok.providers.empty.description": "新增您自己的 AI 提供商 API 金鑰以使用您自己的基礎設施。",
|
||||
"byok.providers.empty.title": "未設定提供商",
|
||||
"byok.providers.form.api_key": "API 金鑰",
|
||||
"byok.providers.form.api_key_help": "您的 API 金鑰將被安全儲存和加密。",
|
||||
"byok.providers.form.api_key_placeholder": "輸入您的 API 金鑰",
|
||||
"byok.providers.form.base_url": "基礎 URL",
|
||||
"byok.providers.form.base_url_help": "選填。留空以使用預設 API 端點。",
|
||||
"byok.providers.form.base_url_placeholder": "例如:https://api.openai.com/v1",
|
||||
"byok.providers.form.provider": "提供商",
|
||||
"byok.providers.headers_count": "個自訂請求標頭",
|
||||
"byok.providers.no_api_key": "未設定 API 金鑰",
|
||||
"byok.providers.title": "提供商",
|
||||
"byok.providers.updated": "提供商更新成功",
|
||||
"byok.title": "自帶金鑰 (BYOK)",
|
||||
"chat.history.auto_title": "{{- datetime}} 聊天",
|
||||
"clear_chat": "清空對話",
|
||||
"clear_chat_message": "確定要清空所有歷史記錄嗎?此操作將永久刪除所有內容,包括所有聊天記錄和數據,且無法撤銷。",
|
||||
@@ -78,6 +104,8 @@
|
||||
"integration.mcp.services.empty.description": "連接 MCP 服務以透過外部工具、API 和資料源來擴展 AI 功能。",
|
||||
"integration.mcp.services.empty.title": "未連接 MCP 服務",
|
||||
"integration.mcp.services.title": "MCP 服務",
|
||||
"integration.security.description": "OAuth 驗證令牌和 AI BYOK API 金鑰使用 AES-GCM-256 加密技術安全儲存,以保護您的憑據並確保資料隱私。",
|
||||
"integration.security.title": "安全聲明",
|
||||
"integration.title": "整合",
|
||||
"mentions.date.relative.last_15_days.label": "最近 15 天",
|
||||
"mentions.date.relative.last_15_days.search": "最近 15 天|近半個月",
|
||||
|
||||
@@ -565,6 +565,7 @@
|
||||
"plan.featureValues.AI_MODEL_SELECTION.curated": "Curated models",
|
||||
"plan.featureValues.AI_MODEL_SELECTION.high_performance": "All high-end models",
|
||||
"plan.featureValues.AI_MODEL_SELECTION.none": "—",
|
||||
"plan.features.AI_BRING_YOUR_OWN_KEY": "AI Bring Your Own Key",
|
||||
"plan.features.AI_CREDIT": "AI Chat Credits",
|
||||
"plan.features.AI_MODEL_SELECTION": "AI Model Selection",
|
||||
"plan.features.BOOSTS": "Feed Refresh Acceleration",
|
||||
|
||||
@@ -560,6 +560,7 @@
|
||||
"plan.descriptions.pro": "Foloの最高の機能すべてにアクセス。",
|
||||
"plan.featureValues.AI_MODEL_SELECTION.curated": "厳選モデル",
|
||||
"plan.featureValues.AI_MODEL_SELECTION.high_performance": "高性能すべて",
|
||||
"plan.features.AI_BRING_YOUR_OWN_KEY": "AI Bring Your Own Key",
|
||||
"plan.features.AI_CREDIT": "AI Chat クレジット",
|
||||
"plan.features.AI_MODEL_SELECTION": "AI モデル選択",
|
||||
"plan.features.BOOSTS": "購読フィードの加速",
|
||||
|
||||
@@ -559,6 +559,7 @@
|
||||
"plan.descriptions.pro": "完整享受 Folo 的最佳功能。",
|
||||
"plan.featureValues.AI_MODEL_SELECTION.curated": "精选模型",
|
||||
"plan.featureValues.AI_MODEL_SELECTION.high_performance": "全部高性能模型",
|
||||
"plan.features.AI_BRING_YOUR_OWN_KEY": "AI 自定义 API 密钥",
|
||||
"plan.features.AI_CREDIT": "AI Chat 积分",
|
||||
"plan.features.AI_MODEL_SELECTION": "AI 模型选择",
|
||||
"plan.features.BOOSTS": "订阅源更新加速",
|
||||
|
||||
@@ -6,6 +6,14 @@ const defaultConfig = {
|
||||
background: "hsl(var(--background))",
|
||||
accent: "hsl(var(--fo-a))",
|
||||
red: "rgb(var(--color-red))",
|
||||
green: "rgb(var(--color-green))",
|
||||
blue: "rgb(var(--color-blue))",
|
||||
purple: "rgb(var(--color-purple))",
|
||||
yellow: "rgb(var(--color-yellow))",
|
||||
orange: "rgb(var(--color-orange))",
|
||||
gray: "rgb(var(--color-gray))",
|
||||
pink: "rgb(var(--color-pink))",
|
||||
|
||||
transparent: "transparent",
|
||||
// Map to existing theme colors from UIKit
|
||||
},
|
||||
|
||||
@@ -72,7 +72,7 @@ export const TimeSelect = memo<TimeSelectProps>(
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent position="item-aligned" className="max-h-[50vh] w-16 p-1">
|
||||
<SelectContent className="max-h-[50vh] w-16 p-1">
|
||||
{hours.map((h) => (
|
||||
<SelectItem key={h.value} value={h.value} className="h-6 text-xs">
|
||||
{h.label}
|
||||
@@ -88,7 +88,7 @@ export const TimeSelect = memo<TimeSelectProps>(
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent position="item-aligned" className="max-h-[50vh] w-16 p-1">
|
||||
<SelectContent className="max-h-[50vh] w-16 p-1">
|
||||
{minutes.map((m) => (
|
||||
<SelectItem key={m.value} value={m.value} className="h-6 text-xs">
|
||||
{m.label}
|
||||
|
||||
@@ -169,6 +169,12 @@ export const defaultAISettings: AISettings = {
|
||||
|
||||
// Features
|
||||
autoScrollWhenStreaming: true,
|
||||
|
||||
// BYOK (Bring Your Own Key)
|
||||
byok: {
|
||||
enabled: false,
|
||||
providers: [],
|
||||
},
|
||||
}
|
||||
|
||||
export const defaultSettings = {
|
||||
|
||||
@@ -224,4 +224,20 @@ export interface AISettings {
|
||||
|
||||
// Features
|
||||
autoScrollWhenStreaming: boolean
|
||||
|
||||
byok: UserByokSettings
|
||||
}
|
||||
|
||||
export type ByokProviderName = "openai" | "google" | "vercel-ai-gateway" | "openrouter"
|
||||
|
||||
export type UserByokProviderConfig = {
|
||||
provider: ByokProviderName
|
||||
baseURL?: string | null
|
||||
apiKey?: string | null
|
||||
headers?: Record<string, string>
|
||||
}
|
||||
|
||||
export type UserByokSettings = {
|
||||
enabled: boolean
|
||||
providers: UserByokProviderConfig[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user