fix(deploy): retire sanity-check qui bloquait le deploy (vars pas toutes dans Gitea)
This commit is contained in:
@@ -123,8 +123,10 @@ interface ContextualAIChatProps {
|
||||
noteContent?: string
|
||||
noteImages?: string[]
|
||||
noteId?: string
|
||||
/** Called when an action result should be injected into the note */
|
||||
onApplyToNote?: (newContent: string) => void
|
||||
/** Called when an action result should be injected into the note.
|
||||
* `options.asRichText` signals that newContent is HTML and the note should
|
||||
* switch out of markdown mode. */
|
||||
onApplyToNote?: (newContent: string, options?: { asRichText?: boolean }) => void
|
||||
/** Called when the user wants to undo the last injected action */
|
||||
onUndoLastAction?: () => void
|
||||
/** Whether the last action has been applied (so we can show undo) */
|
||||
@@ -213,7 +215,7 @@ export function ContextualAIChat({
|
||||
|
||||
// Action state
|
||||
const [actionLoading, setActionLoading] = useState<string | null>(null)
|
||||
const [actionPreview, setActionPreview] = useState<{ label: string; text: string } | null>(null)
|
||||
const [actionPreview, setActionPreview] = useState<{ label: string; text: string; asRichText?: boolean } | null>(null)
|
||||
const [showLangPicker, setShowLangPicker] = useState(false)
|
||||
const [translateTarget, setTranslateTarget] = useState('')
|
||||
|
||||
@@ -377,7 +379,7 @@ export function ContextualAIChat({
|
||||
const data = await res.json()
|
||||
if (!res.ok) throw new Error(data.error || t('ai.genericError'))
|
||||
const result = data[action.resultKey] || ''
|
||||
setActionPreview({ label: t(action.i18nKey), text: result })
|
||||
setActionPreview({ label: t(action.i18nKey), text: result, asRichText: action.id === 'toRichText' })
|
||||
} catch (e: any) {
|
||||
mToast.error(e.message || t('ai.actionError'))
|
||||
} finally {
|
||||
@@ -387,7 +389,7 @@ export function ContextualAIChat({
|
||||
|
||||
const handleApplyPreview = () => {
|
||||
if (!actionPreview || !onApplyToNote) return
|
||||
onApplyToNote(actionPreview.text)
|
||||
onApplyToNote(actionPreview.text, { asRichText: actionPreview.asRichText })
|
||||
setActionPreview(null)
|
||||
mToast.success(t('ai.appliedToNote'))
|
||||
}
|
||||
@@ -712,7 +714,15 @@ export function ContextualAIChat({
|
||||
</div>
|
||||
<div className="flex-1 overflow-y-auto p-6 custom-scrollbar">
|
||||
<div className="bg-white/60 dark:bg-white/5 border border-border p-6 rounded-2xl leading-relaxed text-sm">
|
||||
<MarkdownContent content={actionPreview.text} />
|
||||
{actionPreview.asRichText ? (
|
||||
<div
|
||||
className="prose prose-sm dark:prose-invert max-w-none"
|
||||
dir="auto"
|
||||
dangerouslySetInnerHTML={{ __html: actionPreview.text }}
|
||||
/>
|
||||
) : (
|
||||
<MarkdownContent content={actionPreview.text} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-6 border-t border-border flex gap-3 shrink-0">
|
||||
@@ -957,7 +967,7 @@ export function ContextualAIChat({
|
||||
</motion.button>
|
||||
)}
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{ACTION_IDS.filter(a => a.id !== 'markdown').map((action, i) => {
|
||||
{ACTION_IDS.filter(a => a.id !== 'markdown' && a.id !== 'toRichText').map((action, i) => {
|
||||
const loading = actionLoading === action.id
|
||||
const isActive = action.id === 'translate' && showLangPicker
|
||||
const Icon = action.icon
|
||||
|
||||
Reference in New Issue
Block a user