forked from retoor/devplacepy
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6b87b77bb |
@@ -258,13 +258,13 @@ class NotificationDefaultForm(BaseModel):
|
||||
class AiCorrectionForm(BaseModel):
|
||||
enabled: bool = False
|
||||
sync: bool = False
|
||||
prompt: str = Field(default=DEFAULT_CORRECTION_PROMPT, max_length=20000)
|
||||
prompt: str = Field(default=DEFAULT_CORRECTION_PROMPT)
|
||||
|
||||
|
||||
class AiModifierForm(BaseModel):
|
||||
enabled: bool = False
|
||||
sync: bool = False
|
||||
prompt: str = Field(default=DEFAULT_MODIFIER_PROMPT, max_length=20000)
|
||||
prompt: str = Field(default=DEFAULT_MODIFIER_PROMPT)
|
||||
|
||||
|
||||
class InteractionsForm(BaseModel):
|
||||
|
||||
@@ -61,7 +61,7 @@ AI_CORRECTION_ACTIONS: tuple[Action, ...] = (
|
||||
),
|
||||
arg(
|
||||
"prompt",
|
||||
"The correction instruction (max 20000 chars). Omit to keep the current one.",
|
||||
"The correction instruction. Omit to keep the current one.",
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -64,7 +64,7 @@ AI_MODIFIER_ACTIONS: tuple[Action, ...] = (
|
||||
),
|
||||
arg(
|
||||
"prompt",
|
||||
"The modifier instruction (max 20000 chars). Omit to keep the current one.",
|
||||
"The modifier instruction. Omit to keep the current one.",
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -70,7 +70,7 @@ class AiCorrectionController:
|
||||
if prompt_raw is None:
|
||||
prompt = user.get("ai_correction_prompt") or DEFAULT_CORRECTION_PROMPT
|
||||
else:
|
||||
prompt = str(prompt_raw).strip()[:20000] or DEFAULT_CORRECTION_PROMPT
|
||||
prompt = str(prompt_raw).strip() or DEFAULT_CORRECTION_PROMPT
|
||||
get_table("users").update(
|
||||
{
|
||||
"uid": self._owner_id,
|
||||
|
||||
@@ -70,7 +70,7 @@ class AiModifierController:
|
||||
if prompt_raw is None:
|
||||
prompt = user.get("ai_modifier_prompt") or DEFAULT_MODIFIER_PROMPT
|
||||
else:
|
||||
prompt = str(prompt_raw).strip()[:20000] or DEFAULT_MODIFIER_PROMPT
|
||||
prompt = str(prompt_raw).strip() or DEFAULT_MODIFIER_PROMPT
|
||||
get_table("users").update(
|
||||
{
|
||||
"uid": self._owner_id,
|
||||
|
||||
@@ -328,44 +328,3 @@
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- Markdown source/preview toggle ---- */
|
||||
.gist-markdown-toggle .gist-md-tabbar {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.gist-markdown-toggle .gist-md-tab {
|
||||
padding: 0.5em 1em;
|
||||
cursor: pointer;
|
||||
color: var(--text-muted);
|
||||
border: 1px solid transparent;
|
||||
border-bottom: none;
|
||||
border-radius: var(--radius) var(--radius) 0 0;
|
||||
background: transparent;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.gist-markdown-toggle .gist-md-tab.active {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-card);
|
||||
border-color: var(--border) var(--border) transparent;
|
||||
}
|
||||
|
||||
.gist-markdown-toggle .tab-pane {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.gist-markdown-toggle .tab-pane.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.gist-markdown-toggle .gist-markdown-preview {
|
||||
padding: 1em;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0 0 var(--radius) var(--radius);
|
||||
min-height: 4em;
|
||||
background: var(--bg-card);
|
||||
}
|
||||
|
||||
@@ -35,23 +35,6 @@
|
||||
|
||||
{% if gist['language'] == 'markdown_rendered' %}
|
||||
<div class="gist-rendered-content rendered-content">{{ render_content(gist['source_code'], author_is_admin=is_admin(author)) }}</div>
|
||||
{% elif gist['language'] == 'markdown' %}
|
||||
<div class="gist-code-block gist-markdown-toggle" data-tabs>
|
||||
<nav class="gist-md-tabbar" role="tablist">
|
||||
<button type="button" class="gist-md-tab" data-tab="source" role="tab">Source</button>
|
||||
<button type="button" class="gist-md-tab" data-tab="preview" role="tab">Preview</button>
|
||||
</nav>
|
||||
<div data-tab-pane="source" class="tab-pane active" role="tabpanel">
|
||||
<div class="gist-code-header">
|
||||
<span class="gist-language-name">{{ language_name(gist['language']) }}</span>
|
||||
<button type="button" class="gist-copy-btn" data-copy="gist-code-content">Copy</button>
|
||||
</div>
|
||||
<pre><code id="gist-code-content" class="language-markdown">{{ gist['source_code'] }}</code></pre>
|
||||
</div>
|
||||
<div data-tab-pane="preview" class="tab-pane gist-markdown-preview rendered-content" role="tabpanel">
|
||||
{{ render_content(gist['source_code'], author_is_admin=is_admin(author)) }}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="gist-code-block">
|
||||
<div class="gist-code-header">
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
<option value="sync" {% if ai_correction_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
||||
</select>
|
||||
</div>
|
||||
<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>
|
||||
<textarea data-ai-correction-prompt class="input-sm ai-correction-prompt" rows="3" aria-label="AI content correction prompt">{{ ai_correction_prompt }}</textarea>
|
||||
<div class="customization-row">
|
||||
<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>
|
||||
@@ -251,7 +251,7 @@
|
||||
<option value="sync" {% if ai_modifier_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
||||
</select>
|
||||
</div>
|
||||
<textarea data-ai-modifier-prompt class="input-sm ai-correction-prompt" maxlength="20000" rows="3" aria-label="AI modifier prompt">{{ ai_modifier_prompt }}</textarea>
|
||||
<textarea data-ai-modifier-prompt class="input-sm ai-correction-prompt" rows="3" aria-label="AI modifier prompt">{{ ai_modifier_prompt }}</textarea>
|
||||
<div class="customization-row">
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user