nolo-cli 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-runtime/agentRecordConfig.ts +0 -2
- package/agent-runtime/hostAdapter.ts +0 -1
- package/agent-runtime/hostRuntimeCapabilities.ts +7 -0
- package/agent-runtime/hostRuntimeConfig.ts +86 -0
- package/agent-runtime/index.ts +13 -0
- package/agent-runtime/localToolPolicy.ts +13 -6
- package/agent-runtime/localWorkspaceTools.ts +333 -30
- package/agent-runtime/platformChatProvider.ts +4 -1
- package/agent-runtime/runtimeToolPolicy.ts +32 -47
- package/agent-runtime/shellCommandPolicy.ts +117 -0
- package/agent-runtime/toolGate.ts +38 -0
- package/agentRecordCommands.ts +1 -1
- package/agentRecordHelpers.ts +35 -20
- package/agentRunParsing.ts +18 -5
- package/agentRuntimeLocal.ts +10 -0
- package/ai/agent/agentRunDialogLineage.ts +56 -0
- package/ai/agent/agentSlice.ts +45 -10
- package/ai/agent/avatarUtils.ts +1 -1
- package/ai/agent/buildSystemPrompt.ts +1 -2
- package/ai/agent/cliExecutor.ts +330 -19
- package/ai/agent/createAgentSchema.ts +22 -0
- package/ai/agent/hooks/fetchPublicAgents.ts +14 -39
- package/ai/agent/hooks/usePublicAgents.ts +90 -192
- package/ai/agent/publicAgentCatalog.ts +359 -0
- package/ai/agent/publicAgentIdentity.ts +76 -0
- package/ai/agent/server/fetchPublicAgents.ts +21 -46
- package/ai/agent/serverOrigin.ts +7 -0
- package/ai/agent/streamAgentChatTurn.ts +23 -21
- package/ai/agent/streamAgentChatTurnUtils.ts +292 -6
- package/ai/agent/types.ts +2 -0
- package/ai/agent/web/agentDisplayUtils.ts +171 -0
- package/ai/agent/web/useAgentModelAvatarComponent.ts +32 -0
- package/ai/ai.locale.ts +8 -0
- package/ai/chat/sendOpenAICompletionsRequest.native.ts +15 -0
- package/ai/chat/sendOpenAICompletionsRequest.ts +93 -1
- package/ai/chat/sendOpenAIResponseRequest.ts +86 -9
- package/ai/chat/updateTotalUsage.ts +7 -0
- package/ai/llm/deepinfra.ts +30 -15
- package/ai/llm/mistral.ts +3 -4
- package/ai/llm/providers.ts +2 -0
- package/ai/llm/types.ts +15 -0
- package/ai/memory/capture.ts +3 -3
- package/ai/memory/consolidate.ts +2 -2
- package/ai/memory/delete.ts +4 -3
- package/ai/memory/query.ts +3 -3
- package/ai/memory/remember.ts +2 -2
- package/ai/memory/store.ts +3 -3
- package/ai/memory/storeShared.ts +3 -2
- package/ai/policy/commercialMultiplier.ts +16 -0
- package/ai/token/billingAdminAuditEvent.ts +68 -0
- package/ai/token/billingAdminAuditEventWriter.ts +41 -0
- package/ai/token/billingAnomaly.ts +90 -0
- package/ai/token/billingAnomalyLifecycle.ts +54 -0
- package/ai/token/billingAnomalyLifecycleWriter.ts +44 -0
- package/ai/token/billingAnomalyWriter.ts +41 -0
- package/ai/token/calculatePrice.ts +3 -2
- package/ai/token/deepinfraReconciliation.ts +153 -0
- package/ai/token/deepinfraRequestIdQuery.ts +92 -0
- package/ai/token/externalToolCost.ts +54 -41
- package/ai/token/missingUsageEstimate.ts +12 -3
- package/ai/token/normalizeUsage.ts +45 -5
- package/ai/token/openaiReconciliation.ts +188 -0
- package/ai/token/providerBillableEvent.ts +84 -0
- package/ai/token/providerBillableEventWriter.ts +36 -0
- package/ai/token/providerBillingAnomalyDrilldown.ts +308 -0
- package/ai/token/providerBillingDrilldown.ts +361 -0
- package/ai/token/providerBillingHealthReport.ts +366 -0
- package/ai/token/providerCall.ts +144 -0
- package/ai/token/providerCallSweeper.ts +168 -0
- package/ai/token/providerCallWriter.ts +33 -0
- package/ai/token/providerCredential.ts +89 -0
- package/ai/token/providerCredentialAnomaly.ts +154 -0
- package/ai/token/providerCredentialLifecycle.ts +59 -0
- package/ai/token/providerCredentialLifecycleWriter.ts +44 -0
- package/ai/token/providerCredentialRegistry.ts +83 -0
- package/ai/token/providerCredentialRegistryCommand.ts +97 -0
- package/ai/token/providerCredentialRegistryList.ts +124 -0
- package/ai/token/providerCredentialRegistryResolver.ts +150 -0
- package/ai/token/providerCredentialRegistryWriter.ts +41 -0
- package/ai/token/providerCredentialRotationCommand.ts +102 -0
- package/ai/token/providerCredentialRuntime.ts +56 -0
- package/ai/token/providerDispatchIntent.ts +67 -0
- package/ai/token/providerDispatchIntentWriter.ts +36 -0
- package/ai/token/providerGateway.ts +260 -0
- package/ai/token/providerReconciliation.ts +148 -0
- package/ai/token/providerReconciliationLocal.ts +97 -0
- package/ai/token/providerReconciliationRunner.ts +165 -0
- package/ai/token/providerReconciliationWriter.ts +41 -0
- package/ai/token/ratingResult.ts +202 -0
- package/ai/token/ratingResultWriter.ts +33 -0
- package/ai/token/serverDialogProjection.ts +5 -3
- package/ai/token/serverTokenWriter.ts +11 -3
- package/ai/token/types.ts +10 -0
- package/ai/tools/agent/callAgentTool.ts +3 -4
- package/ai/tools/agent/presets/appBuilderPreset.ts +5 -7
- package/ai/tools/agent/runStreamingAgentTool.ts +1 -2
- package/ai/tools/agent/streamParallelAgentsTool.ts +2 -3
- package/ai/tools/readXPostTool.ts +1 -5
- package/app/admin/adminPages.ts +9 -0
- package/app/i18n/i18n.config.ts +5 -0
- package/app/i18n/translations/pricing.locale.ts +397 -0
- package/app/utils/desktopAgentRuntimeStatusClient.ts +5 -4
- package/app/utils/desktopAgentRuntimeTurnClient.ts +4 -1
- package/app/utils/imageUtils.ts +64 -34
- package/auth/adminPermissions.ts +18 -0
- package/auth/authSlice.ts +26 -12
- package/auth/hooks/useFetchUsers.ts +3 -0
- package/auth/routes.ts +46 -0
- package/auth/server/accessActivity.ts +4 -3
- package/auth/server/adminPermissions.ts +43 -0
- package/auth/server/adminUsageReport.ts +375 -0
- package/auth/server/billingAnomalies.ts +235 -0
- package/auth/server/billingUsageReport.ts +41 -2
- package/auth/server/creatorEarningCreditConversion.ts +10 -2
- package/auth/server/deduct.ts +14 -7
- package/auth/server/delete.ts +10 -2
- package/auth/server/disable.ts +4 -3
- package/auth/server/emailAutomation.ts +7 -5
- package/auth/server/emailDbConfig.ts +4 -2
- package/auth/server/emailDelivery.ts +24 -20
- package/auth/server/emailDeliveryGuards.ts +10 -7
- package/auth/server/emailPreferences.ts +6 -4
- package/auth/server/emailReport.ts +6 -4
- package/auth/server/emailRuntimeConfig.ts +3 -3
- package/auth/server/emailScenarioNotifications.ts +9 -8
- package/auth/server/enable.ts +4 -3
- package/auth/server/getRechargeHistory.ts +3 -2
- package/auth/server/getUser.ts +3 -2
- package/auth/server/gptProAccess.ts +44 -0
- package/auth/server/inviteReward.ts +10 -7
- package/auth/server/listusers.ts +6 -4
- package/auth/server/login.ts +2 -2
- package/auth/server/productEntitlements.ts +7 -4
- package/auth/server/productPurchase.ts +10 -2
- package/auth/server/providerBillingDrilldown.ts +47 -0
- package/auth/server/providerBillingHealth.ts +71 -0
- package/auth/server/providerCredentials.ts +136 -0
- package/auth/server/recharge.ts +14 -8
- package/auth/server/revokeSessions.ts +4 -3
- package/auth/server/route.ts +77 -0
- package/auth/server/sendEmail.ts +5 -4
- package/auth/server/signup.ts +10 -3
- package/auth/server/token.ts +53 -55
- package/auth/server/tokenUsageBilling.ts +18 -7
- package/auth/server/usageManagementAccess.ts +43 -0
- package/auth/server/usageReport.ts +59 -0
- package/auth/types.ts +12 -0
- package/auth/utils.ts +24 -22
- package/authCommands.ts +36 -2
- package/buildPublish.ts +3 -1
- package/buildPublishArtifactAssembly.ts +62 -1
- package/buildPublishImportAnalysis.ts +21 -16
- package/chat/dialog/dialogLaunchScope.ts +32 -0
- package/chat/dialog/objectAssistantRegistry.ts +2 -2
- package/chat/dialog/useCreateDialog.ts +1 -1
- package/chat/hooks/useChatInput.ts +41 -10
- package/chat/messages/messageSlice.ts +5 -1
- package/chat/messages/pendingAttachmentParts.ts +28 -2
- package/chat/messages/sendFirstMessage.ts +76 -79
- package/chat/messages/types.ts +9 -0
- package/chat/messages/web/streamingMarkdownModel.ts +41 -0
- package/chat/messages/web/useStreamingReveal.ts +91 -0
- package/chat/web/messageInputAgentUi.ts +94 -6
- package/cliEnvHelpers.ts +8 -0
- package/cliRuntimeDoctorReport.ts +193 -0
- package/client/agentConfigResolver.test.ts +0 -2
- package/client/agentRun.test.ts +171 -10
- package/client/agentRun.ts +44 -637
- package/client/agentRunInput.ts +10 -0
- package/client/agentRunLocalExecutor.ts +179 -0
- package/client/agentRunServerTransport.ts +394 -0
- package/client/agentRunTaskRunRecorder.ts +176 -0
- package/client/localRuntimeAdapter.test.ts +236 -9
- package/client/localRuntimeAdapter.ts +221 -23
- package/client/localToolPolicy.test.ts +28 -4
- package/connector-experimental/daemonLauncher.ts +38 -4
- package/connectorRunArtifact.ts +34 -10
- package/connectorWebSocketTarget.ts +9 -5
- package/core/builtinAgents.ts +155 -11
- package/create/space/contentLabels.ts +1 -1
- package/create/space/contentTypeMeta.ts +3 -2
- package/create/space/sidebarVisibleTypes.ts +27 -0
- package/create/space/space.locale.ts +76 -4
- package/database/actions/agentReadResolution.ts +2 -8
- package/database/actions/read.ts +11 -9
- package/database/actions/readAndWait.ts +10 -5
- package/database/server/agentDelegation.ts +3 -2
- package/database/server/authorityStoreConformance.ts +209 -0
- package/database/server/authorityStoreTypes.ts +31 -0
- package/database/server/coreDataProxy.ts +1 -1
- package/database/server/dataHandlers.ts +13 -5
- package/database/server/db.ts +15 -34
- package/database/server/delete.ts +88 -71
- package/database/server/emailRepository.ts +11 -9
- package/database/server/fileService.ts +2 -1
- package/database/server/legacyServerDb.ts +58 -0
- package/database/server/levelAuthorityStore.ts +75 -0
- package/database/server/memoryAuthorityStore.ts +133 -0
- package/database/server/patch.ts +13 -12
- package/database/server/query.ts +3 -2
- package/database/server/read.ts +33 -30
- package/database/server/resourceAccess.ts +7 -5
- package/database/server/serverStoreFactory.ts +124 -0
- package/database/server/spaceMemberAuthority.ts +3 -2
- package/database/server/storeBatchCompat.ts +37 -0
- package/database/server/testAuthorityStore.ts +76 -0
- package/database/server/write.ts +29 -27
- package/integrations/anthropic/anthropicModels.ts +12 -12
- package/integrations/deepseek/models.ts +67 -67
- package/integrations/google/models.ts +111 -53
- package/integrations/openai/models.ts +22 -22
- package/integrations/xai/models.ts +1 -1
- package/localRuntimeDb.ts +39 -2
- package/machineCommandPrompts.ts +2 -0
- package/machineCommands.ts +193 -63
- package/machineWsRunDispatch.ts +80 -15
- package/machineWsSession.ts +39 -2
- package/noloReadBridgePrompt.ts +16 -0
- package/package.json +99 -6
- package/render/layout/mainLayoutViewMode.ts +25 -0
- package/render/page/server/createPage.ts +3 -1
- package/render/page/server/handleCreatePage.ts +2 -11
- package/runtimeDoctorCommands.ts +15 -66
- package/server/api/methods.ts +34 -12
- package/server/api/tableHandlers.ts +6 -3
- package/server/authenticateToken.ts +47 -2
- package/server/billingLedgerRoutes.ts +15 -0
- package/server/buildManifest.ts +54 -0
- package/server/coreReadiness.ts +34 -25
- package/server/coreRuntime.ts +15 -10
- package/server/handlers/activityStatsHandler.ts +5 -2
- package/server/handlers/agentEmailRegistrationE2EHandler.ts +25 -23
- package/server/handlers/agentRun/agentLookup.ts +1 -7
- package/server/handlers/agentRun/autonomousRuntime.ts +11 -10
- package/server/handlers/agentRun/builtinAgents.ts +12 -88
- package/server/handlers/agentRun/continueDialogContext.ts +15 -3
- package/server/handlers/agentRun/{inheritedDialogPrompt.ts → conversationReference.ts} +3 -3
- package/server/handlers/agentRun/dialogLookup.ts +4 -3
- package/server/handlers/agentRun/index.ts +864 -404
- package/server/handlers/agentRun/localRuntimeBootstrap.ts +17 -1
- package/server/handlers/agentRun/loop.ts +920 -508
- package/server/handlers/agentRun/machineConnector.ts +56 -8
- package/server/handlers/agentRun/machineRunAudit.ts +3 -2
- package/server/handlers/agentRun/modelUsageToolHandlers.ts +13 -10
- package/server/handlers/agentRun/requestContext.ts +12 -8
- package/server/handlers/agentRun/runtimeExecutionContext.ts +15 -3
- package/server/handlers/agentRun/runtimePreparation.ts +26 -24
- package/server/handlers/agentRun/runtimeRouting.ts +25 -40
- package/server/handlers/agentRun/runtimeSystemMessages.ts +65 -0
- package/server/handlers/agentRun/saveDialog.ts +97 -87
- package/server/handlers/agentRun/taskRunToolHandler.ts +9 -7
- package/server/handlers/agentRun/toolExecutor.ts +42 -78
- package/server/handlers/agentRun/types.ts +2 -1
- package/server/handlers/appDeployStatusStore.ts +17 -10
- package/server/handlers/appDomainHandler.ts +21 -15
- package/server/handlers/appLegacyInfraCleanup.ts +5 -2
- package/server/handlers/appSandboxHandler.ts +29 -8
- package/server/handlers/appSpaceAccess.ts +15 -8
- package/server/handlers/chatHandler.ts +22 -2
- package/server/handlers/chatUpstreamRetry.ts +225 -2
- package/server/handlers/connector/connectorConnectionRegistry.ts +55 -7
- package/server/handlers/connector/connectorWebSocket.ts +14 -10
- package/server/handlers/desktopAgentRuntimeAdapter.ts +4 -4
- package/server/handlers/desktopAgentRuntimeHostCapabilities.ts +25 -0
- package/server/handlers/desktopAgentRuntimeReadiness.ts +62 -0
- package/server/handlers/desktopAgentRuntimeStatusHandler.ts +38 -30
- package/server/handlers/desktopAgentRuntimeTurnHandler.ts +7 -3
- package/server/handlers/desktopAgentRuntimeTurnService.ts +39 -45
- package/server/handlers/desktopLlamaRuntimeHandler.ts +85 -51
- package/server/handlers/desktopUpdaterHandler.ts +132 -24
- package/server/handlers/favoriteHandlers.ts +8 -2
- package/server/handlers/getDialogBillingHandler.ts +4 -3
- package/server/handlers/getTransactionsHandler.ts +5 -2
- package/server/handlers/machines/machineBinding.ts +1 -0
- package/server/handlers/machines/machineHandlers.ts +0 -14
- package/server/handlers/machines/machineInstallAssets.ts +4 -2
- package/server/handlers/notificationEmitter.ts +5 -3
- package/server/handlers/notificationsHandler.ts +5 -2
- package/server/handlers/providerCallsRecentHandler.ts +234 -0
- package/server/handlers/providerReconciliationRunHandler.ts +180 -0
- package/server/handlers/providerRequestIdsHandler.ts +105 -0
- package/server/handlers/tableAccess.ts +6 -2
- package/server/handlers/tableToolHandlers.ts +28 -14
- package/server/handlers/userSecretsHandler.ts +17 -6
- package/server/handlers/versionHandler.ts +9 -4
- package/server/handlers/versionStore.ts +18 -10
- package/server/html/ssrPreload.ts +5 -3
- package/server/payments/crypto/cryptoUsdcBasePaymentProvider.ts +11 -8
- package/server/payments/crypto/cryptoUsdcBaseScanner.ts +12 -7
- package/server/payments/crypto/cryptoUsdtTronPaymentProvider.ts +11 -8
- package/server/payments/crypto/cryptoUsdtTronScanner.ts +9 -7
- package/server/payments/waffo/waffoPaymentProvider.ts +12 -9
- package/server/runtimeRole.ts +15 -0
- package/server/scheduler/scheduledTaskRuntime.ts +4 -2
- package/server/scheduler/schedulerService.ts +2 -2
- package/server/taskRunBridgeRoutes.ts +8 -5
- package/share/server/fetchCommunityShares.ts +1 -1
- package/share/server/helpers.ts +19 -17
- package/share/server/importShare.ts +9 -13
- package/share/server/listCommunityShares.ts +4 -4
- package/share/server/purchaseDoc.ts +8 -16
- package/share/server/readCommunityShareCover.ts +3 -2
- package/share/server/readSharedTable.ts +14 -13
- package/share/server/tableReplication.ts +42 -39
- package/spaceAttachCommands.ts +135 -0
- package/spaceInternalCommandEntries.ts +2 -0
- package/ai/agent/runtimeServerBase.ts +0 -37
- package/server/handlers/desktopAgentRuntimeHostFacts.ts +0 -40
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { Language } from "../types";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
[Language.EN]: {
|
|
5
|
+
translation: {
|
|
6
|
+
pricing: {
|
|
7
|
+
title: "Pay-As-You-Go",
|
|
8
|
+
subtitle: "Billed by actual token usage. Points never expire.\nPro unlocks at 19 points. No subscription lock-in.",
|
|
9
|
+
free: "Free",
|
|
10
|
+
points: "{{num}} Points",
|
|
11
|
+
tiers: {
|
|
12
|
+
starter: {
|
|
13
|
+
name: "Starter",
|
|
14
|
+
meta: "Free upon Signup",
|
|
15
|
+
price: "Free",
|
|
16
|
+
features: [
|
|
17
|
+
"Standard LLM models",
|
|
18
|
+
"Multi-agent collaboration",
|
|
19
|
+
"Single file analysis",
|
|
20
|
+
"Permanent chat history"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
pro: {
|
|
24
|
+
name: "Pro",
|
|
25
|
+
meta: "Balance at 19 Points",
|
|
26
|
+
price: "Unlock at 19 Points",
|
|
27
|
+
features: [
|
|
28
|
+
"Batch file analysis",
|
|
29
|
+
"Real-time web search",
|
|
30
|
+
"Priority processing queue"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
advanced: {
|
|
34
|
+
name: "Advanced",
|
|
35
|
+
meta: "Balance ≥ 199 Points",
|
|
36
|
+
price: "Unlock with ≥ 199 Points",
|
|
37
|
+
features: [
|
|
38
|
+
"Advanced reasoning models",
|
|
39
|
+
"Claude Opus access",
|
|
40
|
+
"Overnight Autopilot runs",
|
|
41
|
+
"Flex Pro smart routing"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
dedicated: {
|
|
45
|
+
name: "Dedicated VM",
|
|
46
|
+
meta: "Balance ≥ 999 Points",
|
|
47
|
+
price: "Unlock with ≥ 999 Points",
|
|
48
|
+
features: [
|
|
49
|
+
"Dedicated VM runtime",
|
|
50
|
+
"Isolated compute resources",
|
|
51
|
+
"Long-running workload execution"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
cta: {
|
|
56
|
+
titleLoggedIn: "Flexible Recharge",
|
|
57
|
+
titleLoggedOut: "Try Free",
|
|
58
|
+
descLoggedIn: "Points are credited instantly. Pro unlocks at 19 points, Advanced at 199 points.",
|
|
59
|
+
descLoggedOut: "Sign up and start with the free tier before recharging.",
|
|
60
|
+
btnRecharge: "Recharge Points",
|
|
61
|
+
btnFreeStart: "Start Free",
|
|
62
|
+
btnDirectRecharge: "Recharge Directly",
|
|
63
|
+
trustLoggedIn: "Refundable anytime • Billed by usage • Never expires",
|
|
64
|
+
trustLoggedOut: "No credit card • Instant access • No subscription lock-in"
|
|
65
|
+
},
|
|
66
|
+
searchPlaceholder: "Search models by name...",
|
|
67
|
+
recommend: "Recommended",
|
|
68
|
+
unknown: "Unknown",
|
|
69
|
+
comparisonTitle: "Model Price Comparison (Points)",
|
|
70
|
+
noModelsFound: "No matching models found",
|
|
71
|
+
visionYes: "Yes",
|
|
72
|
+
visionNo: "No",
|
|
73
|
+
tableHeader: {
|
|
74
|
+
name: "Model Name",
|
|
75
|
+
input: "Input / 1M Points",
|
|
76
|
+
output: "Output / 1M Points",
|
|
77
|
+
vision: "Vision"
|
|
78
|
+
},
|
|
79
|
+
faqTitle: "Frequently Asked Questions",
|
|
80
|
+
faqSubtitle: "Have questions? Check here first",
|
|
81
|
+
faq: [
|
|
82
|
+
{
|
|
83
|
+
q: "What are points?",
|
|
84
|
+
a: "Points are Nolo's usage unit. Every model call deducts points based on actual token consumption, so costs stay tied to real usage."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
q: "How do I recharge?",
|
|
88
|
+
a: "Choose any amount on the recharge page. Points are credited immediately and are not tied to any subscription package."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
q: "Do points expire?",
|
|
92
|
+
a: "No. Recharged points stay valid permanently."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
q: "Is it more cost-effective than subscriptions?",
|
|
96
|
+
a: "Usually yes. Nolo charges at actual API cost with no subscription premium, so you only pay for real usage."
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[Language.ZH_CN]: {
|
|
103
|
+
translation: {
|
|
104
|
+
pricing: {
|
|
105
|
+
title: "按量付费",
|
|
106
|
+
subtitle: "按实际消耗的 Token 扣费,积分永久有效。\n余额达到 19 自动解锁专业版,无订阅绑定,随时降档。",
|
|
107
|
+
free: "免费",
|
|
108
|
+
points: "{{num}} 积分",
|
|
109
|
+
tiers: {
|
|
110
|
+
starter: {
|
|
111
|
+
name: "基础版",
|
|
112
|
+
meta: "注册即可使用",
|
|
113
|
+
price: "免费",
|
|
114
|
+
features: [
|
|
115
|
+
"标准 LLM 模型",
|
|
116
|
+
"多 Agent 协作",
|
|
117
|
+
"单文件分析",
|
|
118
|
+
"对话历史保存"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
pro: {
|
|
122
|
+
name: "专业版",
|
|
123
|
+
meta: "余额达到 19 积分",
|
|
124
|
+
price: "余额满 19 积分解锁",
|
|
125
|
+
features: [
|
|
126
|
+
"批量文件分析",
|
|
127
|
+
"实时联网搜索",
|
|
128
|
+
"优先处理队列"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
advanced: {
|
|
132
|
+
name: "高阶版",
|
|
133
|
+
meta: "余额保持 ≥ 199 积分",
|
|
134
|
+
price: "余额 ≥ 199 积分解锁",
|
|
135
|
+
features: [
|
|
136
|
+
"GPT Pro 系列模型",
|
|
137
|
+
"Claude Opus 模型",
|
|
138
|
+
"夜间自主运行 (Autopilot)",
|
|
139
|
+
"Flex Pro 智能路由"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
dedicated: {
|
|
143
|
+
name: "独享实例",
|
|
144
|
+
meta: "余额保持 ≥ 999 积分",
|
|
145
|
+
price: "余额 ≥ 999 积分解锁",
|
|
146
|
+
features: [
|
|
147
|
+
"独立虚拟机执行环境",
|
|
148
|
+
"隔离的计算资源",
|
|
149
|
+
"支持长时间超重任务"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
cta: {
|
|
154
|
+
titleLoggedIn: "灵活充值",
|
|
155
|
+
titleLoggedOut: "免费体验",
|
|
156
|
+
descLoggedIn: "充值积分即时到账。余额达到 19 解锁专业版,达到 199 解锁高阶版。",
|
|
157
|
+
descLoggedOut: "注册即可体验免费额度,先试再决定是否充值。",
|
|
158
|
+
btnRecharge: "充值积分",
|
|
159
|
+
btnFreeStart: "免费开始",
|
|
160
|
+
btnDirectRecharge: "直接充值",
|
|
161
|
+
trustLoggedIn: "支持退款 • 按量扣费 • 永久有效",
|
|
162
|
+
trustLoggedOut: "无需信用卡 • 注册即用 • 无订阅绑定"
|
|
163
|
+
},
|
|
164
|
+
searchPlaceholder: "按模型名搜索...",
|
|
165
|
+
recommend: "推荐",
|
|
166
|
+
unknown: "未知",
|
|
167
|
+
comparisonTitle: "模型价格对比(积分)",
|
|
168
|
+
noModelsFound: "未找到匹配的模型",
|
|
169
|
+
visionYes: "支持",
|
|
170
|
+
visionNo: "不支持",
|
|
171
|
+
tableHeader: {
|
|
172
|
+
name: "模型名称",
|
|
173
|
+
input: "输入 / 1M 积分",
|
|
174
|
+
output: "输出 / 1M 积分",
|
|
175
|
+
vision: "视觉识别"
|
|
176
|
+
},
|
|
177
|
+
searchBoxPlaceholder: "按模型名搜索...",
|
|
178
|
+
faqTitle: "常见问题",
|
|
179
|
+
faqSubtitle: "有疑问?先看这里",
|
|
180
|
+
faq: [
|
|
181
|
+
{
|
|
182
|
+
q: "积分是什么?",
|
|
183
|
+
a: "积分是 Nolo 的使用量单位。每次调用 AI 模型时,按实际消耗的 Token 数扣除对应积分。不同模型消耗速率不同,可按需切换,自主掌控支出。"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
q: "怎么充值?",
|
|
187
|
+
a: "在充值页面选择任意金额即可,积分实时到账,不绑定任何套餐。"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
q: "积分会过期吗?",
|
|
191
|
+
a: "不会。充值的积分长期有效,永不过期。"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
q: "比包月订阅更划算吗?",
|
|
195
|
+
a: "通常更划算。Nolo 按实际 API 成本透明计费,没有订阅溢价,只为实际消耗付费。"
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
[Language.ZH_HANT]: {
|
|
202
|
+
translation: {
|
|
203
|
+
pricing: {
|
|
204
|
+
title: "按量付費",
|
|
205
|
+
subtitle: "按實際消耗的 Token 扣費,積分永久有效。\n餘額達到 19 自動解鎖專業版,無訂閱綁定,隨時降檔。",
|
|
206
|
+
free: "免費",
|
|
207
|
+
points: "{{num}} 積分",
|
|
208
|
+
tiers: {
|
|
209
|
+
starter: {
|
|
210
|
+
name: "基礎版",
|
|
211
|
+
meta: "註冊即可使用",
|
|
212
|
+
price: "免費",
|
|
213
|
+
features: [
|
|
214
|
+
"標準 LLM 模型",
|
|
215
|
+
"多 Agent 協作",
|
|
216
|
+
"單檔案分析",
|
|
217
|
+
"對話歷史保存"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
pro: {
|
|
221
|
+
name: "專業版",
|
|
222
|
+
meta: "餘額達到 19 積分",
|
|
223
|
+
price: "餘額滿 19 積分解鎖",
|
|
224
|
+
features: [
|
|
225
|
+
"批次檔案分析",
|
|
226
|
+
"即時聯網搜尋",
|
|
227
|
+
"優先處理佇列"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
advanced: {
|
|
231
|
+
name: "高階版",
|
|
232
|
+
meta: "餘額保持 ≥ 199 積分",
|
|
233
|
+
price: "餘額 ≥ 199 積分解鎖",
|
|
234
|
+
features: [
|
|
235
|
+
"GPT Pro 系列模型",
|
|
236
|
+
"Claude Opus 模型",
|
|
237
|
+
"夜間自主運行 (Autopilot)",
|
|
238
|
+
"Flex Pro 智能路由"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
dedicated: {
|
|
242
|
+
name: "獨享實例",
|
|
243
|
+
meta: "餘額保持 ≥ 999 積分",
|
|
244
|
+
price: "餘額 ≥ 999 積分解鎖",
|
|
245
|
+
features: [
|
|
246
|
+
"獨立虛擬機執行環境",
|
|
247
|
+
"隔離的計算資源",
|
|
248
|
+
"支援長時間超重任務"
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
cta: {
|
|
253
|
+
titleLoggedIn: "靈活充值",
|
|
254
|
+
titleLoggedOut: "免費體驗",
|
|
255
|
+
descLoggedIn: "充值積分即時到帳。餘額達到 19 解鎖專業版,達到 199 解鎖高階版。",
|
|
256
|
+
descLoggedOut: "註冊即可體驗免費額度,先試再決定是否充值。",
|
|
257
|
+
btnRecharge: "充值積分",
|
|
258
|
+
btnFreeStart: "免費開始",
|
|
259
|
+
btnDirectRecharge: "直接充值",
|
|
260
|
+
trustLoggedIn: "支援退款 • 按量扣費 • 永久有效",
|
|
261
|
+
trustLoggedOut: "無需信用卡 • 註冊即用 • 無訂閱綁定"
|
|
262
|
+
},
|
|
263
|
+
searchPlaceholder: "按模型名搜尋...",
|
|
264
|
+
recommend: "推薦",
|
|
265
|
+
unknown: "未知",
|
|
266
|
+
comparisonTitle: "模型價格對比(積分)",
|
|
267
|
+
noModelsFound: "未找到匹配的模型",
|
|
268
|
+
visionYes: "支援",
|
|
269
|
+
visionNo: "不支援",
|
|
270
|
+
tableHeader: {
|
|
271
|
+
name: "模型名稱",
|
|
272
|
+
input: "輸入 / 1M 積分",
|
|
273
|
+
output: "輸出 / 1M 積分",
|
|
274
|
+
vision: "視覺識別"
|
|
275
|
+
},
|
|
276
|
+
faqTitle: "常見問題",
|
|
277
|
+
faqSubtitle: "有疑問?先看這裡",
|
|
278
|
+
faq: [
|
|
279
|
+
{
|
|
280
|
+
q: "積分是什麼?",
|
|
281
|
+
a: "積分是 Nolo 的使用量單位。每次調用 AI 模型時,按實際消耗的 Token 數扣除對應積分。不同模型消耗速率不同,可按需切換,自主掌控支出。"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
q: "怎麼充值?",
|
|
285
|
+
a: "在充值頁面選擇任意金額即可,積分即時到帳,不綁定任何套餐。"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
q: "積分會過期嗎?",
|
|
289
|
+
a: "不會。充值的積分長期有效,永不過期。"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
q: "比包月訂閱更划算嗎?",
|
|
293
|
+
a: "通常更划算。Nolo 按實際 API 成本透明計費,沒有訂閱溢價,只為實際消耗付費。"
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
[Language.JA]: {
|
|
300
|
+
translation: {
|
|
301
|
+
pricing: {
|
|
302
|
+
title: "従量課金制",
|
|
303
|
+
subtitle: "実際のトークン消費量に基づいてポイントを減算。ポイントの有効期限はありません。\n残高が19ポイントに達すると自動的にプロ版がアンロックされます。いつでもダウングレード可能で、定期購入の縛りはありません。",
|
|
304
|
+
free: "無料",
|
|
305
|
+
points: "{{num}} ポイント",
|
|
306
|
+
tiers: {
|
|
307
|
+
starter: {
|
|
308
|
+
name: "スターター",
|
|
309
|
+
meta: "登録ですぐに使用可能",
|
|
310
|
+
price: "無料",
|
|
311
|
+
features: [
|
|
312
|
+
"標準的なLLMモデル",
|
|
313
|
+
"マルチエージェント協調",
|
|
314
|
+
"単一ファイル分析",
|
|
315
|
+
"チャット履歴の保存"
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
pro: {
|
|
319
|
+
name: "プロ",
|
|
320
|
+
meta: "残高19ポイント到達",
|
|
321
|
+
price: "19ポイントでアンロック",
|
|
322
|
+
features: [
|
|
323
|
+
"複数ファイル分析",
|
|
324
|
+
"リアルタイムWeb検索",
|
|
325
|
+
"優先処理キュー"
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
advanced: {
|
|
329
|
+
name: "アドバンスド",
|
|
330
|
+
meta: "残高199ポイント以上を維持",
|
|
331
|
+
price: "199ポイントでアンロック",
|
|
332
|
+
features: [
|
|
333
|
+
"GPT Pro 系列モデル",
|
|
334
|
+
"Claude Opus へのアクセス",
|
|
335
|
+
"夜間 Autopilot 自律実行",
|
|
336
|
+
"Flex Pro スマートルーティング"
|
|
337
|
+
]
|
|
338
|
+
},
|
|
339
|
+
dedicated: {
|
|
340
|
+
name: "専有インスタンス",
|
|
341
|
+
meta: "残高999ポイント以上を維持",
|
|
342
|
+
price: "999ポイントでアンロック",
|
|
343
|
+
features: [
|
|
344
|
+
"独立した仮想マシン実行環境",
|
|
345
|
+
"隔離された計算リソース",
|
|
346
|
+
"長時間・高負荷タスクの実行"
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
cta: {
|
|
351
|
+
titleLoggedIn: "フレキシブルなチャージ",
|
|
352
|
+
titleLoggedOut: "無料体験",
|
|
353
|
+
descLoggedIn: "チャージ後、ポイントは即座に反映されます。19ポイントでプロ版、199ポイントでアドバンスドがアンロックされます。",
|
|
354
|
+
descLoggedOut: "登録後すぐに無料枠を体験できます。",
|
|
355
|
+
btnRecharge: "ポイントをチャージ",
|
|
356
|
+
btnFreeStart: "無料で開始",
|
|
357
|
+
btnDirectRecharge: "直接チャージ",
|
|
358
|
+
trustLoggedIn: "返金可能 • 従量課金 • 有効期限なし",
|
|
359
|
+
trustLoggedOut: "クレジットカード不要 • 登録だけで開始 • 定期購入の縛りなし"
|
|
360
|
+
},
|
|
361
|
+
searchPlaceholder: "モデル名で検索...",
|
|
362
|
+
recommend: "オススメ",
|
|
363
|
+
unknown: "不明",
|
|
364
|
+
comparisonTitle: "モデル価格比較(ポイント)",
|
|
365
|
+
noModelsFound: "該当するモデルが見つかりません",
|
|
366
|
+
visionYes: "対応",
|
|
367
|
+
visionNo: "非対応",
|
|
368
|
+
tableHeader: {
|
|
369
|
+
name: "モデル名",
|
|
370
|
+
input: "入力 / 1M ポイント",
|
|
371
|
+
output: "出力 / 1M ポイント",
|
|
372
|
+
vision: "ビジョン認識"
|
|
373
|
+
},
|
|
374
|
+
faqTitle: "よくある質問",
|
|
375
|
+
faqSubtitle: "ご質問がありますか? まずはこちらをご確認ください",
|
|
376
|
+
faq: [
|
|
377
|
+
{
|
|
378
|
+
q: "ポイントとは何ですか?",
|
|
379
|
+
a: "ポイントは Nolo の使用量単位です。AI モデルを呼び出すたびに、実際に消費されたトークン数に基づいて差し引かれます。"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
q: "チャージ方法は?",
|
|
383
|
+
a: "チャージページで任意の金額を選択するだけで、ポイントが即座に反映されます。特定のパッケージには縛られません。"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
q: "ポイントに有効期限はありますか?",
|
|
387
|
+
a: "いいえ。チャージされたポイントは長期的に有効で、期限はありません。"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
q: "月額サブスクリプションよりお得ですか?",
|
|
391
|
+
a: "通常はお得です。Nolo は実際の API コストに基づいて透明性の高い課金を行い、実際の消費分だけを支払います。"
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { AgentRuntimeDecision } from "../../agent-runtime";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type DesktopAgentRuntimeReadinessStatus =
|
|
4
4
|
| {
|
|
5
5
|
ok: true;
|
|
6
6
|
host: "desktop";
|
|
7
|
-
|
|
7
|
+
providerRuntimeState: "unconfigured" | "stopped" | "running" | "error" | "starting";
|
|
8
|
+
localCapabilities: string[];
|
|
8
9
|
decision: AgentRuntimeDecision;
|
|
9
10
|
missingLocalCapabilities: string[];
|
|
10
11
|
}
|
|
@@ -19,7 +20,7 @@ type FetchDesktopAgentRuntimeStatusArgs = {
|
|
|
19
20
|
|
|
20
21
|
export async function fetchDesktopAgentRuntimeStatus({
|
|
21
22
|
fetchImpl = fetch,
|
|
22
|
-
}: FetchDesktopAgentRuntimeStatusArgs = {}): Promise<
|
|
23
|
+
}: FetchDesktopAgentRuntimeStatusArgs = {}): Promise<DesktopAgentRuntimeReadinessStatus> {
|
|
23
24
|
try {
|
|
24
25
|
const response = await fetchImpl("/api/desktop/agent-runtime/status", {
|
|
25
26
|
method: "GET",
|
|
@@ -32,7 +33,7 @@ export async function fetchDesktopAgentRuntimeStatus({
|
|
|
32
33
|
error: typeof data?.error === "string" ? data.error : "Failed to load desktop agent runtime status",
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
return data as
|
|
36
|
+
return data as DesktopAgentRuntimeReadinessStatus;
|
|
36
37
|
} catch (error) {
|
|
37
38
|
return {
|
|
38
39
|
ok: false,
|
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
AgentRuntimeMessageContent,
|
|
3
3
|
LocalAgentTurnResult,
|
|
4
4
|
} from "../../agent-runtime";
|
|
5
|
+
import { buildAgentRunDialogLineageFields } from "../../ai/agent/agentRunDialogLineage";
|
|
5
6
|
|
|
6
7
|
export type DesktopAgentRuntimeTurnResult =
|
|
7
8
|
| {
|
|
@@ -26,7 +27,9 @@ function buildDesktopAgentRuntimeTurnBody(args: RunDesktopAgentRuntimeTurnArgs)
|
|
|
26
27
|
return {
|
|
27
28
|
agentRef: args.agentRef,
|
|
28
29
|
input: args.input,
|
|
29
|
-
...(
|
|
30
|
+
...buildAgentRunDialogLineageFields({
|
|
31
|
+
continueDialogId: args.continueDialogId,
|
|
32
|
+
}),
|
|
30
33
|
...(typeof args.maxToolRounds === "number" ? { maxToolRounds: args.maxToolRounds } : {}),
|
|
31
34
|
...(args.cwd ? { cwd: args.cwd } : {}),
|
|
32
35
|
};
|
package/app/utils/imageUtils.ts
CHANGED
|
@@ -101,68 +101,98 @@ export function dataURLtoFile(
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
const normalizeCompressedFile = (sourceFile: File, compressed: Blob | File): File => {
|
|
105
|
+
if (compressed instanceof File) {
|
|
106
|
+
return compressed;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return new File([compressed], sourceFile.name, {
|
|
110
|
+
type: compressed.type || sourceFile.type || "application/octet-stream",
|
|
111
|
+
lastModified: sourceFile.lastModified || Date.now(),
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export async function compressImageFile(
|
|
116
|
+
imageFile: File,
|
|
114
117
|
options?: ImageCompressionOptions
|
|
115
|
-
): Promise<
|
|
118
|
+
): Promise<File> {
|
|
116
119
|
const mergedOptions: ImageCompressionOptions = {
|
|
117
120
|
...DEFAULT_COMPRESSION_OPTIONS,
|
|
118
121
|
...options,
|
|
119
122
|
};
|
|
120
123
|
|
|
121
|
-
// 为转换生成一个“相对唯一”的文件名
|
|
122
|
-
const timestamp = Date.now();
|
|
123
|
-
const filename = `image_${timestamp}.png`; // 实际类型由 dataURL 决定
|
|
124
|
-
|
|
125
|
-
const imageFile = dataURLtoFile(imageDataUrl, filename);
|
|
126
|
-
|
|
127
|
-
if (!imageFile) {
|
|
128
|
-
console.warn(
|
|
129
|
-
"[imageUtils] compressImage: cannot convert data URL to File, return original"
|
|
130
|
-
);
|
|
131
|
-
return imageDataUrl;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
124
|
const originalSizeMB = toMegabytes(imageFile.size);
|
|
135
125
|
const targetSizeMB =
|
|
136
126
|
mergedOptions.maxSizeMB ?? DEFAULT_COMPRESSION_OPTIONS.maxSizeMB;
|
|
137
127
|
|
|
138
128
|
console.log(
|
|
139
|
-
`[imageUtils]
|
|
129
|
+
`[imageUtils] compressImageFile: original size = ${originalSizeMB.toFixed(
|
|
140
130
|
2
|
|
141
131
|
)} MB`
|
|
142
132
|
);
|
|
143
133
|
|
|
144
|
-
// 如果原图本来就比目标尺寸小,则直接跳过压缩,保证画质
|
|
145
134
|
if (originalSizeMB <= targetSizeMB) {
|
|
146
135
|
console.log(
|
|
147
|
-
"[imageUtils]
|
|
136
|
+
"[imageUtils] compressImageFile: image already smaller than target, skip compression"
|
|
148
137
|
);
|
|
149
|
-
return
|
|
138
|
+
return imageFile;
|
|
150
139
|
}
|
|
151
140
|
|
|
152
141
|
try {
|
|
153
|
-
const
|
|
154
|
-
|
|
142
|
+
const compressedBlob = await imageCompression(imageFile, mergedOptions);
|
|
143
|
+
const compressedFile = normalizeCompressedFile(imageFile, compressedBlob);
|
|
155
144
|
const compressedSizeMB = toMegabytes(compressedFile.size);
|
|
145
|
+
|
|
156
146
|
console.log(
|
|
157
|
-
`[imageUtils]
|
|
147
|
+
`[imageUtils] compressImageFile: compressed size = ${compressedSizeMB.toFixed(
|
|
158
148
|
2
|
|
159
149
|
)} MB (target <= ${targetSizeMB.toFixed(2)} MB)`
|
|
160
150
|
);
|
|
161
151
|
|
|
162
|
-
// 理论上不会出现压缩后比原图更大的情况,但这里做一个兜底
|
|
163
152
|
if (compressedFile.size >= imageFile.size) {
|
|
164
153
|
console.log(
|
|
165
|
-
"[imageUtils]
|
|
154
|
+
"[imageUtils] compressImageFile: compressed file is not smaller, return original"
|
|
155
|
+
);
|
|
156
|
+
return imageFile;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return compressedFile;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
console.error("[imageUtils] compressImageFile failed:", error);
|
|
162
|
+
return imageFile;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 压缩一张 dataURL 图片。
|
|
168
|
+
* 使用 browser-image-compression 库。
|
|
169
|
+
*
|
|
170
|
+
* @param imageDataUrl 原始图片的 dataURL(Base64)
|
|
171
|
+
* @param options 可选的压缩参数,会覆盖默认值
|
|
172
|
+
* @returns 压缩后的 dataURL;如果压缩失败或不划算,会返回原始 dataURL
|
|
173
|
+
*/
|
|
174
|
+
export async function compressImage(
|
|
175
|
+
imageDataUrl: string,
|
|
176
|
+
options?: ImageCompressionOptions
|
|
177
|
+
): Promise<string> {
|
|
178
|
+
// 为转换生成一个“相对唯一”的文件名
|
|
179
|
+
const timestamp = Date.now();
|
|
180
|
+
const filename = `image_${timestamp}.png`; // 实际类型由 dataURL 决定
|
|
181
|
+
|
|
182
|
+
const imageFile = dataURLtoFile(imageDataUrl, filename);
|
|
183
|
+
|
|
184
|
+
if (!imageFile) {
|
|
185
|
+
console.warn(
|
|
186
|
+
"[imageUtils] compressImage: cannot convert data URL to File, return original"
|
|
187
|
+
);
|
|
188
|
+
return imageDataUrl;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
const compressedFile = await compressImageFile(imageFile, options);
|
|
193
|
+
if (compressedFile === imageFile) {
|
|
194
|
+
console.log(
|
|
195
|
+
"[imageUtils] compressImage: file-based compression kept original image"
|
|
166
196
|
);
|
|
167
197
|
return imageDataUrl;
|
|
168
198
|
}
|
|
@@ -241,4 +271,4 @@ export const waitForFileReady = async (
|
|
|
241
271
|
|
|
242
272
|
console.warn("[imageUtils] waitForFileReady: timeout for", url);
|
|
243
273
|
return false;
|
|
244
|
-
};
|
|
274
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AdminPermissions = {
|
|
2
|
+
usageManagement?: boolean;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export const hasUsageManagementPermission = (value: unknown): boolean => {
|
|
6
|
+
if (!value || typeof value !== "object") return false;
|
|
7
|
+
const permissions = (value as { adminPermissions?: AdminPermissions | null })
|
|
8
|
+
.adminPermissions;
|
|
9
|
+
return permissions?.usageManagement === true;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const mergeAdminPermissions = (
|
|
13
|
+
current: unknown,
|
|
14
|
+
patch: Partial<AdminPermissions>
|
|
15
|
+
): AdminPermissions => ({
|
|
16
|
+
...(current && typeof current === "object" ? (current as AdminPermissions) : {}),
|
|
17
|
+
...patch,
|
|
18
|
+
});
|
package/auth/authSlice.ts
CHANGED
|
@@ -444,8 +444,18 @@ export const authSlice = createSliceWithThunks({
|
|
|
444
444
|
);
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
const profileData: {
|
|
448
|
-
|
|
447
|
+
const profileData: {
|
|
448
|
+
balance: number;
|
|
449
|
+
gptProAccess?: User["gptProAccess"];
|
|
450
|
+
adminPermissions?: User["adminPermissions"];
|
|
451
|
+
} =
|
|
452
|
+
await response.json();
|
|
453
|
+
return {
|
|
454
|
+
userId,
|
|
455
|
+
balance: profileData.balance,
|
|
456
|
+
gptProAccess: profileData.gptProAccess,
|
|
457
|
+
adminPermissions: profileData.adminPermissions,
|
|
458
|
+
};
|
|
449
459
|
} catch (error: any) {
|
|
450
460
|
return thunkAPI.rejectWithValue(
|
|
451
461
|
error.message || "获取用户信息时发生未知错误"
|
|
@@ -457,16 +467,20 @@ export const authSlice = createSliceWithThunks({
|
|
|
457
467
|
console.error("获取用户 Profile 失败:", action.payload);
|
|
458
468
|
},
|
|
459
469
|
fulfilled: (state, action) => {
|
|
460
|
-
const { userId, balance } = action.payload;
|
|
461
|
-
if (state.currentUser && state.currentUser.userId === userId) {
|
|
462
|
-
state.currentUser.balance = balance;
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
+
const { userId, balance, gptProAccess, adminPermissions } = action.payload;
|
|
471
|
+
if (state.currentUser && state.currentUser.userId === userId) {
|
|
472
|
+
state.currentUser.balance = balance;
|
|
473
|
+
state.currentUser.gptProAccess = gptProAccess;
|
|
474
|
+
state.currentUser.adminPermissions = adminPermissions;
|
|
475
|
+
}
|
|
476
|
+
const userIndex = state.users.findIndex(
|
|
477
|
+
(user) => user.userId === userId
|
|
478
|
+
);
|
|
479
|
+
if (userIndex !== -1) {
|
|
480
|
+
state.users[userIndex].balance = balance;
|
|
481
|
+
state.users[userIndex].gptProAccess = gptProAccess;
|
|
482
|
+
state.users[userIndex].adminPermissions = adminPermissions;
|
|
483
|
+
}
|
|
470
484
|
},
|
|
471
485
|
}
|
|
472
486
|
),
|