This is a meaningful git commit message
This commit is contained in:
@@ -1803,13 +1803,21 @@ user:
|
||||
}
|
||||
|
||||
function enforceDefaultSkillSelection() {
|
||||
const convo = getCurrentConversation();
|
||||
if (!convo) return;
|
||||
const defaultKey = getDefaultDocumentSkillKey();
|
||||
if (!defaultKey) return;
|
||||
const hasDefaultSkill = skills.some((s) => s.key === defaultKey);
|
||||
if (!hasDefaultSkill) return;
|
||||
|
||||
const convo = getCurrentConversation();
|
||||
if (!convo) {
|
||||
if (!selectedSkillKeys.includes(defaultKey)) {
|
||||
selectedSkillKeys = [...selectedSkillKeys, defaultKey];
|
||||
renderSkillsList();
|
||||
renderSkillsEditor();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const removed = new Set(getConversationRemovedSkillKeys(convo));
|
||||
const selected = new Set(getConversationSkillKeys(convo));
|
||||
if (!removed.has(defaultKey) && !selected.has(defaultKey)) {
|
||||
@@ -4061,15 +4069,40 @@ user:
|
||||
});
|
||||
}
|
||||
|
||||
function upsertDefaultDocumentSkillDraft() {
|
||||
if (!currentPubkey) return;
|
||||
const key = getDefaultDocumentSkillKey();
|
||||
if (!key) return;
|
||||
if (skills.some((s) => s.key === key)) return;
|
||||
|
||||
const llm = String(aiConfig.model || 'default').trim() || 'default';
|
||||
const temperature = Number(aiConfig.temperature ?? 0);
|
||||
const maxTokens = Math.max(1, Math.floor(Number(aiConfig.max_tokens ?? 10000)));
|
||||
const evt = {
|
||||
kind: 31123,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
pubkey: currentPubkey,
|
||||
id: uid(),
|
||||
tags: [
|
||||
['d', DEFAULT_DOCUMENT_SKILL_SLUG],
|
||||
['description', DEFAULT_DOCUMENT_SKILL_DESCRIPTION],
|
||||
['llm', llm],
|
||||
['temperature', String(temperature)],
|
||||
['max_tokens', String(maxTokens)]
|
||||
],
|
||||
content: DEFAULT_DOCUMENT_SKILL_TEMPLATE
|
||||
};
|
||||
upsertSkillFromEvent(evt);
|
||||
}
|
||||
|
||||
async function ensureDefaultDocumentSkillExists() {
|
||||
if (!currentPubkey) return;
|
||||
const slug = DEFAULT_DOCUMENT_SKILL_SLUG;
|
||||
const key = getDefaultDocumentSkillKey();
|
||||
const existingInMemory = skills.find((s) => s.key === key);
|
||||
if (existingInMemory) {
|
||||
enforceDefaultSkillSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure visibility/editability immediately, even before network round-trips.
|
||||
upsertDefaultDocumentSkillDraft();
|
||||
enforceDefaultSkillSelection();
|
||||
|
||||
const filter = {
|
||||
kinds: [31123],
|
||||
@@ -4128,13 +4161,18 @@ user:
|
||||
};
|
||||
|
||||
const skillEvent = buildSkillEventFromEditor(draftSkill);
|
||||
await publishEvent(skillEvent);
|
||||
upsertSkillFromEvent({
|
||||
...skillEvent,
|
||||
pubkey: currentPubkey,
|
||||
id: uid()
|
||||
});
|
||||
setStatus('Created default-document-skill.');
|
||||
try {
|
||||
await publishEvent(skillEvent);
|
||||
upsertSkillFromEvent({
|
||||
...skillEvent,
|
||||
pubkey: currentPubkey,
|
||||
id: uid()
|
||||
});
|
||||
setStatus('Created default-document-skill.');
|
||||
} catch (error) {
|
||||
console.warn('[document.html] failed to publish default-document-skill, keeping local draft:', error);
|
||||
setStatus('Default document skill loaded locally (publish pending).');
|
||||
}
|
||||
enforceDefaultSkillSelection();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"VERSION": "v0.7.8",
|
||||
"VERSION_NUMBER": "0.7.8",
|
||||
"BUILD_DATE": "2026-04-28T14:39:51.733Z"
|
||||
"VERSION": "v0.7.9",
|
||||
"VERSION_NUMBER": "0.7.9",
|
||||
"BUILD_DATE": "2026-04-28T14:44:22.682Z"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user