Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
131f988bea | ||
|
|
1c31c1d6a5 |
File diff suppressed because one or more lines are too long
@@ -258,13 +258,13 @@ class NotificationDefaultForm(BaseModel):
|
|||||||
class AiCorrectionForm(BaseModel):
|
class AiCorrectionForm(BaseModel):
|
||||||
enabled: bool = False
|
enabled: bool = False
|
||||||
sync: bool = False
|
sync: bool = False
|
||||||
prompt: str = Field(default=DEFAULT_CORRECTION_PROMPT)
|
prompt: str = Field(default=DEFAULT_CORRECTION_PROMPT, max_length=20000)
|
||||||
|
|
||||||
|
|
||||||
class AiModifierForm(BaseModel):
|
class AiModifierForm(BaseModel):
|
||||||
enabled: bool = False
|
enabled: bool = False
|
||||||
sync: bool = False
|
sync: bool = False
|
||||||
prompt: str = Field(default=DEFAULT_MODIFIER_PROMPT)
|
prompt: str = Field(default=DEFAULT_MODIFIER_PROMPT, max_length=20000)
|
||||||
|
|
||||||
|
|
||||||
class InteractionsForm(BaseModel):
|
class InteractionsForm(BaseModel):
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ AI_CORRECTION_ACTIONS: tuple[Action, ...] = (
|
|||||||
),
|
),
|
||||||
arg(
|
arg(
|
||||||
"prompt",
|
"prompt",
|
||||||
"The correction instruction. Omit to keep the current one.",
|
"The correction instruction (max 20000 chars). Omit to keep the current one.",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ AI_MODIFIER_ACTIONS: tuple[Action, ...] = (
|
|||||||
),
|
),
|
||||||
arg(
|
arg(
|
||||||
"prompt",
|
"prompt",
|
||||||
"The modifier instruction. Omit to keep the current one.",
|
"The modifier instruction (max 20000 chars). Omit to keep the current one.",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class AiCorrectionController:
|
|||||||
if prompt_raw is None:
|
if prompt_raw is None:
|
||||||
prompt = user.get("ai_correction_prompt") or DEFAULT_CORRECTION_PROMPT
|
prompt = user.get("ai_correction_prompt") or DEFAULT_CORRECTION_PROMPT
|
||||||
else:
|
else:
|
||||||
prompt = str(prompt_raw).strip() or DEFAULT_CORRECTION_PROMPT
|
prompt = str(prompt_raw).strip()[:20000] or DEFAULT_CORRECTION_PROMPT
|
||||||
get_table("users").update(
|
get_table("users").update(
|
||||||
{
|
{
|
||||||
"uid": self._owner_id,
|
"uid": self._owner_id,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class AiModifierController:
|
|||||||
if prompt_raw is None:
|
if prompt_raw is None:
|
||||||
prompt = user.get("ai_modifier_prompt") or DEFAULT_MODIFIER_PROMPT
|
prompt = user.get("ai_modifier_prompt") or DEFAULT_MODIFIER_PROMPT
|
||||||
else:
|
else:
|
||||||
prompt = str(prompt_raw).strip() or DEFAULT_MODIFIER_PROMPT
|
prompt = str(prompt_raw).strip()[:20000] or DEFAULT_MODIFIER_PROMPT
|
||||||
get_table("users").update(
|
get_table("users").update(
|
||||||
{
|
{
|
||||||
"uid": self._owner_id,
|
"uid": self._owner_id,
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ devii-terminal.devii-state-fullscreen .devii-window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
devii-terminal.devii-state-normal .devii-window {
|
devii-terminal.devii-state-normal .devii-window {
|
||||||
resize: both;
|
|
||||||
}
|
}
|
||||||
devii-terminal.devii-state-normal .devii-titlebar {
|
devii-terminal.devii-state-normal .devii-titlebar {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ export class DeviiTerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_canOpenOnGesture() {
|
_canOpenOnGesture() {
|
||||||
|
if (this.element && this.element.state !== "closed") return false;
|
||||||
if (document.querySelector(".modal-overlay.visible")) return false;
|
if (document.querySelector(".modal-overlay.visible")) return false;
|
||||||
if (document.querySelector(".dialog-overlay.visible")) return false;
|
if (document.querySelector(".dialog-overlay.visible")) return false;
|
||||||
if (document.querySelector(".context-menu.visible")) return false;
|
if (document.querySelector(".context-menu.visible")) return false;
|
||||||
|
|||||||
@@ -297,8 +297,8 @@ export default class FloatingWindow extends Component {
|
|||||||
if (!this.geometry) return;
|
if (!this.geometry) return;
|
||||||
const g = this.geometry;
|
const g = this.geometry;
|
||||||
const safeHeight = this._safeViewport.height;
|
const safeHeight = this._safeViewport.height;
|
||||||
g.width = Math.min(g.width, window.innerWidth - 16);
|
g.width = Math.max(320, Math.min(g.width, window.innerWidth - 16));
|
||||||
g.height = Math.min(g.height, safeHeight - 16);
|
g.height = Math.max(220, Math.min(g.height, safeHeight - 16));
|
||||||
g.left = Math.max(8, Math.min(g.left, window.innerWidth - g.width - 8));
|
g.left = Math.max(8, Math.min(g.left, window.innerWidth - g.width - 8));
|
||||||
g.top = Math.max(8, Math.min(g.top, safeHeight - g.height - 8));
|
g.top = Math.max(8, Math.min(g.top, safeHeight - g.height - 8));
|
||||||
}
|
}
|
||||||
@@ -409,8 +409,8 @@ export default class FloatingWindow extends Component {
|
|||||||
this._ro = new ResizeObserver(() => {
|
this._ro = new ResizeObserver(() => {
|
||||||
if (this.state === "normal" && this.geometry && !this._drag) {
|
if (this.state === "normal" && this.geometry && !this._drag) {
|
||||||
const rect = this.win.getBoundingClientRect();
|
const rect = this.win.getBoundingClientRect();
|
||||||
this.geometry.width = Math.round(rect.width);
|
this.geometry.width = Math.max(320, Math.round(rect.width));
|
||||||
this.geometry.height = Math.round(rect.height);
|
this.geometry.height = Math.max(220, Math.round(rect.height));
|
||||||
this._persistGeometry();
|
this._persistGeometry();
|
||||||
}
|
}
|
||||||
this._syncControls();
|
this._syncControls();
|
||||||
|
|||||||
@@ -226,7 +226,7 @@
|
|||||||
<option value="sync" {% if ai_correction_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
<option value="sync" {% if ai_correction_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<textarea data-ai-correction-prompt class="input-sm ai-correction-prompt" rows="3" aria-label="AI content correction prompt">{{ ai_correction_prompt }}</textarea>
|
<textarea data-ai-correction-prompt class="input-sm ai-correction-prompt" maxlength="20000" rows="3" aria-label="AI content correction prompt">{{ ai_correction_prompt }}</textarea>
|
||||||
<div class="customization-row">
|
<div class="customization-row">
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-ai-correction-save>Save</button>
|
<button type="button" class="btn btn-sm btn-primary" data-ai-correction-save>Save</button>
|
||||||
<span class="ai-correction-status" data-ai-correction-status role="status" aria-live="polite"></span>
|
<span class="ai-correction-status" data-ai-correction-status role="status" aria-live="polite"></span>
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
<option value="sync" {% if ai_modifier_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
<option value="sync" {% if ai_modifier_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<textarea data-ai-modifier-prompt class="input-sm ai-correction-prompt" rows="3" aria-label="AI modifier prompt">{{ ai_modifier_prompt }}</textarea>
|
<textarea data-ai-modifier-prompt class="input-sm ai-correction-prompt" maxlength="20000" rows="3" aria-label="AI modifier prompt">{{ ai_modifier_prompt }}</textarea>
|
||||||
<div class="customization-row">
|
<div class="customization-row">
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-ai-modifier-save>Save</button>
|
<button type="button" class="btn btn-sm btn-primary" data-ai-modifier-save>Save</button>
|
||||||
<span class="ai-correction-status" data-ai-modifier-status role="status" aria-live="polite"></span>
|
<span class="ai-correction-status" data-ai-modifier-status role="status" aria-live="polite"></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user