mirror of
https://github.com/yexi-by/dsh-unrestricted.git
synced 2026-11-28 02:30:22 +08:00
chore: 同步 DSH 0.2.2-rc.3 原版提示词快照、补充样式清理并升级至 v0.2.9
This commit is contained in:
1 parent
1383c6c168
commit
c7afd4e03d
29 files changed
+518
-187
No files matched your search
@@ -23,7 +23,7 @@ export const inject = ['slots', 'locale', 'connection', 'remote', 'configForms']
|
||||
|
||||
/** 注册本插件的配置卡片。 */
|
||||
export function apply(ctx: Context): void {
|
||||
ensureStyles()
|
||||
ctx.effect(() => ensureStyles(), 'dsh-unrestricted: stylesheet')
|
||||
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-unrestricted: dictionaries')
|
||||
const controller = createUnrestrictedController(ctx)
|
||||
ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
|
||||
|
||||
@@ -241,12 +241,17 @@ const CSS = `
|
||||
}
|
||||
`
|
||||
|
||||
/** Inject the stylesheet once; the tag id doubles as the re-evaluation guard. */
|
||||
export function ensureStyles(): void {
|
||||
if (typeof document === 'undefined') return
|
||||
if (document.querySelector('style[data-plugin="dsh-unrestricted"]') !== null) return
|
||||
/** Inject the stylesheet once and clean it up when this effect disposes. */
|
||||
export function ensureStyles(): () => void {
|
||||
if (typeof document === 'undefined') return () => {}
|
||||
const existing = document.querySelector<HTMLStyleElement>('style[data-plugin="dsh-unrestricted"]')
|
||||
if (existing !== null) {
|
||||
existing.textContent = CSS
|
||||
return () => {}
|
||||
}
|
||||
const tag = document.createElement('style')
|
||||
tag.dataset.plugin = 'dsh-unrestricted'
|
||||
tag.textContent = CSS
|
||||
document.head.appendChild(tag)
|
||||
return () => { tag.remove() }
|
||||
}
|
||||
+1
-1
@@ -37,7 +37,7 @@ import {
|
||||
export const name = 'dsh-unrestricted'
|
||||
|
||||
/** Current plugin package version. */
|
||||
export const PLUGIN_VERSION = '0.2.8'
|
||||
export const PLUGIN_VERSION = '0.2.9'
|
||||
|
||||
/** Services required by this plugin (all base-backed profiles provide these). */
|
||||
export const inject = ['settings', 'systemPrompt', 'loader']
|
||||
|
||||
Reference in new issue
Block a user