fix: restore default channel connection paste

This commit is contained in:
CaIon
2026-07-08 12:39:23 +08:00
parent 6ce7305cd3
commit 57865fc1f8
10 changed files with 243 additions and 29 deletions
@@ -50,6 +50,7 @@ import {
import { useChatPresets } from '@/features/chat/hooks/use-chat-presets'
import { resolveChatUrl, type ChatPreset } from '@/features/chat/lib/chat-links'
import { sendToFluent } from '@/features/chat/lib/send-to-fluent'
import { encodeChannelConnectionInfo } from '@/lib/channel-connection-info'
import { copyToClipboard } from '@/lib/copy-to-clipboard'
import { updateApiKeyStatus } from '../api'
@@ -70,14 +71,6 @@ function getServerAddress(): string {
return window.location.origin
}
function encodeConnectionString(key: string, url: string): string {
return JSON.stringify({
_type: 'newapi_channel_conn',
key,
url,
})
}
type DataTableRowActionsProps<TData> = {
row: Row<TData>
}
@@ -262,7 +255,10 @@ export function DataTableRowActions<TData>({
onClick={async () => {
const realKey = getCachedRealKey()
if (!realKey) return
const connStr = encodeConnectionString(realKey, getServerAddress())
const connStr = encodeChannelConnectionInfo(
realKey,
getServerAddress()
)
const ok = await copyToClipboard(connStr)
if (ok) toast.success(t('Copied'))
}}