mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-05 16:23:51 +00:00
fix(ui): hide local paths in remote CLIProxy mode
This commit is contained in:
@@ -31,6 +31,7 @@ export function ProviderEditor({
|
|||||||
authStatus,
|
authStatus,
|
||||||
catalog,
|
catalog,
|
||||||
logoProvider,
|
logoProvider,
|
||||||
|
isRemoteMode,
|
||||||
onAddAccount,
|
onAddAccount,
|
||||||
onSetDefault,
|
onSetDefault,
|
||||||
onRemoveAccount,
|
onRemoveAccount,
|
||||||
@@ -124,6 +125,7 @@ export function ProviderEditor({
|
|||||||
hasChanges={hasChanges}
|
hasChanges={hasChanges}
|
||||||
isRawJsonValid={isRawJsonValid}
|
isRawJsonValid={isRawJsonValid}
|
||||||
isSaving={saveMutation.isPending}
|
isSaving={saveMutation.isPending}
|
||||||
|
isRemoteMode={isRemoteMode}
|
||||||
onRefetch={refetch}
|
onRefetch={refetch}
|
||||||
onSave={() => saveMutation.mutate()}
|
onSave={() => saveMutation.mutate()}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ interface ProviderEditorHeaderProps {
|
|||||||
hasChanges: boolean;
|
hasChanges: boolean;
|
||||||
isRawJsonValid: boolean;
|
isRawJsonValid: boolean;
|
||||||
isSaving: boolean;
|
isSaving: boolean;
|
||||||
|
isRemoteMode?: boolean;
|
||||||
onRefetch: () => void;
|
onRefetch: () => void;
|
||||||
onSave: () => void;
|
onSave: () => void;
|
||||||
}
|
}
|
||||||
@@ -31,6 +32,7 @@ export function ProviderEditorHeader({
|
|||||||
hasChanges,
|
hasChanges,
|
||||||
isRawJsonValid,
|
isRawJsonValid,
|
||||||
isSaving,
|
isSaving,
|
||||||
|
isRemoteMode,
|
||||||
onRefetch,
|
onRefetch,
|
||||||
onSave,
|
onSave,
|
||||||
}: ProviderEditorHeaderProps) {
|
}: ProviderEditorHeaderProps) {
|
||||||
@@ -41,13 +43,13 @@ export function ProviderEditorHeader({
|
|||||||
<div>
|
<div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<h2 className="text-lg font-semibold">{displayName}</h2>
|
<h2 className="text-lg font-semibold">{displayName}</h2>
|
||||||
{data?.path && (
|
{!isRemoteMode && data?.path && (
|
||||||
<Badge variant="outline" className="text-xs">
|
<Badge variant="outline" className="text-xs">
|
||||||
{data.path.replace(/^.*\//, '')}
|
{data.path.replace(/^.*[\\/]/, '')}
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{data && (
|
{!isRemoteMode && data && (
|
||||||
<p className="text-xs text-muted-foreground mt-0.5">
|
<p className="text-xs text-muted-foreground mt-0.5">
|
||||||
Last modified: {new Date(data.mtime).toLocaleString()}
|
Last modified: {new Date(data.mtime).toLocaleString()}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ export interface ProviderEditorProps {
|
|||||||
catalog?: ProviderCatalog;
|
catalog?: ProviderCatalog;
|
||||||
/** Provider type for logo display (defaults to provider) */
|
/** Provider type for logo display (defaults to provider) */
|
||||||
logoProvider?: string;
|
logoProvider?: string;
|
||||||
|
/** True if using remote CLIProxy mode (hides local paths) */
|
||||||
|
isRemoteMode?: boolean;
|
||||||
onAddAccount: () => void;
|
onAddAccount: () => void;
|
||||||
onSetDefault: (accountId: string) => void;
|
onSetDefault: (accountId: string) => void;
|
||||||
onRemoveAccount: (accountId: string) => void;
|
onRemoveAccount: (accountId: string) => void;
|
||||||
|
|||||||
@@ -249,7 +249,8 @@ export const api = {
|
|||||||
},
|
},
|
||||||
cliproxy: {
|
cliproxy: {
|
||||||
list: () => request<{ variants: Variant[] }>('/cliproxy'),
|
list: () => request<{ variants: Variant[] }>('/cliproxy'),
|
||||||
getAuthStatus: () => request<{ authStatus: AuthStatus[] }>('/cliproxy/auth'),
|
getAuthStatus: () =>
|
||||||
|
request<{ authStatus: AuthStatus[]; source?: 'remote' | 'local' }>('/cliproxy/auth'),
|
||||||
create: (data: CreateVariant) =>
|
create: (data: CreateVariant) =>
|
||||||
request('/cliproxy', {
|
request('/cliproxy', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ export function CliproxyPage() {
|
|||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
const providers = useMemo(() => authData?.authStatus || [], [authData?.authStatus]);
|
const providers = useMemo(() => authData?.authStatus || [], [authData?.authStatus]);
|
||||||
|
const isRemoteMode = authData?.source === 'remote';
|
||||||
const variants = useMemo(() => variantsData?.variants || [], [variantsData?.variants]);
|
const variants = useMemo(() => variantsData?.variants || [], [variantsData?.variants]);
|
||||||
|
|
||||||
// Auto-select first provider if nothing selected
|
// Auto-select first provider if nothing selected
|
||||||
@@ -338,6 +339,7 @@ export function CliproxyPage() {
|
|||||||
authStatus={parentAuthForVariant}
|
authStatus={parentAuthForVariant}
|
||||||
catalog={MODEL_CATALOGS[selectedVariantData.provider]}
|
catalog={MODEL_CATALOGS[selectedVariantData.provider]}
|
||||||
logoProvider={selectedVariantData.provider}
|
logoProvider={selectedVariantData.provider}
|
||||||
|
isRemoteMode={isRemoteMode}
|
||||||
onAddAccount={() =>
|
onAddAccount={() =>
|
||||||
setAddAccountProvider({
|
setAddAccountProvider({
|
||||||
provider: selectedVariantData.provider,
|
provider: selectedVariantData.provider,
|
||||||
@@ -365,6 +367,7 @@ export function CliproxyPage() {
|
|||||||
displayName={selectedStatus.displayName}
|
displayName={selectedStatus.displayName}
|
||||||
authStatus={selectedStatus}
|
authStatus={selectedStatus}
|
||||||
catalog={MODEL_CATALOGS[selectedStatus.provider]}
|
catalog={MODEL_CATALOGS[selectedStatus.provider]}
|
||||||
|
isRemoteMode={isRemoteMode}
|
||||||
onAddAccount={() =>
|
onAddAccount={() =>
|
||||||
setAddAccountProvider({
|
setAddAccountProvider({
|
||||||
provider: selectedStatus.provider,
|
provider: selectedStatus.provider,
|
||||||
|
|||||||
Reference in New Issue
Block a user