feat(server): scenario mapping (#13404)

fix AI-404

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

* **New Features**
* Introduced scenario-based configuration for copilot, allowing default
model assignments for various AI use cases.
  * Added a new image generation model to the available options.

* **Improvements**
* Refined copilot provider settings by removing deprecated fallback
options and standardizing base URL configuration.
* Enhanced prompt management to support scenario-driven updates and
improved configuration handling.
* Updated admin and settings interfaces to support new scenario
configurations.

* **Bug Fixes**
* Removed deprecated or unused prompts and related references across
platforms for consistency.

* **Other**
* Improved test coverage and updated test assets to reflect prompt and
scenario changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-08-04 17:50:38 +08:00
committed by GitHub
parent 7a93db4d12
commit 0fcb4cb0fe
23 changed files with 386 additions and 514 deletions
+4
View File
@@ -256,6 +256,10 @@
"type": "Boolean",
"desc": "Whether to enable the copilot plugin."
},
"scenarios": {
"type": "Object",
"desc": "The models used in the scene for the copilot, will use this config if enabled."
},
"providers.openai": {
"type": "Object",
"desc": "The config for the openai provider.",
@@ -142,6 +142,7 @@ export const KNOWN_CONFIG_GROUPS = [
module: 'copilot',
fields: [
'enabled',
'scenarios',
'providers.openai',
'providers.gemini',
'providers.perplexity',
@@ -17,5 +17,4 @@ enum class Prompt(val value: String) {
MakeItShorter("Make it shorter"),
ContinueWriting("Continue writing"),
ChatWithAFFiNEAI("Chat With AFFiNE AI"),
SearchWithAFFiNEAI("Search With AFFiNE AI"),
}
@@ -25,5 +25,4 @@ public enum PromptName: String, Codable {
case makeItShorter = "Make it shorter"
case continueWriting = "Continue writing"
case chatWithAffineAI = "Chat With AFFiNE AI"
case searchWithAffineAI = "Search With AFFiNE AI"
}
@@ -3,7 +3,6 @@
export const promptKeys = [
// text actions
'Chat With AFFiNE AI',
'Search With AFFiNE AI',
'Summary',
'Summary as title',
'Generate a caption',