feat(server): adapt gemini3.1 preview (#14583)

#### PR Dependency Tree


* **PR #14583** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added Gemini 3.1 Pro Preview support (text, image, audio) and new
GPT‑5 variants as defaults; centralized persistent telemetry state for
more reliable client identity.

* **UX**
  * Improved model submenu placement in chat preferences.
* More robust mindmap parsing, preview, regeneration and replace
behavior.

* **Chores**
  * Bumped AI SDK and related dependencies.

* **Tests**
  * Expanded/updated tests and increased timeouts for flaky flows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-03-08 00:53:16 +08:00
committed by GitHub
parent 9742e9735e
commit 9c55edeb62
36 changed files with 980 additions and 375 deletions

View File

@@ -15,6 +15,10 @@ import {
import { PromptService } from '../prompt/service';
import { CopilotProviderFactory } from '../providers/factory';
import type { CopilotProvider } from '../providers/provider';
import {
DEFAULT_RERANK_MODEL,
normalizeRerankModel,
} from '../providers/rerank';
import {
type ModelFullConditions,
ModelInputType,
@@ -114,10 +118,16 @@ class ProductionEmbeddingClient extends EmbeddingClient {
if (!prompt) {
throw new CopilotPromptNotFound({ name: RERANK_PROMPT });
}
const provider = await this.getProvider({ modelId: prompt.model });
const rerankModel = normalizeRerankModel(prompt.model);
if (prompt.model !== rerankModel) {
this.logger.warn(
`Unsupported rerank model "${prompt.model}" configured, falling back to "${DEFAULT_RERANK_MODEL}".`
);
}
const provider = await this.getProvider({ modelId: rerankModel });
const ranks = await provider.rerank(
{ modelId: prompt.model },
{ modelId: rerankModel },
embeddings.map(e => prompt.finish({ query, doc: e.content })),
{ signal }
);
@@ -171,7 +181,7 @@ class ProductionEmbeddingClient extends EmbeddingClient {
);
try {
// 4.1 mini's context windows large enough to handle all embeddings
// The rerank prompt is expected to handle the full deduped candidate list.
const ranks = await this.getEmbeddingRelevance(
query,
sortedEmbeddings,