ALwrity + Wix + Wordpress + GSC + Bug Fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useCopilotAction } from '@copilotkit/react-core';
|
||||
import { linkedInWriterApi, LinkedInPostRequest, GroundingLevel } from '../../services/linkedInWriterApi';
|
||||
import { linkedInWriterApi, GroundingLevel } from '../../services/linkedInWriterApi';
|
||||
import {
|
||||
mapPostType,
|
||||
mapTone,
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
mapSearchEngine,
|
||||
readPrefs
|
||||
} from './utils/linkedInWriterUtils';
|
||||
import { PostHITL, ArticleHITL, CarouselHITL, VideoScriptHITL, CommentResponseHITL } from './components';
|
||||
import { apiClient } from '../../api/client';
|
||||
|
||||
const useCopilotActionTyped = useCopilotAction as any;
|
||||
@@ -125,17 +124,6 @@ const RegisterLinkedInActions: React.FC = () => {
|
||||
]
|
||||
}}));
|
||||
|
||||
// If refining existing content, use the current draft as context
|
||||
let existingContent = '';
|
||||
if (args?.refine_existing) {
|
||||
// Get current draft from the page context
|
||||
const textarea = document.querySelector('textarea') as HTMLTextAreaElement;
|
||||
const currentDraft = textarea?.value || '';
|
||||
if (currentDraft) {
|
||||
existingContent = `\n\nREFINE THIS EXISTING CONTENT:\n${currentDraft}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Start detailed progress tracking
|
||||
window.dispatchEvent(new CustomEvent('linkedinwriter:progressStep', {
|
||||
detail: {
|
||||
@@ -750,7 +738,7 @@ const RegisterLinkedInActions: React.FC = () => {
|
||||
{ name: 'improvement_type', type: 'string', required: false }
|
||||
],
|
||||
handler: async (args: any) => {
|
||||
const { recommendation, current_content, improvement_type } = args;
|
||||
const { recommendation } = args;
|
||||
|
||||
// Analyze the recommendation and provide specific improvement guidance
|
||||
let improvementGuidance = '';
|
||||
|
||||
@@ -57,7 +57,6 @@ const RegisterLinkedInEditActions: React.FC = () => {
|
||||
],
|
||||
handler: async (args: any) => {
|
||||
const content = args?.content || '';
|
||||
const industry = args?.industry || 'Technology';
|
||||
|
||||
// Placeholder for hashtag addition
|
||||
const hashtags = '#ProfessionalDevelopment #Networking #IndustryInsights #CareerGrowth';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { usePlatformPersonaContext } from '../../shared/PersonaContext/PlatformPersonaProvider';
|
||||
import { apiClient } from '../../../api/client';
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ interface ContentEditorProps {
|
||||
topic?: string;
|
||||
}
|
||||
|
||||
export { ContentEditor };
|
||||
|
||||
const ContentEditor: React.FC<ContentEditorProps> = ({
|
||||
isPreviewing,
|
||||
pendingEdit,
|
||||
@@ -62,6 +60,7 @@ const ContentEditor: React.FC<ContentEditorProps> = ({
|
||||
const ctaCooldownRef = useRef<number | null>(null); // 15s cooldown after dismissing CTA
|
||||
useEffect(() => {
|
||||
if (DEBUG_WA) console.log('🎯 [ContentEditor] waSuggestion changed:', waSuggestion);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [waSuggestion]);
|
||||
const waTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const hasTriggeredOnceRef = useRef<boolean>(false);
|
||||
@@ -228,8 +227,6 @@ const ContentEditor: React.FC<ContentEditorProps> = ({
|
||||
lastWords: words.slice(-5).join(' ')
|
||||
});
|
||||
|
||||
const now = Date.now();
|
||||
const last = lastSuggestMetaRef.current;
|
||||
const textHash = getStableContextHash(uptoCaret);
|
||||
|
||||
// After first auto-trigger, stop auto-calling API. Show CTA instead.
|
||||
@@ -271,7 +268,7 @@ const ContentEditor: React.FC<ContentEditorProps> = ({
|
||||
let userError = "Failed to get writing suggestion";
|
||||
if (msg.includes('429') || msg.includes('RESOURCE_EXHAUSTED')) {
|
||||
userError = "API quota exceeded. Please try again later or upgrade your plan.";
|
||||
const match = msg.match(/\"retryDelay\"\s*:\s*\"(\d+)s\"/);
|
||||
const match = msg.match(/"retryDelay"\s*:\s*"(\d+)s"/);
|
||||
const retryMs = match ? parseInt(match[1], 10) * 1000 : 40000;
|
||||
coolDownUntilRef.current = Date.now() + retryMs;
|
||||
console.warn('✍️ [ContentEditor] Entering suggestion cooldown for ms:', retryMs);
|
||||
@@ -316,7 +313,7 @@ const ContentEditor: React.FC<ContentEditorProps> = ({
|
||||
let userError = "Failed to get writing suggestion";
|
||||
if (msg.includes('429') || msg.includes('RESOURCE_EXHAUSTED')) {
|
||||
userError = "API quota exceeded. Please try again later or upgrade your plan.";
|
||||
const match = msg.match(/\"retryDelay\"\s*:\s*\"(\d+)s\"/);
|
||||
const match = msg.match(/"retryDelay"\s*:\s*"(\d+)s"/);
|
||||
const retryMs = match ? parseInt(match[1], 10) * 1000 : 40000;
|
||||
coolDownUntilRef.current = Date.now() + retryMs;
|
||||
console.warn('✍️ [ContentEditor] Entering suggestion cooldown for ms:', retryMs);
|
||||
@@ -421,4 +418,6 @@ const ContentEditor: React.FC<ContentEditorProps> = ({
|
||||
<CitationHoverHandler researchSources={researchSources || []} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export { ContentEditor };
|
||||
Reference in New Issue
Block a user