fix(ai): correct apiKeySet detection and prevent stale key reuse

- Fix apiKeySet reporting false positives for local no-key configs by
  resolving the actual key via resolveApiKey and excluding placeholders
- Prevent editing a config from reusing an incompatible API key when
  provider or connection mode has changed
- Pass summary strategy to single-session generation for consistency

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
diguaandCursor authored and digua committed 2026-05-27 23:47:27 +08:00
1 parent a9b8599417
commit 88ab0ae172
11 files changed
+232 -18

No files matched your search

@@ -16,6 +16,7 @@ import {
generateSessionSummary,
checkSessionsCanGenerateSummary,
type SummaryDeps,
type SummaryOptions,
completeSimple,
type PiTextContent,
} from '../ai'
@@ -67,7 +68,7 @@ export async function generateSummary(
sessionId: string,
chatSessionId: number,
serviceDeps: SummaryServiceDeps,
options?: { locale?: string; forceRegenerate?: boolean }
options?: SummaryOptions
) {
const llmConfig = serviceDeps.getLlmConfig()
if (!llmConfig) {
@@ -83,7 +84,7 @@ export async function generateAllSummaries(
adapter: SessionRuntimeAdapter,
sessionId: string,
serviceDeps: SummaryServiceDeps,
options?: { locale?: string; forceRegenerate?: boolean }
options?: SummaryOptions
) {
const llmConfig = serviceDeps.getLlmConfig()
if (!llmConfig) {