@nimiplatform/app-tools 0.13.0 → 0.14.0
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/README.md +18 -4
- package/lib/app-dependency-combinations.mjs +4 -0
- package/lib/app-doctor-update.mjs +3 -0
- package/lib/app-icons.mjs +181 -0
- package/lib/app-info.mjs +21 -33
- package/lib/app-lifecycle-guidance.mjs +1 -0
- package/lib/app-scaffold-profiles.mjs +27 -2
- package/lib/app-scaffold.mjs +6 -5
- package/package.json +21 -20
- package/skills/nimi-app-lifecycle/SKILL.md +10 -4
- package/skills/nimi-app-lifecycle/references/adapt.md +2 -0
- package/skills/nimi-app-lifecycle/references/create.md +2 -0
- package/skills/nimi-app-lifecycle/references/release.md +2 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +11 -0
- package/templates/app-source/src/ai-studio-core/messages/en.json +6 -0
- package/templates/app-source/src/ai-studio-core/messages/zh.json +6 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +10 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +6 -2
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +3 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +24 -7
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +24 -5
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +5 -0
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +5 -0
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +24 -1
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +1 -0
- package/templates/default-starter/AGENTS.md +5 -2
- package/templates/default-starter/NIMI_APP.md +7 -0
- package/templates/default-starter/README.md +2 -0
- package/templates/default-starter/src/shell/App.tsx +6 -2
- package/templates/default-starter/src-tauri/Cargo.toml +3 -3
- package/templates/default-starter.manifest.json +6 -2
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimiplatform/app-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Public app-authoring CLI for Nimi App projects.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": ">=24.0.0"
|
|
8
|
+
"node": ">=24.22.1 <25.0.0"
|
|
9
9
|
},
|
|
10
10
|
"private": false,
|
|
11
11
|
"repository": {
|
|
@@ -18,31 +18,32 @@
|
|
|
18
18
|
"provenance": true
|
|
19
19
|
},
|
|
20
20
|
"nimiScaffoldVersions": {
|
|
21
|
-
"sdkVersion": "^0.
|
|
22
|
-
"appToolsVersion": "^0.
|
|
23
|
-
"nimicodingVersion": "0.
|
|
24
|
-
"aiSdkVersion": "^
|
|
25
|
-
"kitVersion": "^0.
|
|
26
|
-
"reactVersion": "^19.3.
|
|
27
|
-
"reactDomVersion": "^19.3.
|
|
28
|
-
"i18nextVersion": "^26.
|
|
29
|
-
"lucideReactVersion": "^1.
|
|
21
|
+
"sdkVersion": "^0.22.2",
|
|
22
|
+
"appToolsVersion": "^0.14.0",
|
|
23
|
+
"nimicodingVersion": "0.7.0",
|
|
24
|
+
"aiSdkVersion": "^7.0.150",
|
|
25
|
+
"kitVersion": "^0.22.1",
|
|
26
|
+
"reactVersion": "^19.3.1",
|
|
27
|
+
"reactDomVersion": "^19.3.1",
|
|
28
|
+
"i18nextVersion": "^26.5.6",
|
|
29
|
+
"lucideReactVersion": "^1.61.0",
|
|
30
30
|
"tsxVersion": "^4.23.15",
|
|
31
31
|
"typescriptVersion": "^6.0.3",
|
|
32
|
-
"nodeTypesVersion": "^24.19.
|
|
32
|
+
"nodeTypesVersion": "^24.19.2",
|
|
33
33
|
"reactTypesVersion": "^19.3.0",
|
|
34
34
|
"reactDomTypesVersion": "^19.3.0",
|
|
35
|
-
"viteVersion": "^8.3.
|
|
35
|
+
"viteVersion": "^8.3.5",
|
|
36
36
|
"viteReactPluginVersion": "^6.1.2",
|
|
37
37
|
"tailwindcssVersion": "^4.3.3",
|
|
38
38
|
"tailwindcssViteVersion": "^4.3.3",
|
|
39
39
|
"tauriCliVersion": "^2.11.4",
|
|
40
40
|
"yamlVersion": "^2.9.1",
|
|
41
|
-
"
|
|
41
|
+
"pngjsVersion": "^7.0.0",
|
|
42
|
+
"nimiShellTauriVersion": "0.11.1",
|
|
42
43
|
"electronPackagerVersion": "^20.3.0",
|
|
43
|
-
"electronVersion": "^
|
|
44
|
+
"electronVersion": "^45.0.0",
|
|
44
45
|
"esbuildVersion": "^0.28.2",
|
|
45
|
-
"packageManager": "pnpm@10.34.
|
|
46
|
+
"packageManager": "pnpm@10.34.7"
|
|
46
47
|
},
|
|
47
48
|
"bin": {
|
|
48
49
|
"nimi-app": "./bin/nimi-app.mjs"
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"prepublishOnly": "pnpm run build",
|
|
57
58
|
"test": "node ../scripts/with-workspace-surfaces.mjs -- pnpm run test:prepared",
|
|
58
59
|
"test:large-archive": "node --test test/app-pack-large.test.mjs",
|
|
59
|
-
"test:prepared": "node scripts/sync-scaffold-versions.mjs --check && node --test test/dev-shell.test.mjs && node --test test/app-dependency-combinations.test.mjs test/app-safety-profile.test.mjs test/app-project-lifecycle.test.mjs test/app-pack.test.mjs test/app-pack-large.test.mjs test/app-scaffold.test.mjs"
|
|
60
|
+
"test:prepared": "node scripts/sync-scaffold-versions.mjs --check && node --test test/dev-shell.test.mjs && node --test test/app-icons.test.mjs test/app-dependency-combinations.test.mjs test/app-safety-profile.test.mjs test/app-project-lifecycle.test.mjs test/app-pack.test.mjs test/app-pack-large.test.mjs test/app-scaffold.test.mjs"
|
|
60
61
|
},
|
|
61
62
|
"files": [
|
|
62
63
|
"bin",
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
}
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
|
-
"@types/node": "24.19.
|
|
85
|
-
"vite": "8.3.
|
|
86
|
-
"i18next": "26.
|
|
85
|
+
"@types/node": "24.19.2",
|
|
86
|
+
"vite": "8.3.5",
|
|
87
|
+
"i18next": "26.5.6"
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -5,7 +5,7 @@ description: Audit Nimi App adaptation feasibility, capability fit and cost, or
|
|
|
5
5
|
|
|
6
6
|
# Nimi App lifecycle
|
|
7
7
|
|
|
8
|
-
Start with the repository's package manifest, actual product entry and nearest instructions. Preserve the user's current product scope and stage. Read only the scenario needed now:
|
|
8
|
+
Start with the repository's package manifest, actual product entry and nearest instructions. Preserve the user's current product scope and stage. Reuse sufficient existing evidence; inspect further only to resolve uncertainty affecting the task. Read only the scenario needed now:
|
|
9
9
|
|
|
10
10
|
| Task | Guide |
|
|
11
11
|
| --- | --- |
|
|
@@ -19,16 +19,22 @@ Start with the repository's package manifest, actual product entry and nearest i
|
|
|
19
19
|
| Prepare a Release or Registry submission | [Release](references/release.md) |
|
|
20
20
|
| Verify real App behavior or installation | [Acceptance](references/acceptance.md) |
|
|
21
21
|
|
|
22
|
-
An audit or planning request
|
|
22
|
+
An audit or planning request delivers findings and a proposal; continue implementation only when it is also authorized. For ordinary product edits, follow existing code and tests and keep logic direct. Extract helpers or add layers for current reuse, a complex boundary, or a clear concept that improves readability. New fallback, retry, compatibility, concurrency, or recovery machinery must address a concrete failure mode in a supported path or an explicit contract; supported uncommon cases remain in scope. Reinitialize or run a release journey only when affected inputs or behavior require it.
|
|
23
|
+
|
|
24
|
+
## App introduction
|
|
25
|
+
|
|
26
|
+
Every App has an App-owned root `NIMI_APP.md`, the only source of its Home introduction. `metadata.readme` and README fallback are not supported. Write for actual users: current purpose, principal tasks and first-use actions, necessary configuration, relevant data handling and limitations, and help. Preserve technical precision for developer-tool users. Keep repository setup, architecture, build/release commands and acceptance logs in README or developer documentation. Never infer completed functionality from tests or planned features. Home supports inert Markdown and absolute HTTP(S) links; images become alt text and relative links/anchors are not navigable.
|
|
27
|
+
|
|
28
|
+
Create supplies a truthful unfinished-product introduction; the App author maintains it. Check/pack reject missing, blank, invalid UTF-8, non-regular or over-96-KiB introductions and the removed metadata field. Sync preserves the file without creating or rewriting it. Update the introduction when user behavior changes and review its content against the affected real journey; structural validation alone does not establish truthful product copy.
|
|
23
29
|
|
|
24
30
|
## Boundaries that matter
|
|
25
31
|
|
|
26
|
-
- App-owned workflows, tool handlers, business accounts, non-AI services and product presentation stay with the App. Nimi AI, configuration, managed storage and protected sessions use public SDK/Kit Local App surfaces. Display identity is not a business login ticket.
|
|
32
|
+
- App-owned workflows, tool handlers, business accounts, non-AI services and product presentation stay with the App. Nimi AI, configuration, managed storage and protected sessions use public SDK/Kit Local App surfaces. Validate unknown inputs once at their owning trust boundary; pass typed values inward without rechecking guarantees established by schemas, constructors, or internal contracts unless crossing a new trust boundary. Display identity is not a business login ticket.
|
|
27
33
|
- When implementing an existing App's first Nimi integration or foundation wiring change, follow the adaptation guide's same-package generated reference first. Reuse its Host, preload, renderer, session, App Access, AIConfig and AI call wiring; documentation complements that implementation. Preserve the original product journeys and settings rather than treating the reference workbench as the finished App. Reuse passing baseline results for ordinary business edits; creating or running a reference App is not a default audit prerequisite.
|
|
28
34
|
- Fresh Apps use pnpm, Vite and Desktop-supervised Electron. Existing Apps may use another renderer framework with an App-owned development command and the `electron-pnpm` build profile. A Next/server or Python project still needs real Host and backend lifecycle/build work. Preserve its original user tasks and framework where they fit; initialization does not convert the product.
|
|
29
35
|
- Read the selected app-tools package's `nimiScaffoldVersions` and the SDK/Kit migration notes. Fresh Apps use the tool default SDK/Kit combination; an existing App keeps its current supported SDK/Kit combination through sync and check while only the app-tools and nimi-coding tool dependencies follow the tool, and a declaration or tool update never upgrades business dependencies. Development can consume complete local npm tarballs through explicit pnpm-workspace overrides; keep the selected combination and lockfile, follow the package README, and do not require publication before iteration. Public release preflight requires registry resolutions; local package acceptance is not public installation evidence.
|
|
30
36
|
- App Tools maintains its fixed lifecycle skill, AGENTS block and declared engineering projections. Existing Apps have no fresh scaffold intent/lock. Preserve their Host, product source and license; report unknown file collisions rather than inventing ownership.
|
|
31
37
|
- GitHub owns publisher builds and Releases; Registry owns candidate validation and human admission; Runtime owns packages and App access; Desktop owns exact processes. These are separate facts. The external AI host owns the development task.
|
|
32
|
-
-
|
|
38
|
+
- Verify the requested behavior with checks for a concrete risk or project requirement. Add tests for important behavior or regression risks not already covered, without copying implementation logic or merely asserting structure; low-impact prose, styling, or mechanical edits do not automatically need new tests. Reuse passing results and stop when the requested behavior, required checks, and identified risks are sufficiently covered. Reopen verification only for new changes, failures, or unresolved risks affecting the conclusion; do not create extra evidence artifacts to restate established results. Missing prerequisites pause only dependent steps; mark unrun product paths affecting the conclusion NOT-VERIFIED and explain the impact. Passing checks do not prove publication or human approval.
|
|
33
39
|
|
|
34
40
|
The package's README and `nimi-app --help` expose this same guide before init. Explicit init/sync projects it into the App; dependency installation does not activate repository instructions.
|
|
@@ -72,3 +72,5 @@ directories (including the `dev` layout) are also excluded. A similarly named
|
|
|
72
72
|
App source directory without those output markers remains checked.
|
|
73
73
|
|
|
74
74
|
Separate development instructions from product-operation guides, including other host entry files actually used by the repository. Upstream supplier examples may remain as knowledge; check the active product/agent route instead of deleting by keyword. Keep unimplemented original workflows explicit rather than counting a visible menu or retained source as completion.
|
|
75
|
+
|
|
76
|
+
Maintain the App-owned root `NIMI_APP.md` as the user introduction under the lifecycle guide. Remove `metadata.readme`; check and pack use only the fixed file, and sync never supplies missing product prose. Keep engineering setup and verification records in repository/developer documentation.
|
|
@@ -5,3 +5,5 @@ Use `nimi-app create` with an App ID, title and the admitted features the user's
|
|
|
5
5
|
After creation: install dependencies, run `pnpm exec nimi-app init`, then sync/check. Init can be previewed with `--dry-run --json`. The lifecycle skill becomes project-local at init; create's package content can already be read for guidance.
|
|
6
6
|
|
|
7
7
|
Build App-owned routes and workflows on the generated carrier. Preserve the selected App identity and direct feature selection. Use existing package test/build commands and exercise the affected real App task through the official launcher. Placeholder artwork or an empty feature list does not make a release-ready product: complete the App's portable information before production packaging.
|
|
8
|
+
|
|
9
|
+
Maintain the App-owned root `NIMI_APP.md` as the user introduction under the lifecycle guide. Remove `metadata.readme`; check and pack use only the fixed file, and sync never supplies missing product prose. Keep engineering setup and verification records in repository/developer documentation.
|
|
@@ -17,3 +17,5 @@ An external publisher submits from its own fork; an authorized publisher sharing
|
|
|
17
17
|
Real matching unsigned or unnotarized posture is not automatically a blocker. Do not require KYC, non-null SBOM or purchased signing as a generic prerequisite. State proof strength according to what the existing verifier actually checks.
|
|
18
18
|
|
|
19
19
|
First publication and admission can precede installed acceptance. Verify first Catalog installation and business use afterward. Test an update only once a second, higher version is separately admitted; a future N+1 is not a prerequisite for the first release.
|
|
20
|
+
|
|
21
|
+
Maintain the App-owned root `NIMI_APP.md` as the user introduction under the lifecycle guide. Remove `metadata.readme`; check and pack use only the fixed file, and sync never supplies missing product prose. Keep engineering setup and verification records in repository/developer documentation.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Platform upgrade
|
|
2
2
|
|
|
3
|
+
App Tools 0.14 defaults to SDK 0.22.2, Kit/native 0.22.1, Tauri 0.11.1 and
|
|
4
|
+
protected-local 0.11.2. Upgrade this combination together with a matching Runtime. Existing
|
|
5
|
+
0.21 SDK/Kit combinations remain explicit selections; sync does not upgrade
|
|
6
|
+
business dependencies. Every App must own a root `NIMI_APP.md`; remove the
|
|
7
|
+
retired `metadata.readme` field. Review the SDK and Kit 0.22 migration notes
|
|
8
|
+
for Realm media delivery, Desktop Open v2 and LocalAgent Conversation changes.
|
|
9
|
+
|
|
3
10
|
Fresh App Tools 0.13 scaffolds require Kit `^0.21.0` or a later admitted pair
|
|
4
11
|
with the standard navigation contract. The combination list also contains
|
|
5
12
|
existing-adoption pairs; those do not permit older Kit in a new scaffold.
|
|
@@ -34,3 +41,7 @@ A scaffold from an app-tools version that still managed `LICENSE` hands it to th
|
|
|
34
41
|
For existing Apps, sync preserves the exact `package.json` text when its managed values are already current. A project formatter's whitespace or key ordering alone is not drift; actual managed value changes are still synchronized.
|
|
35
42
|
|
|
36
43
|
Do not downgrade away required features, edit installed package code or disable checks to get a green result. A platform capability awaiting publication blocks public release reproducibility, not independent engineering work. Validate a representative actual old-to-new combination; do not build a general migration framework.
|
|
44
|
+
|
|
45
|
+
README.md and SECURITY.md belong to the App after creation. If an earlier lock lists them as managed, explicit sync transfers ownership without rewriting their contents or recreating missing documents. Run sync and commit the updated lock; subsequent sync and check preserve the App-authored documents.
|
|
46
|
+
|
|
47
|
+
Maintain the App-owned root `NIMI_APP.md` as the user introduction under the lifecycle guide. Remove `metadata.readme`; check and pack use only the fixed file, and sync never supplies missing product prose. Keep engineering setup and verification records in repository/developer documentation.
|
|
@@ -138,13 +138,16 @@
|
|
|
138
138
|
"runtimeTimeout": "This task timed out.",
|
|
139
139
|
"streamInterrupted": "The live result connection ended before Runtime confirmed a final state.",
|
|
140
140
|
"runtimeCallFailed": "This generation could not be completed.",
|
|
141
|
+
"contentFilterBlocked": "Content filtering blocked this request or response.",
|
|
141
142
|
"inputLimitExceeded": "The configured model cannot take this whole input. Nothing was shortened or answered in part.",
|
|
142
143
|
"textBehaviorUnsupported": "The selected model cannot run this request as set: its tools, structured output, reasoning or generation settings are not supported. No partial answer was accepted.",
|
|
143
144
|
"mediaOptionUnsupported": "The selected model cannot use one or more media settings in this request.",
|
|
145
|
+
"embeddingPurposeUnsupported": "The selected model does not support the current retrieval purpose setting.",
|
|
144
146
|
"modalityUnsupported": "The selected configuration does not support one or more inputs or options in this request.",
|
|
145
147
|
"providerRateLimited": "The cloud service refused this request because a rate or usage limit was reached. For a ChatGPT plan connection, this is the plan's usage limit for this app.",
|
|
146
148
|
"mediaCodecUnavailable": "The audio and video tools required by this request were unavailable when it ran.",
|
|
147
149
|
"localLoadFailed": "The current on-device configuration could not run this request.",
|
|
150
|
+
"localConfigurationMissing": "This on-device AI capability has no runnable configuration yet. Saving an App selection does not mean its model is ready.",
|
|
148
151
|
"voiceInputRequired": "The selected speech model needs an explicit compatible voice before it can synthesize audio.",
|
|
149
152
|
"voiceTargetMismatch": "This voice asset was created for a different speech model and cannot be used with the current selection.",
|
|
150
153
|
"voiceUnavailable": "The selected voice is no longer available.",
|
|
@@ -169,13 +172,16 @@
|
|
|
169
172
|
"runtimeTimeout": "Try again later. If it still times out, open Runtime details to find the cause.",
|
|
170
173
|
"streamInterrupted": "Check the task status; retry only after confirming it did not complete.",
|
|
171
174
|
"runtimeCallFailed": "Try again once. If it still fails, open Runtime details to find the cause.",
|
|
175
|
+
"contentFilterBlocked": "Try removing or redacting any restricted content, or adjusting the selected context, then submit your request again.",
|
|
172
176
|
"inputLimitExceeded": "Shorten the input, or configure a model that accepts longer input, then run it again.",
|
|
173
177
|
"textBehaviorUnsupported": "Open Parameters and reset the settings this model does not accept, or choose a model that supports this behavior in Desktop AI Capabilities, then run again.",
|
|
174
178
|
"mediaOptionUnsupported": "Open Parameters and reset the unsupported settings, then run again. You can also choose a model that supports those settings in App AI configuration.",
|
|
179
|
+
"embeddingPurposeUnsupported": "Open Parameters and choose \"Content to search\" when indexing documents or \"Search query\" when searching them, then run again. If that purpose is still unsupported, choose a model that supports it in App AI configuration.",
|
|
175
180
|
"modalityUnsupported": "Change the request inputs or reset the unsupported options in Parameters before running again. You can also choose a configuration that supports the request.",
|
|
176
181
|
"providerRateLimited": "Wait and try again later. For a ChatGPT plan connection, review usage at {{usageUrl}}. You can also open App AI configuration and choose another model.",
|
|
177
182
|
"mediaCodecUnavailable": "In Nimi Desktop, open AI Capabilities → Advanced & Diagnostics → Audio and video tools. Install or repair it if needed, wait until the components are installed, then run this request again.",
|
|
178
183
|
"localLoadFailed": "Check that the inputs and parameters match the selected model. In Desktop AI Capabilities, confirm that its model and components are prepared, or repair the setup before running again. Runtime details show the reported failure.",
|
|
184
|
+
"localConfigurationMissing": "In Nimi Home, open AI Capabilities and finish setting up the local model for this capability. Once it is available, return here and submit your current input again. Runtime details retain the reported failure.",
|
|
179
185
|
"voiceInputRequired": "Open Parameters and choose a supported preset or compatible local voice asset. If this model needs an asset and none is listed, create one under Voice Creation, then return here.",
|
|
180
186
|
"voiceTargetMismatch": "Choose a voice asset compatible with the current speech model, or create one under Voice Creation before retrying.",
|
|
181
187
|
"voiceUnavailable": "Open Parameters and choose an active voice compatible with this speech model. Repeating the deleted or expired voice request cannot restore it.",
|
|
@@ -138,13 +138,16 @@
|
|
|
138
138
|
"runtimeTimeout": "这次任务已超时。",
|
|
139
139
|
"streamInterrupted": "实时结果连接已结束,但 Runtime 尚未确认最终状态。",
|
|
140
140
|
"runtimeCallFailed": "这次生成未能完成。",
|
|
141
|
+
"contentFilterBlocked": "内容过滤阻止了这次请求或响应。",
|
|
141
142
|
"inputLimitExceeded": "当前配置的模型无法完整读取这次输入。输入没有被截断,也没有返回部分结果。",
|
|
142
143
|
"textBehaviorUnsupported": "当前模型无法按现有设置运行这次请求:其中的工具调用、结构化输出、推理或生成参数不受支持。未接受部分回答。",
|
|
143
144
|
"mediaOptionUnsupported": "当前模型不支持这次请求中的一项或多项媒体参数。",
|
|
145
|
+
"embeddingPurposeUnsupported": "所选模型不支持当前的检索用途设置。",
|
|
144
146
|
"modalityUnsupported": "当前配置不支持这次请求中的一项或多项输入或参数。",
|
|
145
147
|
"providerRateLimited": "云服务因达到速率或用量上限拒绝了本次请求。对 ChatGPT 计划连接来说,这是该计划在此 App 中的用量上限。",
|
|
146
148
|
"mediaCodecUnavailable": "运行此请求时,所需的 Nimi 音视频工具不可用。",
|
|
147
149
|
"localLoadFailed": "当前本机配置无法按这次请求运行。",
|
|
150
|
+
"localConfigurationMissing": "这项本机 AI 能力还没有可运行的配置。保存 App 的选择并不表示模型已经准备好。",
|
|
148
151
|
"voiceInputRequired": "当前语音模型需要明确选择兼容的语音来源,才能合成音频。",
|
|
149
152
|
"voiceTargetMismatch": "这个语音资产由另一语音模型创建,不能用于当前选中的模型。",
|
|
150
153
|
"voiceUnavailable": "选择的音色已不可用。",
|
|
@@ -169,13 +172,16 @@
|
|
|
169
172
|
"runtimeTimeout": "稍后重试;如果仍然超时,再展开 Runtime 详情查看原因。",
|
|
170
173
|
"streamInterrupted": "请先检查任务状态;确认任务未完成后再重试。",
|
|
171
174
|
"runtimeCallFailed": "先重试一次;如果仍然失败,再展开 Runtime 详情查看原因。",
|
|
175
|
+
"contentFilterBlocked": "请尝试移除或脱敏受限内容,或调整所选上下文后重新提交。",
|
|
172
176
|
"inputLimitExceeded": "请缩短输入,或配置可接受更长输入的模型,然后重新运行。",
|
|
173
177
|
"textBehaviorUnsupported": "打开参数并重置此模型不接受的设置,或在 Desktop 的 AI 能力中选择支持此行为的模型,再重新运行。",
|
|
174
178
|
"mediaOptionUnsupported": "打开「参数」重置不受支持的设置后重新运行,也可以在 App AI 配置中选择支持这些设置的模型。",
|
|
179
|
+
"embeddingPurposeUnsupported": "打开「参数」,按任务选择「待检索内容」(建立索引)或「检索问题」(搜索),再重新运行。如果仍不支持该用途,可在 App AI 配置中选择支持它的模型。",
|
|
175
180
|
"modalityUnsupported": "请先修改输入,或在「参数」中重置不受支持的设置后再运行,也可以选择支持这次请求的配置。",
|
|
176
181
|
"providerRateLimited": "请稍后再试。ChatGPT 计划连接可在 {{usageUrl}} 查看用量。也可以打开 App AI 配置改选其他模型。",
|
|
177
182
|
"mediaCodecUnavailable": "在 Nimi Desktop 打开「AI 能力」→「高级与诊断」→「音频与视频组件」;如组件未就绪,选择「安装或修复」,等显示已安装后再运行此请求。",
|
|
178
183
|
"localLoadFailed": "请确认输入和参数与所选模型匹配,并在 Desktop 的 AI 能力中检查模型及组件是否已准备好;如需修复配置,完成后再运行。Runtime 详情保留了本次失败信息。",
|
|
184
|
+
"localConfigurationMissing": "请在 Nimi Home 的「AI 能力」中完成这项能力的本机模型配置,确认已可用后,返回这里重新提交当前输入。Runtime 详情保留了本次失败信息。",
|
|
179
185
|
"voiceInputRequired": "打开「参数」选择当前模型支持的预设语音或兼容的本地语音资产;如该模型需要资产而列表为空,先到「创建语音」创建,再返回重试。",
|
|
180
186
|
"voiceTargetMismatch": "选择与当前语音模型兼容的资产,或先在「创建语音」中创建一个,再重试。",
|
|
181
187
|
"voiceUnavailable": "打开「参数」选择当前模型兼容的有效音色;重复使用已删除或过期的音色无法恢复它。",
|
|
@@ -49,6 +49,8 @@ const MEDIA_OPTION_UNSUPPORTED_REASON_CODE = 'AI_MEDIA_OPTION_UNSUPPORTED';
|
|
|
49
49
|
const MODALITY_UNSUPPORTED_REASON_CODE = 'AI_MODALITY_NOT_SUPPORTED';
|
|
50
50
|
const MEDIA_CODEC_UNAVAILABLE_REASON_CODE = 'AI_MEDIA_CODEC_UNAVAILABLE';
|
|
51
51
|
const LOCAL_LOAD_FAILED_REASON_CODE = 'AI_LOCAL_EXECUTION_LOAD_FAILED';
|
|
52
|
+
const LOCAL_CONFIGURATION_MISSING_REASON_CODE = 'AI_LOCAL_CONFIGURATION_NOT_CONFIGURED';
|
|
53
|
+
const CONTENT_FILTER_BLOCKED_REASON_CODE = 'AI_CONTENT_FILTER_BLOCKED';
|
|
52
54
|
const VOICE_INPUT_INVALID_REASON_CODE = 'AI_VOICE_INPUT_INVALID';
|
|
53
55
|
const VOICE_TARGET_MISMATCH_REASON_CODE = 'AI_VOICE_TARGET_MODEL_MISMATCH';
|
|
54
56
|
const UNAVAILABLE_VOICE_REASON_CODES: ReadonlySet<string> = new Set(['AI_VOICE_ASSET_NOT_FOUND', 'AI_VOICE_ASSET_EXPIRED']);
|
|
@@ -85,11 +87,16 @@ export function studioNonSuccessReasonUserMessage(reason: string, translate: Stu
|
|
|
85
87
|
if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_TARGET_MISMATCH_REASON_CODE) return translate('NonSuccess.message.voiceTargetMismatch');
|
|
86
88
|
if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === 'AI_LOCAL_SELECTION_NOT_FOUND') return translate('VisionLocate.modelSelectionRequired');
|
|
87
89
|
if (isStoppedDirectCall(reason, capabilityId)) return translate('NonSuccess.message.stoppedDirectCall');
|
|
90
|
+
// @nimi-authority: rule.nimi.runtime.ai-provider.text-content-boundaries
|
|
91
|
+
if (diagnostics?.reasonCode === CONTENT_FILTER_BLOCKED_REASON_CODE) return translate('NonSuccess.message.contentFilterBlocked');
|
|
88
92
|
if (diagnostics?.reasonCode === INPUT_LIMIT_EXCEEDED_REASON_CODE) return translate('NonSuccess.message.inputLimitExceeded');
|
|
89
93
|
if (diagnostics?.reasonCode === TEXT_BEHAVIOR_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.textBehaviorUnsupported');
|
|
90
94
|
if (diagnostics?.reasonCode === MEDIA_CODEC_UNAVAILABLE_REASON_CODE) return translate('NonSuccess.message.mediaCodecUnavailable');
|
|
91
95
|
if (diagnostics?.reasonCode === LOCAL_LOAD_FAILED_REASON_CODE) return translate('NonSuccess.message.localLoadFailed');
|
|
96
|
+
if (diagnostics?.reasonCode === LOCAL_CONFIGURATION_MISSING_REASON_CODE) return translate('NonSuccess.message.localConfigurationMissing');
|
|
92
97
|
if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('VisionLocate.geometryUnsupported');
|
|
98
|
+
// @nimi-authority: rule.nimi.runtime.ai-provider.embedding-retrieval-purpose
|
|
99
|
+
if (capabilityId === 'text.embed' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.embeddingPurposeUnsupported');
|
|
93
100
|
if (diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.mediaOptionUnsupported');
|
|
94
101
|
if (diagnostics?.reasonCode === MODALITY_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.modalityUnsupported');
|
|
95
102
|
if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.message.providerRateLimited');
|
|
@@ -107,11 +114,14 @@ export function studioNonSuccessReasonUserAction(reason: string, translate: Stud
|
|
|
107
114
|
if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_TARGET_MISMATCH_REASON_CODE) return translate('NonSuccess.action.voiceTargetMismatch');
|
|
108
115
|
if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === 'AI_LOCAL_SELECTION_NOT_FOUND') return translate('VisionLocate.selectModelAction');
|
|
109
116
|
if (isStoppedDirectCall(reason, capabilityId)) return translate('NonSuccess.action.stoppedDirectCall');
|
|
117
|
+
if (diagnostics?.reasonCode === CONTENT_FILTER_BLOCKED_REASON_CODE) return translate('NonSuccess.action.contentFilterBlocked');
|
|
110
118
|
if (diagnostics?.reasonCode === INPUT_LIMIT_EXCEEDED_REASON_CODE) return translate('NonSuccess.action.inputLimitExceeded');
|
|
111
119
|
if (diagnostics?.reasonCode === TEXT_BEHAVIOR_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.textBehaviorUnsupported');
|
|
112
120
|
if (diagnostics?.reasonCode === MEDIA_CODEC_UNAVAILABLE_REASON_CODE) return translate('NonSuccess.action.mediaCodecUnavailable');
|
|
113
121
|
if (diagnostics?.reasonCode === LOCAL_LOAD_FAILED_REASON_CODE) return translate('NonSuccess.action.localLoadFailed');
|
|
122
|
+
if (diagnostics?.reasonCode === LOCAL_CONFIGURATION_MISSING_REASON_CODE) return translate('NonSuccess.action.localConfigurationMissing');
|
|
114
123
|
if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('VisionLocate.chooseSupportedGeometry');
|
|
124
|
+
if (capabilityId === 'text.embed' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.embeddingPurposeUnsupported');
|
|
115
125
|
if (diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.mediaOptionUnsupported');
|
|
116
126
|
if (diagnostics?.reasonCode === MODALITY_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.modalityUnsupported');
|
|
117
127
|
if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.action.providerRateLimited', { usageUrl: NIMI_CHATGPT_PLAN_USAGE_URL });
|
|
@@ -138,12 +138,14 @@ function TextStudioHistoryRecordResult({
|
|
|
138
138
|
registration,
|
|
139
139
|
record,
|
|
140
140
|
canRegenerate,
|
|
141
|
+
canRestoreInputs,
|
|
141
142
|
onRegenerate,
|
|
142
143
|
onUseAsDraft,
|
|
143
144
|
}: {
|
|
144
145
|
registration: StudioCapabilityRegistration;
|
|
145
146
|
record: StudioRunHistoryRecord;
|
|
146
147
|
canRegenerate: boolean;
|
|
148
|
+
canRestoreInputs: boolean;
|
|
147
149
|
onRegenerate: () => void;
|
|
148
150
|
onUseAsDraft: (record: StudioRunHistoryRecord) => void;
|
|
149
151
|
}) {
|
|
@@ -258,7 +260,7 @@ function TextStudioHistoryRecordResult({
|
|
|
258
260
|
) : null}
|
|
259
261
|
{canUseAsDraft ? (
|
|
260
262
|
<Tooltip content={t('StudioShell.useAsDraft')} placement="top">
|
|
261
|
-
<IconButton type="button" className="studio-result__action" onClick={() => onUseAsDraft(record)} aria-label={t('StudioShell.useAsDraft')} icon={<SquarePen size={16} aria-hidden="true" />} />
|
|
263
|
+
<IconButton type="button" className="studio-result__action" onClick={() => onUseAsDraft(record)} disabled={!canRestoreInputs} aria-label={t('StudioShell.useAsDraft')} icon={<SquarePen size={16} aria-hidden="true" />} />
|
|
262
264
|
</Tooltip>
|
|
263
265
|
) : null}
|
|
264
266
|
{canReplay ? (
|
|
@@ -413,6 +415,7 @@ export function TextStudioResultState({
|
|
|
413
415
|
intentLabel,
|
|
414
416
|
running,
|
|
415
417
|
canRegenerate,
|
|
418
|
+
canRestoreInputs,
|
|
416
419
|
regenerateHint,
|
|
417
420
|
cancelRequested,
|
|
418
421
|
streamingText,
|
|
@@ -431,6 +434,7 @@ export function TextStudioResultState({
|
|
|
431
434
|
intentLabel: string;
|
|
432
435
|
running: boolean;
|
|
433
436
|
canRegenerate: boolean;
|
|
437
|
+
canRestoreInputs: boolean;
|
|
434
438
|
regenerateHint?: string;
|
|
435
439
|
cancelRequested: boolean;
|
|
436
440
|
streamingText: string | null;
|
|
@@ -497,7 +501,7 @@ export function TextStudioResultState({
|
|
|
497
501
|
/>
|
|
498
502
|
</>
|
|
499
503
|
) : activeRun.record ? (
|
|
500
|
-
<TextStudioHistoryRecordResult registration={registration} record={activeRun.record} canRegenerate={canRegenerate} onRegenerate={onRegenerate} onUseAsDraft={onUseAsDraft} />
|
|
504
|
+
<TextStudioHistoryRecordResult registration={registration} record={activeRun.record} canRegenerate={canRegenerate} canRestoreInputs={canRestoreInputs} onRegenerate={onRegenerate} onUseAsDraft={onUseAsDraft} />
|
|
501
505
|
) : null}
|
|
502
506
|
</article>
|
|
503
507
|
</div>
|
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
TONE_OPTIONS,
|
|
19
19
|
} from './studio-directives.js';
|
|
20
20
|
import type { StudioTranslate } from './non-success-presentation.js';
|
|
21
|
+
import type { StudioParameterValue } from './parameters.js';
|
|
21
22
|
|
|
22
23
|
export type TextStudioActiveRun = {
|
|
23
24
|
attachmentCount?: number;
|
|
24
25
|
replayMedia?: StudioManagedArtifact;
|
|
26
|
+
// Latest submission's session-only input; history never stores these bytes.
|
|
27
|
+
submittedParameters?: StudioParameterValue;
|
|
25
28
|
jobStatus?: 'queued' | 'running';
|
|
26
29
|
id: string;
|
|
27
30
|
prompt: string;
|
|
@@ -16,7 +16,10 @@ export function MusicTranscriptionNotice({ value, recordId }: { readonly value?:
|
|
|
16
16
|
const [feedback, setFeedback] = useState<{ sourceKey: string; error?: string; exportedPath?: string } | null>(null);
|
|
17
17
|
const [exporting, setExporting] = useState('');
|
|
18
18
|
const currentSource = useRef(sourceKey);
|
|
19
|
-
useLayoutEffect(() => {
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
currentSource.current = sourceKey;
|
|
21
|
+
return () => { if (currentSource.current === sourceKey) currentSource.current = ''; };
|
|
22
|
+
}, [sourceKey]);
|
|
20
23
|
const scores = value?.scores;
|
|
21
24
|
const timelinePath = value?.timelineRelativePath;
|
|
22
25
|
// Render and actions gate on provenance before passive effects can run.
|
|
@@ -33,23 +36,37 @@ export function MusicTranscriptionNotice({ value, recordId }: { readonly value?:
|
|
|
33
36
|
const midi = score?.format === 'midi';
|
|
34
37
|
const mediaType = timeline ? 'application/vnd.nimi.music-timeline+json' : midi ? 'audio/midi' : 'text/vnd.abc';
|
|
35
38
|
const filename = timeline ? 'music-timeline.json' : midi ? 'estimated-notes.mid' : 'transcribed-score.abc';
|
|
39
|
+
let iterator: AsyncIterator<Uint8Array> | undefined;
|
|
40
|
+
let closing: Promise<unknown> | undefined;
|
|
41
|
+
const current = () => active && currentSource.current === sourceKey;
|
|
42
|
+
const close = (): Promise<unknown> => {
|
|
43
|
+
if (!iterator) return Promise.resolve();
|
|
44
|
+
const retiring = iterator;
|
|
45
|
+
return closing ??= Promise.resolve().then(() => retiring.return?.());
|
|
46
|
+
};
|
|
36
47
|
void (async () => {
|
|
37
48
|
const read = await host.sdk.assets.read({ relativePath: selected });
|
|
38
|
-
|
|
49
|
+
iterator = read.body[Symbol.asyncIterator]();
|
|
39
50
|
const limit = timeline || midi ? 16777216 : 1048576;
|
|
40
51
|
try {
|
|
52
|
+
if (!current()) return;
|
|
41
53
|
if (read.asset.mediaType !== mediaType || read.asset.sizeBytes < 1 || read.asset.sizeBytes > limit) throw new Error(t('Music.scoreTooLarge'));
|
|
42
54
|
const bytes = new Uint8Array(read.asset.sizeBytes); let offset = 0;
|
|
43
|
-
for
|
|
55
|
+
for (;;) {
|
|
56
|
+
if (!current()) return;
|
|
57
|
+
const next = await iterator.next();
|
|
58
|
+
if (!current()) return;
|
|
59
|
+
if (next.done) break;
|
|
60
|
+
const chunk = next.value;
|
|
44
61
|
if (offset + chunk.length > bytes.length) throw new Error(t('Music.scoreTooLarge'));
|
|
45
62
|
bytes.set(chunk, offset); offset += chunk.length;
|
|
46
63
|
}
|
|
47
64
|
if (offset !== bytes.length) throw new Error(t('Music.scoreIncomplete'));
|
|
48
65
|
const body = midi ? '' : new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
49
|
-
if (
|
|
50
|
-
} finally { await
|
|
51
|
-
})().catch((cause: unknown) => { if (
|
|
52
|
-
return () => { active = false; };
|
|
66
|
+
if (current()) setLoaded({ sourceKey, path: selected, bytes, body, filename, mediaType, midi });
|
|
67
|
+
} finally { await close(); }
|
|
68
|
+
})().catch((cause: unknown) => { if (current()) setFeedback({ sourceKey, error: String(cause) }); });
|
|
69
|
+
return () => { active = false; void close().catch(() => undefined); };
|
|
53
70
|
}, [sourceKey, selected, timelinePath, scores, host, t]);
|
|
54
71
|
async function exportSelected() {
|
|
55
72
|
const snapshot = file;
|
|
@@ -161,6 +161,7 @@ function TextStudioShell({
|
|
|
161
161
|
// stays valid however the current parameters have changed since.
|
|
162
162
|
const displayedRunParameters = useMemo(() => {
|
|
163
163
|
if (!displayedRun || displayedRun.record?.status === 'unavailable' || displayedRun.record?.inputTruncated) return null;
|
|
164
|
+
if (displayedRun.submittedParameters) return displayedRun.submittedParameters;
|
|
164
165
|
if (registration.parameters.restoreRecordedParameters) {
|
|
165
166
|
return registration.parameters.restoreRecordedParameters(
|
|
166
167
|
displayedRun.record?.runConfig?.target.params,
|
|
@@ -275,8 +276,12 @@ function TextStudioShell({
|
|
|
275
276
|
const abortController = new AbortController();
|
|
276
277
|
const observationController = new AbortController();
|
|
277
278
|
const startedAt = rendererHost.clock.now();
|
|
279
|
+
// Capture the submitted file and controls independently of later draft edits.
|
|
280
|
+
// Persisted history still receives only the contract's summary below.
|
|
281
|
+
const submittedParameters = structuredClone(runEffectiveParameters);
|
|
278
282
|
const pendingRun: TextStudioActiveRun = {
|
|
279
283
|
attachmentCount,
|
|
284
|
+
submittedParameters,
|
|
280
285
|
...(replayTextMedia && savedTextMedia ? { replayMedia: savedTextMedia } : {}),
|
|
281
286
|
id: `pending-${startedAt}`,
|
|
282
287
|
prompt: displayPrompt || (runHasAlternativeInput ? '' : preset.prompt),
|
|
@@ -296,7 +301,7 @@ function TextStudioShell({
|
|
|
296
301
|
promptStyle: profile.controls.includes('tone') || profile.controls.includes('length')
|
|
297
302
|
? effectiveTextStudioPromptStyle(runTarget) : null,
|
|
298
303
|
context: nextContext, attachmentCount,
|
|
299
|
-
requestParameters: registration.parameters.summarize(
|
|
304
|
+
requestParameters: registration.parameters.summarize(submittedParameters),
|
|
300
305
|
});
|
|
301
306
|
try {
|
|
302
307
|
let result: StudioCapabilityRunResult;
|
|
@@ -335,7 +340,7 @@ function TextStudioShell({
|
|
|
335
340
|
if (runSeqRef.current === runSeq) setStreamingText(text);
|
|
336
341
|
} : undefined,
|
|
337
342
|
attachments: supportsMedia ? runAttachments : undefined,
|
|
338
|
-
parameters:
|
|
343
|
+
parameters: submittedParameters,
|
|
339
344
|
signal: abortController.signal,
|
|
340
345
|
observationSignal: observationController.signal,
|
|
341
346
|
onObservation: response => {
|
|
@@ -374,7 +379,17 @@ function TextStudioShell({
|
|
|
374
379
|
result,
|
|
375
380
|
record,
|
|
376
381
|
};
|
|
377
|
-
setSessionRuns((current) =>
|
|
382
|
+
setSessionRuns((current) => {
|
|
383
|
+
// Retain source bytes only for the latest completed submission, not
|
|
384
|
+
// once per history entry throughout a long-running Studio session.
|
|
385
|
+
const next: Record<string, TextStudioActiveRun> = {};
|
|
386
|
+
for (const [id, previous] of Object.entries(current)) {
|
|
387
|
+
next[id] = { ...previous };
|
|
388
|
+
delete next[id].submittedParameters;
|
|
389
|
+
}
|
|
390
|
+
next[finishedRun.id] = finishedRun;
|
|
391
|
+
return next;
|
|
392
|
+
});
|
|
378
393
|
setActiveRun(finishedRun);
|
|
379
394
|
} catch (error) {
|
|
380
395
|
if (runSeq !== runSeqRef.current) return;
|
|
@@ -448,7 +463,10 @@ function TextStudioShell({
|
|
|
448
463
|
|
|
449
464
|
function useHistoryRunAsDraft(record: StudioRunHistoryRecord) {
|
|
450
465
|
if (record.inputTruncated || record.status === 'unavailable') return;
|
|
451
|
-
|
|
466
|
+
const submittedParameters = sessionRuns[record.id]?.submittedParameters;
|
|
467
|
+
if (submittedParameters && parameterStore) {
|
|
468
|
+
parameterStore.setParameters(capability.id, structuredClone(submittedParameters));
|
|
469
|
+
} else if (registration.parameters.restoreRecordedParameters) {
|
|
452
470
|
const snapshot = record.runConfig?.target.params;
|
|
453
471
|
const restored = registration.parameters.restoreRecordedParameters(snapshot, record.result, record.prompt);
|
|
454
472
|
if (!restored || !parameterStore) return;
|
|
@@ -588,7 +606,8 @@ function TextStudioShell({
|
|
|
588
606
|
admission={admission}
|
|
589
607
|
intentLabel={displayedRun.record ? getStudioRunIntentLabel(displayedRun.record) : runTarget.intentLabel}
|
|
590
608
|
running={displayingExecution}
|
|
591
|
-
|
|
609
|
+
canRestoreInputs={displayedRunParameters !== null}
|
|
610
|
+
canRegenerate={!running && runTarget.canDispatch && (capability.id !== 'vision.locate' || Boolean(savedTextMedia)) && textMediaReplayable && displayedRunReplayable && replayAssetsAvailable}
|
|
592
611
|
regenerateHint={!running && !textMediaReplayable ? t('Studio.profiles.textGenerate.savedMediaUnavailable')
|
|
593
612
|
: !running && replayAssetsChecking ? t('StudioShell.historyInputsChecking')
|
|
594
613
|
: !running && (!displayedRunReplayable || !replayAssetsAvailable) ? t('StudioShell.historyInputsUnavailable') : undefined}
|
|
@@ -61,11 +61,16 @@
|
|
|
61
61
|
"embeddingInput": "Embedding input {{index}}",
|
|
62
62
|
"embeddingInputPlaceholder": "Text to embed",
|
|
63
63
|
"embeddingDimensionsHint": "Leave blank for the model's default width. Runtime rejects this option when the selected model does not support native dimensions.",
|
|
64
|
+
"embeddingPurposeDefault": "Unspecified",
|
|
65
|
+
"embeddingPurposeDocument": "Content to search",
|
|
66
|
+
"embeddingPurposeQuery": "Search query",
|
|
67
|
+
"embeddingPurposeHint": "Choose content when indexing documents, or query when searching them. Some models require an explicit purpose.",
|
|
64
68
|
"addInput": "Add input",
|
|
65
69
|
"removeInput": "Remove input {{index}}",
|
|
66
70
|
"fields": {
|
|
67
71
|
"inputs": "Embedding inputs",
|
|
68
72
|
"dimensions": "Requested output dimensions",
|
|
73
|
+
"embeddingPurpose": "Retrieval purpose",
|
|
69
74
|
"temperature": "Temperature",
|
|
70
75
|
"topP": "Top P",
|
|
71
76
|
"maxTokens": "Max tokens",
|
|
@@ -61,11 +61,16 @@
|
|
|
61
61
|
"embeddingInput": "嵌入输入 {{index}}",
|
|
62
62
|
"embeddingInputPlaceholder": "要生成嵌入的文本",
|
|
63
63
|
"embeddingDimensionsHint": "留空使用模型默认维度。当前模型不支持原生维度选项时,Runtime 会拒绝请求。",
|
|
64
|
+
"embeddingPurposeDefault": "未指定",
|
|
65
|
+
"embeddingPurposeDocument": "待检索内容",
|
|
66
|
+
"embeddingPurposeQuery": "检索问题",
|
|
67
|
+
"embeddingPurposeHint": "为文档建立索引时选择「待检索内容」,搜索文档时选择「检索问题」。部分模型需要明确指定用途。",
|
|
64
68
|
"addInput": "添加输入",
|
|
65
69
|
"removeInput": "移除输入 {{index}}",
|
|
66
70
|
"fields": {
|
|
67
71
|
"inputs": "嵌入输入",
|
|
68
72
|
"dimensions": "请求输出维度",
|
|
73
|
+
"embeddingPurpose": "检索用途",
|
|
69
74
|
"temperature": "Temperature",
|
|
70
75
|
"topP": "Top P",
|
|
71
76
|
"maxTokens": "最大 Token 数",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, TextareaField } from '@nimiplatform/kit/ui';
|
|
1
|
+
import { Button, SelectField, TextareaField } from '@nimiplatform/kit/ui';
|
|
2
2
|
import { Plus, Trash2 } from 'lucide-react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -125,6 +125,29 @@ function EmbeddingFields(props: StudioParameterPanelProps) {
|
|
|
125
125
|
</Button>
|
|
126
126
|
</div>
|
|
127
127
|
),
|
|
128
|
+
}, {
|
|
129
|
+
field: 'purpose',
|
|
130
|
+
label: t('Studio.parameters.fields.embeddingPurpose'),
|
|
131
|
+
render: (routeDisabled) => (
|
|
132
|
+
<StudioParameterField label={t('Studio.parameters.fields.embeddingPurpose')}>
|
|
133
|
+
<SelectField
|
|
134
|
+
value={parameters.purpose ?? 'unspecified'}
|
|
135
|
+
disabled={props.disabled || routeDisabled}
|
|
136
|
+
onValueChange={(value) => {
|
|
137
|
+
const next = { ...parameters };
|
|
138
|
+
if (value === 'retrieval-document' || value === 'retrieval-query') next.purpose = value;
|
|
139
|
+
else delete next.purpose;
|
|
140
|
+
props.onChange(next);
|
|
141
|
+
}}
|
|
142
|
+
options={[
|
|
143
|
+
{ value: 'unspecified', label: t('Studio.parameters.embeddingPurposeDefault') },
|
|
144
|
+
{ value: 'retrieval-document', label: t('Studio.parameters.embeddingPurposeDocument') },
|
|
145
|
+
{ value: 'retrieval-query', label: t('Studio.parameters.embeddingPurposeQuery') },
|
|
146
|
+
]}
|
|
147
|
+
/>
|
|
148
|
+
<small>{t('Studio.parameters.embeddingPurposeHint')}</small>
|
|
149
|
+
</StudioParameterField>
|
|
150
|
+
),
|
|
128
151
|
}, {
|
|
129
152
|
field: 'dimensions',
|
|
130
153
|
label: t('Studio.parameters.fields.dimensions'),
|
|
@@ -20,6 +20,7 @@ export type StudioTextTurnParameters = StudioTextCandidateParameters & {
|
|
|
20
20
|
export type StudioEmbeddingParameters = {
|
|
21
21
|
inputs?: string[];
|
|
22
22
|
dimensions?: number;
|
|
23
|
+
purpose?: 'retrieval-document' | 'retrieval-query';
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const TEXT_CANDIDATE_ROUTE_MATRIX = {
|
|
@@ -61,7 +62,7 @@ export const studioChatStreamParameters = defineStudioParameters<StudioTextTurnP
|
|
|
61
62
|
|
|
62
63
|
export const studioTextEmbedParameters = defineStudioParameters<StudioEmbeddingParameters>({
|
|
63
64
|
initial: () => ({}),
|
|
64
|
-
routeMatrix: { inputs: LOCAL_AND_CLOUD_STUDIO_PARAMETER, dimensions: LOCAL_AND_CLOUD_STUDIO_PARAMETER },
|
|
65
|
+
routeMatrix: { inputs: LOCAL_AND_CLOUD_STUDIO_PARAMETER, dimensions: LOCAL_AND_CLOUD_STUDIO_PARAMETER, purpose: LOCAL_AND_CLOUD_STUDIO_PARAMETER },
|
|
65
66
|
hasAlternativeInput: (parameters) => nonEmptyEmbeddingInputs(parameters).length > 0,
|
|
66
67
|
});
|
|
67
68
|
|
|
@@ -195,6 +195,7 @@ async function runTextEmbed(context: StudioCapabilityRuntimeContext) {
|
|
|
195
195
|
type: 'text-embed',
|
|
196
196
|
inputs: embeddingInputs.length > 0 ? embeddingInputs : [context.prompt],
|
|
197
197
|
...(parameters?.dimensions !== undefined ? { dimensions: parameters.dimensions } : {}),
|
|
198
|
+
...(parameters?.purpose !== undefined ? { purpose: parameters.purpose } : {}),
|
|
198
199
|
});
|
|
199
200
|
if (result.output.type !== 'text-embed') {
|
|
200
201
|
return context.host.nonSuccess(
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
## Verification Commands
|
|
33
33
|
- Initial setup: after `pnpm install` and `pnpm run init`, run `pnpm run sync`, `pnpm run check`, the directly affected tests, and the affected build.
|
|
34
|
-
- In an initialized project,
|
|
34
|
+
- In an initialized project, choose tests and builds for concrete risks or applicable project requirements; prose-only guidance edits do not require an application build. Rerun sync/check when scaffold inputs, managed glue, or dependencies change, and before packaging; do not repeat initialization for ordinary product edits.
|
|
35
35
|
- Run the official Desktop-supervised App journey when product interaction is in scope; shell or native checks alone do not replace it.
|
|
36
|
-
- Mark
|
|
36
|
+
- Mark unrun product paths affecting the current conclusion `NOT-VERIFIED` and explain the impact. Help text, focused tests, and CDP visibility do not establish implementation or release acceptance.
|
|
37
|
+
|
|
38
|
+
## App introduction
|
|
39
|
+
- Every App owns a root `NIMI_APP.md` for Home: current user tasks, first steps, required configuration, relevant data handling, limitations and help. Keep engineering setup and acceptance logs in README/developer documentation. `metadata.readme` and README fallback are not supported; sync must not overwrite or recreate the introduction.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Acme Widget
|
|
2
|
+
|
|
3
|
+
Acme Widget is a new Nimi App under development. Its author has not yet supplied a finished product description or confirmed its user workflows.
|
|
4
|
+
|
|
5
|
+
Open it from Nimi Home when its author makes it available. Keep Nimi running while using the App. Follow the App's available controls and configure the resources required by the task before using AI features.
|
|
6
|
+
|
|
7
|
+
Feature availability, data handling, limitations and support information still need to be supplied by the author. This starter introduction does not establish a completed or released product.
|