@happyvertical/smrt-content 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +194 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +634 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/asset-associable.d.ts +115 -0
- package/dist/asset-associable.d.ts.map +1 -0
- package/dist/body-format.d.ts +29 -0
- package/dist/body-format.d.ts.map +1 -0
- package/dist/body-format.js +604 -0
- package/dist/body-format.js.map +1 -0
- package/dist/content-asset.d.ts +17 -0
- package/dist/content-asset.d.ts.map +1 -0
- package/dist/content-assets.d.ts +10 -0
- package/dist/content-assets.d.ts.map +1 -0
- package/dist/content-chat-handlers.d.ts +115 -0
- package/dist/content-chat-handlers.d.ts.map +1 -0
- package/dist/content-chat-prompts.d.ts +3 -0
- package/dist/content-chat-prompts.d.ts.map +1 -0
- package/dist/content-chat-session.d.ts +26 -0
- package/dist/content-chat-session.d.ts.map +1 -0
- package/dist/content-contribution-attachment.d.ts +42 -0
- package/dist/content-contribution-attachment.d.ts.map +1 -0
- package/dist/content-contribution-attachments.d.ts +8 -0
- package/dist/content-contribution-attachments.d.ts.map +1 -0
- package/dist/content-contribution-config.d.ts +84 -0
- package/dist/content-contribution-config.d.ts.map +1 -0
- package/dist/content-contribution-revision.d.ts +38 -0
- package/dist/content-contribution-revision.d.ts.map +1 -0
- package/dist/content-contribution-revisions.d.ts +8 -0
- package/dist/content-contribution-revisions.d.ts.map +1 -0
- package/dist/content-contribution-type.d.ts +51 -0
- package/dist/content-contribution-type.d.ts.map +1 -0
- package/dist/content-contribution-types.d.ts +7 -0
- package/dist/content-contribution-types.d.ts.map +1 -0
- package/dist/content-contribution.d.ts +161 -0
- package/dist/content-contribution.d.ts.map +1 -0
- package/dist/content-contributions.d.ts +53 -0
- package/dist/content-contributions.d.ts.map +1 -0
- package/dist/content-contributor.d.ts +30 -0
- package/dist/content-contributor.d.ts.map +1 -0
- package/dist/content-contributors.d.ts +13 -0
- package/dist/content-contributors.d.ts.map +1 -0
- package/dist/content-correction.d.ts +39 -0
- package/dist/content-correction.d.ts.map +1 -0
- package/dist/content-corrections.d.ts +9 -0
- package/dist/content-corrections.d.ts.map +1 -0
- package/dist/content-editor-assistant.d.ts +68 -0
- package/dist/content-editor-assistant.d.ts.map +1 -0
- package/dist/content-editor-assistant.js +97 -0
- package/dist/content-editor-assistant.js.map +1 -0
- package/dist/content-feed-parser.d.ts +19 -0
- package/dist/content-feed-parser.d.ts.map +1 -0
- package/dist/content-feed-source.d.ts +52 -0
- package/dist/content-feed-source.d.ts.map +1 -0
- package/dist/content-feed-sources.d.ts +11 -0
- package/dist/content-feed-sources.d.ts.map +1 -0
- package/dist/content-feed-sync.d.ts +23 -0
- package/dist/content-feed-sync.d.ts.map +1 -0
- package/dist/content-governance-assignment.d.ts +42 -0
- package/dist/content-governance-assignment.d.ts.map +1 -0
- package/dist/content-governance-assignments.d.ts +11 -0
- package/dist/content-governance-assignments.d.ts.map +1 -0
- package/dist/content-governance-policies.d.ts +7 -0
- package/dist/content-governance-policies.d.ts.map +1 -0
- package/dist/content-governance-policy.d.ts +29 -0
- package/dist/content-governance-policy.d.ts.map +1 -0
- package/dist/content-governance-profile.d.ts +31 -0
- package/dist/content-governance-profile.d.ts.map +1 -0
- package/dist/content-governance-profiles.d.ts +7 -0
- package/dist/content-governance-profiles.d.ts.map +1 -0
- package/dist/content-governance.d.ts +188 -0
- package/dist/content-governance.d.ts.map +1 -0
- package/dist/content-prompts.d.ts +10 -0
- package/dist/content-prompts.d.ts.map +1 -0
- package/dist/content-reference.d.ts +17 -0
- package/dist/content-reference.d.ts.map +1 -0
- package/dist/content-references.d.ts +55 -0
- package/dist/content-references.d.ts.map +1 -0
- package/dist/content-review.d.ts +34 -0
- package/dist/content-review.d.ts.map +1 -0
- package/dist/content-reviews.d.ts +21 -0
- package/dist/content-reviews.d.ts.map +1 -0
- package/dist/content-transparency.d.ts +72 -0
- package/dist/content-transparency.d.ts.map +1 -0
- package/dist/content-types.d.ts +51 -0
- package/dist/content-types.d.ts.map +1 -0
- package/dist/content-version.d.ts +38 -0
- package/dist/content-version.d.ts.map +1 -0
- package/dist/content-versions.d.ts +16 -0
- package/dist/content-versions.d.ts.map +1 -0
- package/dist/content.d.ts +736 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/contents.d.ts +292 -0
- package/dist/contents.d.ts.map +1 -0
- package/dist/database-utils.d.ts +3 -0
- package/dist/database-utils.d.ts.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11602 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +12308 -0
- package/dist/mock-smrt-client.d.ts +493 -0
- package/dist/mock-smrt-client.d.ts.map +1 -0
- package/dist/mock-smrt-client.js +390 -0
- package/dist/mock-smrt-client.js.map +1 -0
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +454 -0
- package/dist/playground.js.map +1 -0
- package/dist/publish-readiness.d.ts +30 -0
- package/dist/publish-readiness.d.ts.map +1 -0
- package/dist/publish-readiness.js +74 -0
- package/dist/publish-readiness.js.map +1 -0
- package/dist/safe-remote-url.d.ts +52 -0
- package/dist/safe-remote-url.d.ts.map +1 -0
- package/dist/serialization.d.ts +78 -0
- package/dist/serialization.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +6130 -0
- package/dist/svelte/api.d.ts +3 -0
- package/dist/svelte/api.d.ts.map +1 -0
- package/dist/svelte/api.js +10 -0
- package/dist/svelte/components/ArticleCard.svelte +159 -0
- package/dist/svelte/components/ArticleCard.svelte.d.ts +17 -0
- package/dist/svelte/components/ArticleCard.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ArticleList.svelte +75 -0
- package/dist/svelte/components/ArticleList.svelte.d.ts +21 -0
- package/dist/svelte/components/ArticleList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentAgentChat.svelte +652 -0
- package/dist/svelte/components/ContentAgentChat.svelte.d.ts +17 -0
- package/dist/svelte/components/ContentAgentChat.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentBodyEditor.svelte +1446 -0
- package/dist/svelte/components/ContentBodyEditor.svelte.d.ts +25 -0
- package/dist/svelte/components/ContentBodyEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentBodyRenderer.svelte +152 -0
- package/dist/svelte/components/ContentBodyRenderer.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentBodyRenderer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentClaimAuditTool.svelte +441 -0
- package/dist/svelte/components/ContentClaimAuditTool.svelte.d.ts +12 -0
- package/dist/svelte/components/ContentClaimAuditTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionForm.svelte +226 -0
- package/dist/svelte/components/ContentContributionForm.svelte.d.ts +23 -0
- package/dist/svelte/components/ContentContributionForm.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionInbox.svelte +322 -0
- package/dist/svelte/components/ContentContributionInbox.svelte.d.ts +22 -0
- package/dist/svelte/components/ContentContributionInbox.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionPortal.svelte +182 -0
- package/dist/svelte/components/ContentContributionPortal.svelte.d.ts +12 -0
- package/dist/svelte/components/ContentContributionPortal.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionTypeManager.svelte +281 -0
- package/dist/svelte/components/ContentContributionTypeManager.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentContributionTypeManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributorManager.svelte +140 -0
- package/dist/svelte/components/ContentContributorManager.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentContributorManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentCorrectionsTool.svelte +361 -0
- package/dist/svelte/components/ContentCorrectionsTool.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentCorrectionsTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentEditor.svelte +2166 -0
- package/dist/svelte/components/ContentEditor.svelte.d.ts +26 -0
- package/dist/svelte/components/ContentEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte +199 -0
- package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceManager.svelte +340 -0
- package/dist/svelte/components/ContentGovernanceManager.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentGovernanceManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernancePanel.svelte +2244 -0
- package/dist/svelte/components/ContentGovernancePanel.svelte.d.ts +26 -0
- package/dist/svelte/components/ContentGovernancePanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernancePolicyEditor.svelte +110 -0
- package/dist/svelte/components/ContentGovernancePolicyEditor.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentGovernancePolicyEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceProfileEditor.svelte +185 -0
- package/dist/svelte/components/ContentGovernanceProfileEditor.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentGovernanceProfileEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceTool.svelte +56 -0
- package/dist/svelte/components/ContentGovernanceTool.svelte.d.ts +13 -0
- package/dist/svelte/components/ContentGovernanceTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentImageBrowser.svelte +243 -0
- package/dist/svelte/components/ContentImageBrowser.svelte.d.ts +18 -0
- package/dist/svelte/components/ContentImageBrowser.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentImageChooser.svelte +134 -0
- package/dist/svelte/components/ContentImageChooser.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentImageChooser.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentList.svelte +906 -0
- package/dist/svelte/components/ContentList.svelte.d.ts +16 -0
- package/dist/svelte/components/ContentList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentMetadataFields.svelte +107 -0
- package/dist/svelte/components/ContentMetadataFields.svelte.d.ts +8 -0
- package/dist/svelte/components/ContentMetadataFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentReferencesPanel.svelte +221 -0
- package/dist/svelte/components/ContentReferencesPanel.svelte.d.ts +20 -0
- package/dist/svelte/components/ContentReferencesPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentReviewStatusTray.svelte +151 -0
- package/dist/svelte/components/ContentReviewStatusTray.svelte.d.ts +20 -0
- package/dist/svelte/components/ContentReviewStatusTray.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentStatusFields.svelte +85 -0
- package/dist/svelte/components/ContentStatusFields.svelte.d.ts +8 -0
- package/dist/svelte/components/ContentStatusFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentTitleField.svelte +54 -0
- package/dist/svelte/components/ContentTitleField.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentTitleField.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentTransparencyReport.svelte +322 -0
- package/dist/svelte/components/ContentTransparencyReport.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentTransparencyReport.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentTransparencyTool.svelte +314 -0
- package/dist/svelte/components/ContentTransparencyTool.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentTransparencyTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentVersionsTool.svelte +291 -0
- package/dist/svelte/components/ContentVersionsTool.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentVersionsTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/GovernedContentEditor.svelte +409 -0
- package/dist/svelte/components/GovernedContentEditor.svelte.d.ts +35 -0
- package/dist/svelte/components/GovernedContentEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ImageThumbnail.cache.d.ts +14 -0
- package/dist/svelte/components/ImageThumbnail.cache.d.ts.map +1 -0
- package/dist/svelte/components/ImageThumbnail.cache.js +36 -0
- package/dist/svelte/components/ImageThumbnail.svelte +159 -0
- package/dist/svelte/components/ImageThumbnail.svelte.d.ts +8 -0
- package/dist/svelte/components/ImageThumbnail.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Markdown.svelte +125 -0
- package/dist/svelte/components/Markdown.svelte.d.ts +11 -0
- package/dist/svelte/components/Markdown.svelte.d.ts.map +1 -0
- package/dist/svelte/content-editor-form.d.ts +63 -0
- package/dist/svelte/content-editor-form.d.ts.map +1 -0
- package/dist/svelte/content-editor-form.js +94 -0
- package/dist/svelte/content-editor-media.d.ts +12 -0
- package/dist/svelte/content-editor-media.d.ts.map +1 -0
- package/dist/svelte/content-editor-media.js +84 -0
- package/dist/svelte/content-editor-state.svelte.d.ts +35 -0
- package/dist/svelte/content-editor-state.svelte.d.ts.map +1 -0
- package/dist/svelte/content-editor-state.svelte.js +141 -0
- package/dist/svelte/governance-manager-client.d.ts +22 -0
- package/dist/svelte/governance-manager-client.d.ts.map +1 -0
- package/dist/svelte/governance-manager-client.js +1 -0
- package/dist/svelte/i18n.contribution.d.ts +57 -0
- package/dist/svelte/i18n.contribution.d.ts.map +1 -0
- package/dist/svelte/i18n.contribution.js +64 -0
- package/dist/svelte/i18n.editor.d.ts +71 -0
- package/dist/svelte/i18n.editor.d.ts.map +1 -0
- package/dist/svelte/i18n.editor.js +87 -0
- package/dist/svelte/i18n.governance.d.ts +66 -0
- package/dist/svelte/i18n.governance.d.ts.map +1 -0
- package/dist/svelte/i18n.governance.js +66 -0
- package/dist/svelte/i18n.routes.d.ts +66 -0
- package/dist/svelte/i18n.routes.d.ts.map +1 -0
- package/dist/svelte/i18n.routes.js +75 -0
- package/dist/svelte/i18n.tools.d.ts +81 -0
- package/dist/svelte/i18n.tools.d.ts.map +1 -0
- package/dist/svelte/i18n.tools.js +90 -0
- package/dist/svelte/index.d.ts +101 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +63 -0
- package/dist/svelte/playground.d.ts +281 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +438 -0
- package/dist/svelte/routes/ContentContributionsRoute.svelte +809 -0
- package/dist/svelte/routes/ContentContributionsRoute.svelte.d.ts +10 -0
- package/dist/svelte/routes/ContentContributionsRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/ContentFactsRoute.svelte +612 -0
- package/dist/svelte/routes/ContentFactsRoute.svelte.d.ts +11 -0
- package/dist/svelte/routes/ContentFactsRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/ContentGovernanceRoute.svelte +218 -0
- package/dist/svelte/routes/ContentGovernanceRoute.svelte.d.ts +10 -0
- package/dist/svelte/routes/ContentGovernanceRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/ContentWorkspaceRoute.svelte +431 -0
- package/dist/svelte/routes/ContentWorkspaceRoute.svelte.d.ts +12 -0
- package/dist/svelte/routes/ContentWorkspaceRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/PublishedArticleRoute.svelte +194 -0
- package/dist/svelte/routes/PublishedArticleRoute.svelte.d.ts +10 -0
- package/dist/svelte/routes/PublishedArticleRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/index.d.ts +8 -0
- package/dist/svelte/routes/index.d.ts.map +1 -0
- package/dist/svelte/routes/index.js +6 -0
- package/dist/svelte/routes/shared.d.ts +90 -0
- package/dist/svelte/routes/shared.d.ts.map +1 -0
- package/dist/svelte/routes/shared.js +104 -0
- package/dist/svelte/types.d.ts +69 -0
- package/dist/svelte/types.d.ts.map +1 -0
- package/dist/svelte/types.js +6 -0
- package/dist/thumbnail-generator.d.ts +174 -0
- package/dist/thumbnail-generator.d.ts.map +1 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +42 -0
- package/dist/ui.js.map +1 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* ContentAgentChat
|
|
4
|
+
* Renders an AI chat interface alongside a specific piece of content,
|
|
5
|
+
* supporting multiple topics (threads).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { AgentChat } from '@happyvertical/smrt-chat/svelte';
|
|
9
|
+
import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
10
|
+
import type {
|
|
11
|
+
ContentEditorAssistantContext,
|
|
12
|
+
ContentEditorAssistantFieldUpdateAllowList,
|
|
13
|
+
} from '../../content-editor-assistant';
|
|
14
|
+
import {
|
|
15
|
+
contentEditorAssistantContextToChatProps,
|
|
16
|
+
sanitizeContentEditorAssistantFieldUpdates,
|
|
17
|
+
} from '../../content-editor-assistant';
|
|
18
|
+
import { joinApiUrl } from '../api';
|
|
19
|
+
import { M } from '../i18n.editor.js';
|
|
20
|
+
|
|
21
|
+
const AI_MODELS = [
|
|
22
|
+
{ id: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro' },
|
|
23
|
+
{ id: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash' },
|
|
24
|
+
{ id: 'claude-3-5-sonnet-latest', label: 'Claude 3.5 Sonnet' },
|
|
25
|
+
{ id: 'claude-3-5-haiku-latest', label: 'Claude 3.5 Haiku' },
|
|
26
|
+
{ id: 'gpt-4o', label: 'GPT-4o' },
|
|
27
|
+
{ id: 'gpt-4o-mini', label: 'GPT-4o Mini' },
|
|
28
|
+
];
|
|
29
|
+
const DEFAULT_MODEL_ID = AI_MODELS[0].id;
|
|
30
|
+
|
|
31
|
+
const { t } = useI18n();
|
|
32
|
+
|
|
33
|
+
export interface Props {
|
|
34
|
+
apiBaseUrl?: string;
|
|
35
|
+
assistantContext?: ContentEditorAssistantContext | null;
|
|
36
|
+
contentId?: string;
|
|
37
|
+
currentEditorState?: string;
|
|
38
|
+
currentReferenceIds?: string[];
|
|
39
|
+
formFields?: Record<string, string>;
|
|
40
|
+
currentProfileId?: string;
|
|
41
|
+
assistantFieldAllowList?: ContentEditorAssistantFieldUpdateAllowList;
|
|
42
|
+
onapplyfields?: (fields: Record<string, string>) => void;
|
|
43
|
+
onclose?: () => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let {
|
|
47
|
+
apiBaseUrl = '/api/v1',
|
|
48
|
+
assistantContext = null,
|
|
49
|
+
contentId = '',
|
|
50
|
+
currentEditorState = '',
|
|
51
|
+
currentReferenceIds = [],
|
|
52
|
+
formFields = {},
|
|
53
|
+
currentProfileId = '',
|
|
54
|
+
assistantFieldAllowList = {},
|
|
55
|
+
onapplyfields = undefined,
|
|
56
|
+
onclose = undefined,
|
|
57
|
+
}: Props = $props();
|
|
58
|
+
|
|
59
|
+
let session = $state<any>(null);
|
|
60
|
+
let threads = $state<any[]>([]);
|
|
61
|
+
let activeThreadId = $state<string | null>(null);
|
|
62
|
+
let messages = $state<any[]>([]);
|
|
63
|
+
|
|
64
|
+
let loadingSession = $state(true);
|
|
65
|
+
let loadingMessages = $state(false);
|
|
66
|
+
let sendingMessage = $state(false);
|
|
67
|
+
let error = $state<string | null>(null);
|
|
68
|
+
|
|
69
|
+
// New Topic State
|
|
70
|
+
let isCreatingTopic = $state(false);
|
|
71
|
+
let newTopicTitle = $state('');
|
|
72
|
+
let showNewTopicInput = $state(false);
|
|
73
|
+
|
|
74
|
+
// Active model selected
|
|
75
|
+
let selectedModelId = $state(DEFAULT_MODEL_ID);
|
|
76
|
+
let allowedModelIds = $state<string[]>([]);
|
|
77
|
+
let loadedContentId = $state<string | null>(null);
|
|
78
|
+
let loadedApiBaseUrl = $state<string | null>(null);
|
|
79
|
+
let sessionProfileId = $state('');
|
|
80
|
+
const assistantChatProps = $derived(
|
|
81
|
+
assistantContext
|
|
82
|
+
? contentEditorAssistantContextToChatProps(assistantContext)
|
|
83
|
+
: null,
|
|
84
|
+
);
|
|
85
|
+
const resolvedContentId = $derived(assistantChatProps?.contentId ?? contentId);
|
|
86
|
+
const resolvedCurrentEditorState = $derived(
|
|
87
|
+
assistantChatProps?.currentEditorState ?? currentEditorState,
|
|
88
|
+
);
|
|
89
|
+
const resolvedCurrentReferenceIds = $derived(
|
|
90
|
+
assistantChatProps?.currentReferenceIds ?? currentReferenceIds,
|
|
91
|
+
);
|
|
92
|
+
const resolvedFormFields = $derived(
|
|
93
|
+
assistantChatProps?.formFields ?? formFields,
|
|
94
|
+
);
|
|
95
|
+
const resolvedCurrentProfileId = $derived(currentProfileId || sessionProfileId);
|
|
96
|
+
const availableAIModels = $derived(
|
|
97
|
+
allowedModelIds.length > 0
|
|
98
|
+
? [
|
|
99
|
+
...AI_MODELS.filter((model) => allowedModelIds.includes(model.id)),
|
|
100
|
+
...allowedModelIds
|
|
101
|
+
.filter((id) => !AI_MODELS.some((model) => model.id === id))
|
|
102
|
+
.map((id) => ({ id, label: id })),
|
|
103
|
+
]
|
|
104
|
+
: AI_MODELS,
|
|
105
|
+
);
|
|
106
|
+
const canRetrySessionLoad = $derived(
|
|
107
|
+
Boolean(resolvedContentId && resolvedContentId !== 'new'),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
$effect(() => {
|
|
111
|
+
if (!resolvedContentId) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (resolvedContentId === 'new') {
|
|
116
|
+
loadedContentId = resolvedContentId;
|
|
117
|
+
loadedApiBaseUrl = apiBaseUrl;
|
|
118
|
+
session = null;
|
|
119
|
+
threads = [];
|
|
120
|
+
activeThreadId = null;
|
|
121
|
+
messages = [];
|
|
122
|
+
loadingSession = false;
|
|
123
|
+
allowedModelIds = [];
|
|
124
|
+
error = 'Save this draft first to start editorial chat.';
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (
|
|
129
|
+
resolvedContentId === loadedContentId &&
|
|
130
|
+
apiBaseUrl === loadedApiBaseUrl
|
|
131
|
+
) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
loadedContentId = resolvedContentId;
|
|
136
|
+
loadedApiBaseUrl = apiBaseUrl;
|
|
137
|
+
selectedModelId = DEFAULT_MODEL_ID;
|
|
138
|
+
session = null;
|
|
139
|
+
threads = [];
|
|
140
|
+
activeThreadId = null;
|
|
141
|
+
messages = [];
|
|
142
|
+
sessionProfileId = '';
|
|
143
|
+
allowedModelIds = [];
|
|
144
|
+
error = null;
|
|
145
|
+
void loadSession();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
/** Ensure every message has the UI fields that AgentChat.svelte requires */
|
|
149
|
+
function normalizeMessage(msg: any): any {
|
|
150
|
+
return {
|
|
151
|
+
...msg,
|
|
152
|
+
senderName:
|
|
153
|
+
msg.senderName || (msg.role === 'user' ? 'You' : 'AI Assistant'),
|
|
154
|
+
senderAvatarUrl: msg.senderAvatarUrl || '',
|
|
155
|
+
reactions: msg.reactions || [],
|
|
156
|
+
attachments: msg.attachments
|
|
157
|
+
? typeof msg.attachments === 'string'
|
|
158
|
+
? []
|
|
159
|
+
: msg.attachments
|
|
160
|
+
: [],
|
|
161
|
+
createdAt: msg.createdAt || msg.created_at || new Date().toISOString(),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function parseSessionContext(sessionValue: any): Record<string, unknown> {
|
|
166
|
+
const rawContext = sessionValue?.sessionContext;
|
|
167
|
+
if (!rawContext) {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (typeof rawContext === 'object' && !Array.isArray(rawContext)) {
|
|
172
|
+
return rawContext as Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (typeof rawContext !== 'string') {
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
const parsed = JSON.parse(rawContext);
|
|
181
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
182
|
+
? parsed
|
|
183
|
+
: {};
|
|
184
|
+
} catch {
|
|
185
|
+
return {};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function normalizeAllowedModels(value: unknown): string[] {
|
|
190
|
+
if (!Array.isArray(value)) {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const seen = new Set<string>();
|
|
195
|
+
const models: string[] = [];
|
|
196
|
+
for (const item of value) {
|
|
197
|
+
if (typeof item !== 'string') {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const id = item.trim();
|
|
201
|
+
if (!id || seen.has(id)) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
seen.add(id);
|
|
205
|
+
models.push(id);
|
|
206
|
+
}
|
|
207
|
+
return models;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function applySessionModelPreference(sessionValue: any): void {
|
|
211
|
+
const ctx = parseSessionContext(sessionValue);
|
|
212
|
+
const sessionAllowedModels = normalizeAllowedModels(ctx.allowedModels);
|
|
213
|
+
allowedModelIds = sessionAllowedModels;
|
|
214
|
+
|
|
215
|
+
const sessionModel =
|
|
216
|
+
typeof ctx.model === 'string' && ctx.model.trim() ? ctx.model.trim() : '';
|
|
217
|
+
if (
|
|
218
|
+
sessionModel &&
|
|
219
|
+
(sessionAllowedModels.length === 0 ||
|
|
220
|
+
sessionAllowedModels.includes(sessionModel))
|
|
221
|
+
) {
|
|
222
|
+
selectedModelId = sessionModel;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (
|
|
227
|
+
sessionAllowedModels.length > 0 &&
|
|
228
|
+
!sessionAllowedModels.includes(selectedModelId)
|
|
229
|
+
) {
|
|
230
|
+
selectedModelId = sessionAllowedModels[0];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
async function loadSession() {
|
|
235
|
+
loadingSession = true;
|
|
236
|
+
error = null;
|
|
237
|
+
try {
|
|
238
|
+
const res = await fetch(
|
|
239
|
+
joinApiUrl(apiBaseUrl, `/contents/${resolvedContentId}/chat`),
|
|
240
|
+
);
|
|
241
|
+
if (!res.ok) throw new Error('Failed to load chat session.');
|
|
242
|
+
const data = await res.json();
|
|
243
|
+
|
|
244
|
+
if (!data.session) {
|
|
245
|
+
// Chat tables not yet provisioned — show a friendly message
|
|
246
|
+
error = data.notice || 'Chat is not yet available for this content.';
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (typeof data.session.allowedTools === 'string') {
|
|
251
|
+
try {
|
|
252
|
+
data.session.allowedTools = JSON.parse(data.session.allowedTools);
|
|
253
|
+
} catch (e) {
|
|
254
|
+
data.session.allowedTools = [];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
data.session.allowedTools = data.session.allowedTools || [];
|
|
258
|
+
data.session.agentName = data.session.agentName || 'AI Assistant';
|
|
259
|
+
|
|
260
|
+
session = data.session;
|
|
261
|
+
sessionProfileId = data.session?.participantProfileId || '';
|
|
262
|
+
applySessionModelPreference(session);
|
|
263
|
+
threads = data.threads || [];
|
|
264
|
+
|
|
265
|
+
// Select latest thread if exists
|
|
266
|
+
if (threads.length > 0) {
|
|
267
|
+
await loadThread(threads[0].id);
|
|
268
|
+
} else {
|
|
269
|
+
newTopicTitle = 'General';
|
|
270
|
+
await createNewTopic();
|
|
271
|
+
}
|
|
272
|
+
} catch (err: any) {
|
|
273
|
+
error = err.message;
|
|
274
|
+
} finally {
|
|
275
|
+
loadingSession = false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async function loadThread(threadId: string) {
|
|
280
|
+
if (!threadId) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
loadingMessages = true;
|
|
285
|
+
activeThreadId = threadId;
|
|
286
|
+
isCreatingTopic = false;
|
|
287
|
+
messages = [];
|
|
288
|
+
error = null;
|
|
289
|
+
|
|
290
|
+
try {
|
|
291
|
+
const res = await fetch(
|
|
292
|
+
joinApiUrl(
|
|
293
|
+
apiBaseUrl,
|
|
294
|
+
`/contents/${resolvedContentId}/chat/threads/${threadId}`,
|
|
295
|
+
),
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
if (!res.ok)
|
|
299
|
+
throw new Error(`Failed to load thread messages. Status: ${res.status}`);
|
|
300
|
+
|
|
301
|
+
const data = await res.json();
|
|
302
|
+
|
|
303
|
+
messages = (data.messages || []).map(normalizeMessage);
|
|
304
|
+
|
|
305
|
+
// Check if there is a saved model preference on the session context
|
|
306
|
+
applySessionModelPreference(session);
|
|
307
|
+
} catch (err: any) {
|
|
308
|
+
error = err.message;
|
|
309
|
+
} finally {
|
|
310
|
+
loadingMessages = false;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async function createNewTopic() {
|
|
315
|
+
if (!session) return;
|
|
316
|
+
const title = newTopicTitle.trim() || `Topic ${threads.length + 1}`;
|
|
317
|
+
|
|
318
|
+
isCreatingTopic = true;
|
|
319
|
+
try {
|
|
320
|
+
const res = await fetch(
|
|
321
|
+
joinApiUrl(apiBaseUrl, `/contents/${resolvedContentId}/chat`),
|
|
322
|
+
{
|
|
323
|
+
method: 'POST',
|
|
324
|
+
headers: { 'Content-Type': 'application/json' },
|
|
325
|
+
body: JSON.stringify({
|
|
326
|
+
title: title,
|
|
327
|
+
sessionId: session.id,
|
|
328
|
+
model: selectedModelId,
|
|
329
|
+
referenceIds: resolvedCurrentReferenceIds,
|
|
330
|
+
}),
|
|
331
|
+
},
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
if (!res.ok) throw new Error('Failed to create topic.');
|
|
335
|
+
const data = await res.json();
|
|
336
|
+
|
|
337
|
+
threads = [data.thread, ...threads];
|
|
338
|
+
newTopicTitle = '';
|
|
339
|
+
await loadThread(data.thread.id);
|
|
340
|
+
} catch (err: any) {
|
|
341
|
+
error = err.message;
|
|
342
|
+
} finally {
|
|
343
|
+
isCreatingTopic = false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
async function handleSendMessage(content: string) {
|
|
348
|
+
if (!session || !activeThreadId) return;
|
|
349
|
+
|
|
350
|
+
const tempId = `temp-${Date.now()}`;
|
|
351
|
+
messages = [
|
|
352
|
+
...messages,
|
|
353
|
+
{
|
|
354
|
+
id: tempId,
|
|
355
|
+
content,
|
|
356
|
+
role: 'user',
|
|
357
|
+
messageType: 'text',
|
|
358
|
+
createdAt: new Date(),
|
|
359
|
+
},
|
|
360
|
+
];
|
|
361
|
+
|
|
362
|
+
sendingMessage = true;
|
|
363
|
+
try {
|
|
364
|
+
const res = await fetch(
|
|
365
|
+
joinApiUrl(
|
|
366
|
+
apiBaseUrl,
|
|
367
|
+
`/contents/${resolvedContentId}/chat/threads/${activeThreadId}`,
|
|
368
|
+
),
|
|
369
|
+
{
|
|
370
|
+
method: 'POST',
|
|
371
|
+
headers: { 'Content-Type': 'application/json' },
|
|
372
|
+
body: JSON.stringify({
|
|
373
|
+
content,
|
|
374
|
+
sessionId: session.id,
|
|
375
|
+
model: selectedModelId,
|
|
376
|
+
currentEditorState: resolvedCurrentEditorState,
|
|
377
|
+
referenceIds: resolvedCurrentReferenceIds,
|
|
378
|
+
formFields: resolvedFormFields,
|
|
379
|
+
}),
|
|
380
|
+
},
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
if (!res.ok) throw new Error('Failed to send message.');
|
|
384
|
+
const data = await res.json();
|
|
385
|
+
|
|
386
|
+
messages = messages.filter((m) => m.id !== tempId);
|
|
387
|
+
messages = [
|
|
388
|
+
...messages,
|
|
389
|
+
normalizeMessage(data.userMessage),
|
|
390
|
+
normalizeMessage(data.agentMessage),
|
|
391
|
+
];
|
|
392
|
+
|
|
393
|
+
// Auto-apply: extract JSON field update blocks from the AI response
|
|
394
|
+
if (onapplyfields && data.agentMessage?.content) {
|
|
395
|
+
const jsonBlockRegex = /```\s*json\s*\r?\n([\s\S]*?)```/gi;
|
|
396
|
+
let match: RegExpExecArray | null = jsonBlockRegex.exec(
|
|
397
|
+
data.agentMessage.content,
|
|
398
|
+
);
|
|
399
|
+
while (match !== null) {
|
|
400
|
+
try {
|
|
401
|
+
const parsed = JSON.parse(match[1].trim());
|
|
402
|
+
const fields = sanitizeContentEditorAssistantFieldUpdates(
|
|
403
|
+
parsed.fields,
|
|
404
|
+
assistantFieldAllowList,
|
|
405
|
+
);
|
|
406
|
+
if (Object.keys(fields).length > 0) {
|
|
407
|
+
onapplyfields(fields);
|
|
408
|
+
}
|
|
409
|
+
} catch (e) {}
|
|
410
|
+
match = jsonBlockRegex.exec(data.agentMessage.content);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
} catch (err: any) {
|
|
414
|
+
messages = messages.filter((m) => m.id !== tempId);
|
|
415
|
+
error = 'Failed to send message.';
|
|
416
|
+
} finally {
|
|
417
|
+
sendingMessage = false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
</script>
|
|
421
|
+
|
|
422
|
+
<div class="content-agent-chat-container">
|
|
423
|
+
{#if loadingSession && !threads.length}
|
|
424
|
+
<div class="loading-state">{t(M['content.content_agent_chat.loading_ai_assistant'])}</div>
|
|
425
|
+
{:else if error && !session}
|
|
426
|
+
<div class="error-state">
|
|
427
|
+
<p>{error}</p>
|
|
428
|
+
{#if canRetrySessionLoad}
|
|
429
|
+
<button onclick={loadSession}>Retry</button>
|
|
430
|
+
{/if}
|
|
431
|
+
</div>
|
|
432
|
+
{:else if session}
|
|
433
|
+
<div class="model-bar">
|
|
434
|
+
<select class="smrt-select model-select" bind:value={selectedModelId}>
|
|
435
|
+
{#each availableAIModels as model}
|
|
436
|
+
<option value={model.id}>{model.label}</option>
|
|
437
|
+
{/each}
|
|
438
|
+
</select>
|
|
439
|
+
</div>
|
|
440
|
+
|
|
441
|
+
<div class="chat-main">
|
|
442
|
+
<div class="agent-chat-host">
|
|
443
|
+
{#if loadingMessages || isCreatingTopic}
|
|
444
|
+
<div class="loading-state">
|
|
445
|
+
<span class="spinner"></span> {t(M['content.content_agent_chat.loading_topic'])}
|
|
446
|
+
</div>
|
|
447
|
+
{:else}
|
|
448
|
+
{#if !resolvedCurrentProfileId}
|
|
449
|
+
<div class="loading-state">{t(M['content.content_agent_chat.loading_participant'])}</div>
|
|
450
|
+
{:else}
|
|
451
|
+
<AgentChat
|
|
452
|
+
session={session}
|
|
453
|
+
messages={messages}
|
|
454
|
+
currentProfileId={resolvedCurrentProfileId}
|
|
455
|
+
loading={sendingMessage}
|
|
456
|
+
onsend={handleSendMessage}
|
|
457
|
+
onclose={onclose}
|
|
458
|
+
/>
|
|
459
|
+
{/if}
|
|
460
|
+
{/if}
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
|
|
464
|
+
<div class="topic-footer">
|
|
465
|
+
{#if showNewTopicInput}
|
|
466
|
+
<div class="new-topic-row">
|
|
467
|
+
<input
|
|
468
|
+
class="new-topic-input"
|
|
469
|
+
type="text"
|
|
470
|
+
placeholder={t(M['content.content_agent_chat.topic_name_placeholder'])}
|
|
471
|
+
bind:value={newTopicTitle}
|
|
472
|
+
onkeydown={(e: KeyboardEvent) => { if (e.key === 'Enter') { createNewTopic(); showNewTopicInput = false; } }}
|
|
473
|
+
/>
|
|
474
|
+
<button class="topic-action-btn" onclick={() => { createNewTopic(); showNewTopicInput = false; }} disabled={isCreatingTopic}>
|
|
475
|
+
{isCreatingTopic ? '...' : 'Create'}
|
|
476
|
+
</button>
|
|
477
|
+
<button class="topic-action-btn topic-cancel-btn" onclick={() => { showNewTopicInput = false; }}>✕</button>
|
|
478
|
+
</div>
|
|
479
|
+
{:else}
|
|
480
|
+
<select
|
|
481
|
+
class="smrt-select topic-select"
|
|
482
|
+
bind:value={activeThreadId}
|
|
483
|
+
onchange={(e: Event) => loadThread((e.currentTarget as HTMLSelectElement).value)}
|
|
484
|
+
disabled={!threads.length}
|
|
485
|
+
>
|
|
486
|
+
{#if !threads.length}
|
|
487
|
+
<option value="" disabled>{t(M['content.content_agent_chat.no_topics'])}</option>
|
|
488
|
+
{/if}
|
|
489
|
+
{#each threads as thread}
|
|
490
|
+
<option value={thread.id}>{thread.title || t(M['content.content_agent_chat.untitled_topic'])}</option>
|
|
491
|
+
{/each}
|
|
492
|
+
</select>
|
|
493
|
+
<button class="topic-action-btn" onclick={() => { showNewTopicInput = true; newTopicTitle = ''; }} title={t(M['content.content_agent_chat.new_topic'])}>
|
|
494
|
+
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
|
495
|
+
{t(M['content.content_agent_chat.new'])}
|
|
496
|
+
</button>
|
|
497
|
+
{/if}
|
|
498
|
+
</div>
|
|
499
|
+
{/if}
|
|
500
|
+
</div>
|
|
501
|
+
|
|
502
|
+
<style>
|
|
503
|
+
.content-agent-chat-container {
|
|
504
|
+
display: flex;
|
|
505
|
+
flex-direction: column;
|
|
506
|
+
height: 100%;
|
|
507
|
+
background: var(--smrt-color-surface, #fefbff);
|
|
508
|
+
overflow: hidden;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.loading-state, .error-state {
|
|
512
|
+
display: flex;
|
|
513
|
+
flex-direction: column;
|
|
514
|
+
align-items: center;
|
|
515
|
+
justify-content: center;
|
|
516
|
+
height: 100%;
|
|
517
|
+
padding: 2rem;
|
|
518
|
+
text-align: center;
|
|
519
|
+
color: var(--smrt-color-outline, #74777f);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.spinner {
|
|
523
|
+
display: inline-block;
|
|
524
|
+
width: 16px;
|
|
525
|
+
height: 16px;
|
|
526
|
+
border: 2px solid var(--smrt-color-outline-variant, #c4c6d0);
|
|
527
|
+
border-top-color: var(--smrt-color-primary, #005ac1);
|
|
528
|
+
border-radius: var(--smrt-radius-full, 9999px);
|
|
529
|
+
animation: spin 1s linear infinite;
|
|
530
|
+
margin-right: var(--smrt-spacing-2, 8px);
|
|
531
|
+
vertical-align: middle;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
@keyframes spin {
|
|
535
|
+
to { transform: rotate(360deg); }
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.error-state button {
|
|
539
|
+
margin-top: 1rem;
|
|
540
|
+
padding: 0.5rem 1rem;
|
|
541
|
+
background: var(--smrt-color-primary, #005ac1);
|
|
542
|
+
color: var(--smrt-color-on-primary, #ffffff);
|
|
543
|
+
border: none;
|
|
544
|
+
border-radius: var(--smrt-radius-sm, 4px);
|
|
545
|
+
cursor: pointer;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.model-bar {
|
|
549
|
+
padding: var(--smrt-spacing-2, 8px) var(--smrt-spacing-3, 12px);
|
|
550
|
+
background: var(--smrt-color-surface-container-lowest, #ffffff);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.smrt-select {
|
|
554
|
+
width: 100%;
|
|
555
|
+
padding: var(--smrt-spacing-1, 4px) var(--smrt-spacing-2, 8px);
|
|
556
|
+
border-radius: var(--smrt-radius-md, 8px);
|
|
557
|
+
border: none;
|
|
558
|
+
background: var(--smrt-color-surface-container-low, #f7f7fb);
|
|
559
|
+
color: var(--smrt-color-on-surface, #1a1c1e);
|
|
560
|
+
font-size: var(--smrt-typography-body-medium-size, 0.8125rem);
|
|
561
|
+
outline: none;
|
|
562
|
+
cursor: pointer;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.smrt-select:disabled {
|
|
566
|
+
background: var(--smrt-color-surface-container, #f3f4f9);
|
|
567
|
+
color: var(--smrt-color-on-surface-variant, #43474e);
|
|
568
|
+
cursor: not-allowed;
|
|
569
|
+
opacity: 0.7;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.smrt-select:focus {
|
|
573
|
+
background: var(--smrt-color-surface-variant, #e1e2ec);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.chat-main {
|
|
577
|
+
flex: 1;
|
|
578
|
+
overflow: hidden;
|
|
579
|
+
display: flex;
|
|
580
|
+
flex-direction: column;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.agent-chat-host {
|
|
584
|
+
flex: 1;
|
|
585
|
+
overflow: hidden;
|
|
586
|
+
position: relative;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.agent-chat-host > :global(*) {
|
|
590
|
+
height: 100%;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.topic-footer {
|
|
594
|
+
display: flex;
|
|
595
|
+
align-items: center;
|
|
596
|
+
gap: var(--smrt-spacing-2, 8px);
|
|
597
|
+
padding: var(--smrt-spacing-2, 8px) var(--smrt-spacing-3, 12px);
|
|
598
|
+
background: var(--smrt-color-surface-container-lowest, #ffffff);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.topic-footer .smrt-select {
|
|
602
|
+
flex: 1;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.topic-action-btn {
|
|
606
|
+
display: inline-flex;
|
|
607
|
+
align-items: center;
|
|
608
|
+
gap: var(--smrt-spacing-1, 4px);
|
|
609
|
+
padding: var(--smrt-spacing-1, 4px) var(--smrt-spacing-2, 8px);
|
|
610
|
+
border: 1px solid var(--smrt-color-outline-variant, #c4c6d0);
|
|
611
|
+
border-radius: var(--smrt-radius-sm, 4px);
|
|
612
|
+
background: none;
|
|
613
|
+
color: var(--smrt-color-on-surface-variant, #43474e);
|
|
614
|
+
font-size: var(--smrt-typography-label-medium-size, 0.75rem);
|
|
615
|
+
cursor: pointer;
|
|
616
|
+
white-space: nowrap;
|
|
617
|
+
transition: background 0.15s;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.topic-action-btn:hover:not(:disabled) {
|
|
621
|
+
background: var(--smrt-color-surface-variant, #e1e2e8);
|
|
622
|
+
color: var(--smrt-color-primary, #005ac1);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.topic-cancel-btn {
|
|
626
|
+
padding: var(--smrt-spacing-1, 4px) var(--smrt-spacing-2, 8px);
|
|
627
|
+
border: none;
|
|
628
|
+
color: var(--smrt-color-outline, #74777f);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.new-topic-row {
|
|
632
|
+
display: flex;
|
|
633
|
+
align-items: center;
|
|
634
|
+
gap: var(--smrt-spacing-2, 8px);
|
|
635
|
+
width: 100%;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.new-topic-input {
|
|
639
|
+
flex: 1;
|
|
640
|
+
padding: var(--smrt-spacing-1, 4px) var(--smrt-spacing-2, 8px);
|
|
641
|
+
border: 1px solid var(--smrt-color-outline-variant, #c4c6d0);
|
|
642
|
+
border-radius: var(--smrt-radius-sm, 4px);
|
|
643
|
+
font-size: var(--smrt-typography-body-medium-size, 0.8125rem);
|
|
644
|
+
outline: none;
|
|
645
|
+
background: var(--smrt-color-surface, #ffffff);
|
|
646
|
+
color: var(--smrt-color-on-surface, #1a1c1e);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.new-topic-input:focus {
|
|
650
|
+
border-color: var(--smrt-color-primary, #005ac1);
|
|
651
|
+
}
|
|
652
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentEditorAssistantContext, ContentEditorAssistantFieldUpdateAllowList } from '../../content-editor-assistant';
|
|
2
|
+
export interface Props {
|
|
3
|
+
apiBaseUrl?: string;
|
|
4
|
+
assistantContext?: ContentEditorAssistantContext | null;
|
|
5
|
+
contentId?: string;
|
|
6
|
+
currentEditorState?: string;
|
|
7
|
+
currentReferenceIds?: string[];
|
|
8
|
+
formFields?: Record<string, string>;
|
|
9
|
+
currentProfileId?: string;
|
|
10
|
+
assistantFieldAllowList?: ContentEditorAssistantFieldUpdateAllowList;
|
|
11
|
+
onapplyfields?: (fields: Record<string, string>) => void;
|
|
12
|
+
onclose?: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const ContentAgentChat: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type ContentAgentChat = ReturnType<typeof ContentAgentChat>;
|
|
16
|
+
export default ContentAgentChat;
|
|
17
|
+
//# sourceMappingURL=ContentAgentChat.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentAgentChat.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/ContentAgentChat.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0CAA0C,EAC3C,MAAM,gCAAgC,CAAC;AASxC,MAAM,WAAW,KAAK;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,6BAA6B,GAAG,IAAI,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,0CAA0C,CAAC;IACrE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAkdD,QAAA,MAAM,gBAAgB,2CAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|