@moontra/moonui-pro 2.8.4 → 2.8.5
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/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
import * as t from 'react';
|
|
4
4
|
import t__default, { useState, useRef, useCallback, forwardRef, createContext, useEffect, useContext, useMemo, useLayoutEffect, useDebugValue, Component } from 'react';
|
|
5
5
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
6
|
-
import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, CreditCard, Globe, CheckCircle2, XCircle, RotateCcw, Download, Clock, HelpCircle, ChevronLeft, Calendar as Calendar$1, Edit, Trash2, MapPin, User, GripVertical, MessageCircle, Paperclip, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, CheckSquare, Quote, Palette, Highlighter, Link2, Image as Image$1, Table as Table$1, Settings, Undo, Redo, Eye, RefreshCw, Wand2, Maximize, FileText, Languages, TrendingUp, TrendingDown, ZoomOut, ZoomIn, FileSpreadsheet, FileJson, Maximize2, Move, Menu, Bell, CheckCheck, CheckCircle, Settings2, LogOut, Edit3, LayoutGrid, Upload, Share2, Save, Filter, FileDown, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, Star, ExternalLink, CalendarIcon, DollarSign, Users, Github, GitFork, Activity, Server, EyeOff, RotateCw,
|
|
6
|
+
import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, CreditCard, Globe, CheckCircle2, XCircle, RotateCcw, Download, Clock, HelpCircle, ChevronLeft, Calendar as Calendar$1, Edit, Trash2, MapPin, User, GripVertical, MessageCircle, Paperclip, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, CheckSquare, Quote, Palette, Highlighter, Link2, Image as Image$1, Table as Table$1, Settings, Undo, Redo, Eye, RefreshCw, Wand2, Maximize, FileText, Briefcase, MessageSquare, Heart, GraduationCap, Zap, Languages, Lightbulb, TrendingUp, TrendingDown, ZoomOut, ZoomIn, FileSpreadsheet, FileJson, Maximize2, Move, Menu, Bell, CheckCheck, CheckCircle, Settings2, LogOut, Edit3, LayoutGrid, Upload, Share2, Save, Filter, FileDown, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, Star, ExternalLink, CalendarIcon, DollarSign, Users, Github, GitFork, Activity, Server, EyeOff, RotateCw, Timer, Cpu, MemoryStick, HardDrive, Network, BarChart3, Video, Music, Archive, File, Columns, Grip, Unlock, Minimize2, Map as Map$1, Target, MoreVertical, BellOff, ArrowDownRight, ArrowUpRight } from 'lucide-react';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
@@ -49910,6 +49910,326 @@ var SlashCommandsExtension = Extension.create({
|
|
|
49910
49910
|
}
|
|
49911
49911
|
});
|
|
49912
49912
|
|
|
49913
|
+
// src/lib/ai-providers.ts
|
|
49914
|
+
var GeminiProvider = class {
|
|
49915
|
+
constructor(config) {
|
|
49916
|
+
this.apiUrl = "https://generativelanguage.googleapis.com/v1beta/models";
|
|
49917
|
+
this.apiKey = config.apiKey;
|
|
49918
|
+
this.model = config.model || "gemini-2.0-flash";
|
|
49919
|
+
}
|
|
49920
|
+
async callGeminiAPI(prompt) {
|
|
49921
|
+
try {
|
|
49922
|
+
const response = await fetch(`${this.apiUrl}/${this.model}:generateContent`, {
|
|
49923
|
+
method: "POST",
|
|
49924
|
+
headers: {
|
|
49925
|
+
"Content-Type": "application/json",
|
|
49926
|
+
"X-goog-api-key": this.apiKey
|
|
49927
|
+
},
|
|
49928
|
+
body: JSON.stringify({
|
|
49929
|
+
contents: [{
|
|
49930
|
+
parts: [{
|
|
49931
|
+
text: prompt
|
|
49932
|
+
}]
|
|
49933
|
+
}]
|
|
49934
|
+
})
|
|
49935
|
+
});
|
|
49936
|
+
if (!response.ok) {
|
|
49937
|
+
const errorData = await response.text();
|
|
49938
|
+
console.error("Gemini API error response:", errorData);
|
|
49939
|
+
throw new Error(`Gemini API error: ${response.status} ${response.statusText} - ${errorData}`);
|
|
49940
|
+
}
|
|
49941
|
+
const data = await response.json();
|
|
49942
|
+
if (data.error) {
|
|
49943
|
+
throw new Error(`Gemini API error: ${data.error.message || JSON.stringify(data.error)}`);
|
|
49944
|
+
}
|
|
49945
|
+
if (data.candidates?.[0]?.finishReason === "SAFETY") {
|
|
49946
|
+
throw new Error("Content was blocked by safety filters");
|
|
49947
|
+
}
|
|
49948
|
+
const text = data.candidates?.[0]?.content?.parts?.[0]?.text;
|
|
49949
|
+
if (!text) {
|
|
49950
|
+
console.error("Gemini API response:", JSON.stringify(data, null, 2));
|
|
49951
|
+
throw new Error("No text content in Gemini API response");
|
|
49952
|
+
}
|
|
49953
|
+
return text.trim();
|
|
49954
|
+
} catch (error) {
|
|
49955
|
+
console.error("Gemini API error details:", error);
|
|
49956
|
+
if (error instanceof Error) {
|
|
49957
|
+
throw error;
|
|
49958
|
+
}
|
|
49959
|
+
throw new Error("Unknown error occurred while calling Gemini API");
|
|
49960
|
+
}
|
|
49961
|
+
}
|
|
49962
|
+
async generateText(prompt) {
|
|
49963
|
+
return this.callGeminiAPI(prompt);
|
|
49964
|
+
}
|
|
49965
|
+
async rewrite(text) {
|
|
49966
|
+
const prompt = `Rewrite the following text to make it clearer and more engaging while maintaining the same meaning. Only return the rewritten text, nothing else:
|
|
49967
|
+
|
|
49968
|
+
${text}`;
|
|
49969
|
+
return this.callGeminiAPI(prompt);
|
|
49970
|
+
}
|
|
49971
|
+
async expand(text) {
|
|
49972
|
+
const prompt = `Expand the following text with more details, examples, and explanations. Only return the expanded text, nothing else:
|
|
49973
|
+
|
|
49974
|
+
${text}`;
|
|
49975
|
+
return this.callGeminiAPI(prompt);
|
|
49976
|
+
}
|
|
49977
|
+
async summarize(text) {
|
|
49978
|
+
const prompt = `Summarize the following text concisely while keeping the main points. Only return the summary, nothing else:
|
|
49979
|
+
|
|
49980
|
+
${text}`;
|
|
49981
|
+
return this.callGeminiAPI(prompt);
|
|
49982
|
+
}
|
|
49983
|
+
async fixGrammar(text) {
|
|
49984
|
+
const prompt = `Fix any grammar and spelling errors in the following text. Only return the corrected text, nothing else:
|
|
49985
|
+
|
|
49986
|
+
${text}`;
|
|
49987
|
+
return this.callGeminiAPI(prompt);
|
|
49988
|
+
}
|
|
49989
|
+
async translate(text, targetLang) {
|
|
49990
|
+
const prompt = `Translate the following text to ${targetLang}. Only return the translation, nothing else:
|
|
49991
|
+
|
|
49992
|
+
${text}`;
|
|
49993
|
+
return this.callGeminiAPI(prompt);
|
|
49994
|
+
}
|
|
49995
|
+
async changeTone(text, tone) {
|
|
49996
|
+
const toneDescriptions = {
|
|
49997
|
+
professional: "professional and business-appropriate",
|
|
49998
|
+
casual: "casual and conversational",
|
|
49999
|
+
friendly: "warm and friendly",
|
|
50000
|
+
formal: "formal and academic"
|
|
50001
|
+
};
|
|
50002
|
+
const toneDesc = toneDescriptions[tone] || tone;
|
|
50003
|
+
const prompt = `Rewrite the following text in a ${toneDesc} tone. Only return the rewritten text, nothing else:
|
|
50004
|
+
|
|
50005
|
+
${text}`;
|
|
50006
|
+
return this.callGeminiAPI(prompt);
|
|
50007
|
+
}
|
|
50008
|
+
async continueWriting(text) {
|
|
50009
|
+
const prompt = `Continue writing from where this text ends. Only return the continuation, nothing else:
|
|
50010
|
+
|
|
50011
|
+
${text}`;
|
|
50012
|
+
return this.callGeminiAPI(prompt);
|
|
50013
|
+
}
|
|
50014
|
+
async improveWriting(text) {
|
|
50015
|
+
const prompt = `Improve the following text by making it more compelling, clear, and well-structured. Only return the improved text, nothing else:
|
|
50016
|
+
|
|
50017
|
+
${text}`;
|
|
50018
|
+
return this.callGeminiAPI(prompt);
|
|
50019
|
+
}
|
|
50020
|
+
async generateIdeas(text) {
|
|
50021
|
+
const prompt = `Generate creative ideas and suggestions based on this topic. Format as a bullet list:
|
|
50022
|
+
|
|
50023
|
+
${text}`;
|
|
50024
|
+
return this.callGeminiAPI(prompt);
|
|
50025
|
+
}
|
|
50026
|
+
async complete(text) {
|
|
50027
|
+
const prompt = `Complete this text naturally. Only return the completion, nothing else:
|
|
50028
|
+
|
|
50029
|
+
${text}`;
|
|
50030
|
+
return this.callGeminiAPI(prompt);
|
|
50031
|
+
}
|
|
50032
|
+
};
|
|
50033
|
+
var OpenAIProvider = class {
|
|
50034
|
+
constructor(config) {
|
|
50035
|
+
this.apiUrl = "https://api.openai.com/v1/chat/completions";
|
|
50036
|
+
this.apiKey = config.apiKey;
|
|
50037
|
+
this.model = config.model || "gpt-3.5-turbo";
|
|
50038
|
+
this.temperature = config.temperature || 0.7;
|
|
50039
|
+
this.maxTokens = config.maxTokens || 1e3;
|
|
50040
|
+
}
|
|
50041
|
+
async callOpenAI(systemPrompt, userPrompt) {
|
|
50042
|
+
try {
|
|
50043
|
+
const response = await fetch(this.apiUrl, {
|
|
50044
|
+
method: "POST",
|
|
50045
|
+
headers: {
|
|
50046
|
+
"Content-Type": "application/json",
|
|
50047
|
+
"Authorization": `Bearer ${this.apiKey}`
|
|
50048
|
+
},
|
|
50049
|
+
body: JSON.stringify({
|
|
50050
|
+
model: this.model,
|
|
50051
|
+
messages: [
|
|
50052
|
+
{ role: "system", content: systemPrompt },
|
|
50053
|
+
{ role: "user", content: userPrompt }
|
|
50054
|
+
],
|
|
50055
|
+
temperature: this.temperature,
|
|
50056
|
+
max_tokens: this.maxTokens
|
|
50057
|
+
})
|
|
50058
|
+
});
|
|
50059
|
+
if (!response.ok) {
|
|
50060
|
+
throw new Error(`OpenAI API error: ${response.statusText}`);
|
|
50061
|
+
}
|
|
50062
|
+
const data = await response.json();
|
|
50063
|
+
return data.choices?.[0]?.message?.content || "";
|
|
50064
|
+
} catch (error) {
|
|
50065
|
+
console.error("OpenAI API error:", error);
|
|
50066
|
+
throw error;
|
|
50067
|
+
}
|
|
50068
|
+
}
|
|
50069
|
+
async generateText(prompt) {
|
|
50070
|
+
return this.callOpenAI("You are a helpful writing assistant.", prompt);
|
|
50071
|
+
}
|
|
50072
|
+
async rewrite(text) {
|
|
50073
|
+
return this.callOpenAI(
|
|
50074
|
+
"You are a professional editor. Rewrite text to be clearer and more engaging.",
|
|
50075
|
+
text
|
|
50076
|
+
);
|
|
50077
|
+
}
|
|
50078
|
+
async expand(text) {
|
|
50079
|
+
return this.callOpenAI(
|
|
50080
|
+
"You are a content writer. Expand the given text with more details and examples.",
|
|
50081
|
+
text
|
|
50082
|
+
);
|
|
50083
|
+
}
|
|
50084
|
+
async summarize(text) {
|
|
50085
|
+
return this.callOpenAI(
|
|
50086
|
+
"You are a summarization expert. Create concise summaries.",
|
|
50087
|
+
text
|
|
50088
|
+
);
|
|
50089
|
+
}
|
|
50090
|
+
async fixGrammar(text) {
|
|
50091
|
+
return this.callOpenAI(
|
|
50092
|
+
"You are a grammar expert. Fix all grammar and spelling errors.",
|
|
50093
|
+
text
|
|
50094
|
+
);
|
|
50095
|
+
}
|
|
50096
|
+
async translate(text, targetLang) {
|
|
50097
|
+
return this.callOpenAI(
|
|
50098
|
+
`You are a professional translator. Translate to ${targetLang}.`,
|
|
50099
|
+
text
|
|
50100
|
+
);
|
|
50101
|
+
}
|
|
50102
|
+
async changeTone(text, tone) {
|
|
50103
|
+
return this.callOpenAI(
|
|
50104
|
+
`You are a writing expert. Rewrite the text in a ${tone} tone.`,
|
|
50105
|
+
text
|
|
50106
|
+
);
|
|
50107
|
+
}
|
|
50108
|
+
async continueWriting(text) {
|
|
50109
|
+
return this.callOpenAI(
|
|
50110
|
+
"You are a creative writer. Continue writing from where the text ends.",
|
|
50111
|
+
text
|
|
50112
|
+
);
|
|
50113
|
+
}
|
|
50114
|
+
async improveWriting(text) {
|
|
50115
|
+
return this.callOpenAI(
|
|
50116
|
+
"You are a professional editor. Improve the text quality.",
|
|
50117
|
+
text
|
|
50118
|
+
);
|
|
50119
|
+
}
|
|
50120
|
+
async generateIdeas(text) {
|
|
50121
|
+
return this.callOpenAI(
|
|
50122
|
+
"You are a creative consultant. Generate ideas based on the topic.",
|
|
50123
|
+
text
|
|
50124
|
+
);
|
|
50125
|
+
}
|
|
50126
|
+
async complete(text) {
|
|
50127
|
+
return this.callOpenAI(
|
|
50128
|
+
"You are a writing assistant. Complete the text naturally.",
|
|
50129
|
+
text
|
|
50130
|
+
);
|
|
50131
|
+
}
|
|
50132
|
+
};
|
|
50133
|
+
var ClaudeProvider = class {
|
|
50134
|
+
constructor(config) {
|
|
50135
|
+
this.apiUrl = "https://api.anthropic.com/v1/messages";
|
|
50136
|
+
this.apiKey = config.apiKey;
|
|
50137
|
+
this.model = config.model || "claude-3-sonnet-20240229";
|
|
50138
|
+
}
|
|
50139
|
+
async callClaude(prompt) {
|
|
50140
|
+
try {
|
|
50141
|
+
const response = await fetch(this.apiUrl, {
|
|
50142
|
+
method: "POST",
|
|
50143
|
+
headers: {
|
|
50144
|
+
"Content-Type": "application/json",
|
|
50145
|
+
"x-api-key": this.apiKey,
|
|
50146
|
+
"anthropic-version": "2023-06-01"
|
|
50147
|
+
},
|
|
50148
|
+
body: JSON.stringify({
|
|
50149
|
+
model: this.model,
|
|
50150
|
+
max_tokens: 1e3,
|
|
50151
|
+
messages: [
|
|
50152
|
+
{ role: "user", content: prompt }
|
|
50153
|
+
]
|
|
50154
|
+
})
|
|
50155
|
+
});
|
|
50156
|
+
if (!response.ok) {
|
|
50157
|
+
throw new Error(`Claude API error: ${response.statusText}`);
|
|
50158
|
+
}
|
|
50159
|
+
const data = await response.json();
|
|
50160
|
+
return data.content?.[0]?.text || "";
|
|
50161
|
+
} catch (error) {
|
|
50162
|
+
console.error("Claude API error:", error);
|
|
50163
|
+
throw error;
|
|
50164
|
+
}
|
|
50165
|
+
}
|
|
50166
|
+
async generateText(prompt) {
|
|
50167
|
+
return this.callClaude(prompt);
|
|
50168
|
+
}
|
|
50169
|
+
async rewrite(text) {
|
|
50170
|
+
return this.callClaude(`Rewrite this text to be clearer and more engaging:
|
|
50171
|
+
|
|
50172
|
+
${text}`);
|
|
50173
|
+
}
|
|
50174
|
+
async expand(text) {
|
|
50175
|
+
return this.callClaude(`Expand this text with more details:
|
|
50176
|
+
|
|
50177
|
+
${text}`);
|
|
50178
|
+
}
|
|
50179
|
+
async summarize(text) {
|
|
50180
|
+
return this.callClaude(`Summarize this text concisely:
|
|
50181
|
+
|
|
50182
|
+
${text}`);
|
|
50183
|
+
}
|
|
50184
|
+
async fixGrammar(text) {
|
|
50185
|
+
return this.callClaude(`Fix grammar and spelling errors in:
|
|
50186
|
+
|
|
50187
|
+
${text}`);
|
|
50188
|
+
}
|
|
50189
|
+
async translate(text, targetLang) {
|
|
50190
|
+
return this.callClaude(`Translate to ${targetLang}:
|
|
50191
|
+
|
|
50192
|
+
${text}`);
|
|
50193
|
+
}
|
|
50194
|
+
async changeTone(text, tone) {
|
|
50195
|
+
return this.callClaude(`Rewrite in a ${tone} tone:
|
|
50196
|
+
|
|
50197
|
+
${text}`);
|
|
50198
|
+
}
|
|
50199
|
+
async continueWriting(text) {
|
|
50200
|
+
return this.callClaude(`Continue writing from:
|
|
50201
|
+
|
|
50202
|
+
${text}`);
|
|
50203
|
+
}
|
|
50204
|
+
async improveWriting(text) {
|
|
50205
|
+
return this.callClaude(`Improve this text:
|
|
50206
|
+
|
|
50207
|
+
${text}`);
|
|
50208
|
+
}
|
|
50209
|
+
async generateIdeas(text) {
|
|
50210
|
+
return this.callClaude(`Generate ideas for:
|
|
50211
|
+
|
|
50212
|
+
${text}`);
|
|
50213
|
+
}
|
|
50214
|
+
async complete(text) {
|
|
50215
|
+
return this.callClaude(`Complete:
|
|
50216
|
+
|
|
50217
|
+
${text}`);
|
|
50218
|
+
}
|
|
50219
|
+
};
|
|
50220
|
+
function createAIProvider(provider, config) {
|
|
50221
|
+
switch (provider) {
|
|
50222
|
+
case "gemini":
|
|
50223
|
+
return new GeminiProvider(config);
|
|
50224
|
+
case "openai":
|
|
50225
|
+
return new OpenAIProvider(config);
|
|
50226
|
+
case "claude":
|
|
50227
|
+
return new ClaudeProvider(config);
|
|
50228
|
+
default:
|
|
50229
|
+
throw new Error(`Unsupported AI provider: ${provider}`);
|
|
50230
|
+
}
|
|
50231
|
+
}
|
|
50232
|
+
|
|
49913
50233
|
// src/components/rich-text-editor/slash-commands.css
|
|
49914
50234
|
styleInject(".slash-commands-menu {\n border-radius: var(--radius);\n border-width: 1px;\n --tw-border-opacity: 1;\n border-color: rgb(229 231 235 / var(--tw-border-opacity, 1));\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000),\n var(--tw-shadow);\n}\n.slash-commands-menu:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));\n --tw-bg-opacity: 1;\n background-color: rgb(17 24 39 / var(--tw-bg-opacity, 1));\n}\n.slash-commands-menu {\n max-height: 20rem;\n min-width: 280px;\n overflow-y: auto;\n padding: 0.5rem;\n}\n.slash-command-item {\n display: flex;\n cursor: pointer;\n align-items: center;\n gap: 0.75rem;\n border-radius: calc(var(--radius) - 2px);\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.slash-command-item:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));\n}\n.slash-command-item:hover:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));\n}\n.slash-command-item.selected {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));\n}\n.slash-command-item.selected:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));\n}\n.slash-command-item svg {\n height: 1rem;\n width: 1rem;\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\n.slash-command-item svg:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity, 1));\n}\n.slash-command-item > div {\n flex: 1 1 0%;\n}\n.slash-command-item .command-name {\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 500;\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.slash-command-item .command-name:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(243 244 246 / var(--tw-text-opacity, 1));\n}\n.slash-command-item .command-description {\n margin-top: 0.125rem;\n font-size: 0.75rem;\n line-height: 1rem;\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\n.slash-command-item .command-description:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity, 1));\n}\n.dark .slash-commands-menu {\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);\n}\n");
|
|
49915
50235
|
|
|
@@ -49917,56 +50237,29 @@ styleInject(".slash-commands-menu {\n border-radius: var(--radius);\n border-w
|
|
|
49917
50237
|
styleInject('.ProseMirror table {\n border-collapse: collapse;\n margin: 0;\n overflow: hidden;\n table-layout: fixed;\n width: 100%;\n border: 1px solid #d1d5db;\n}\n.ProseMirror table td,\n.ProseMirror table th {\n border: 1px solid #d1d5db;\n box-sizing: border-box;\n min-width: 1em;\n padding: 6px 8px;\n position: relative;\n vertical-align: top;\n}\n.ProseMirror table th {\n background-color: #f9fafb;\n font-weight: 600;\n text-align: left;\n}\n.ProseMirror table .selectedCell:after {\n background-color: rgba(59, 130, 246, 0.1);\n content: "";\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n position: absolute;\n z-index: 2;\n}\n.ProseMirror table .column-resize-handle {\n background-color: #3b82f6;\n bottom: -2px;\n position: absolute;\n right: -2px;\n top: 0;\n width: 4px;\n pointer-events: none;\n}\n.dark .ProseMirror table {\n border: 1px solid #374151;\n}\n.dark .ProseMirror table td,\n.dark .ProseMirror table th {\n border: 1px solid #374151;\n}\n.dark .ProseMirror table th {\n background-color: #111827;\n}\n.dark .ProseMirror table .selectedCell:after {\n background-color: rgba(59, 130, 246, 0.2);\n}\n');
|
|
49918
50238
|
var lowlight = createLowlight(grammars);
|
|
49919
50239
|
var getAIProvider = (settings) => {
|
|
49920
|
-
|
|
49921
|
-
|
|
49922
|
-
|
|
49923
|
-
|
|
49924
|
-
|
|
49925
|
-
|
|
49926
|
-
|
|
49927
|
-
|
|
49928
|
-
|
|
49929
|
-
|
|
49930
|
-
|
|
49931
|
-
|
|
49932
|
-
|
|
49933
|
-
|
|
49934
|
-
|
|
49935
|
-
|
|
49936
|
-
|
|
49937
|
-
|
|
49938
|
-
|
|
49939
|
-
|
|
49940
|
-
|
|
49941
|
-
|
|
49942
|
-
|
|
49943
|
-
return result;
|
|
49944
|
-
},
|
|
49945
|
-
translate: async (text, targetLang) => {
|
|
49946
|
-
const result = await generateWithPrompt(`Translate to ${targetLang}`, text);
|
|
49947
|
-
return result;
|
|
49948
|
-
},
|
|
49949
|
-
changeTone: async (text, tone) => {
|
|
49950
|
-
const result = await generateWithPrompt(`Change tone to ${tone}`, text);
|
|
49951
|
-
return result;
|
|
49952
|
-
},
|
|
49953
|
-
continueWriting: async (text) => {
|
|
49954
|
-
const result = await generateWithPrompt("Continue writing", text);
|
|
49955
|
-
return result;
|
|
49956
|
-
},
|
|
49957
|
-
improveWriting: async (text) => {
|
|
49958
|
-
const result = await generateWithPrompt("Improve writing quality", text);
|
|
49959
|
-
return result;
|
|
49960
|
-
},
|
|
49961
|
-
generateIdeas: async (text) => {
|
|
49962
|
-
const result = await generateWithPrompt("Generate writing ideas", text);
|
|
49963
|
-
return result;
|
|
49964
|
-
},
|
|
49965
|
-
complete: async (text) => {
|
|
49966
|
-
const result = await generateWithPrompt("Complete this text", text);
|
|
49967
|
-
return result;
|
|
49968
|
-
}
|
|
49969
|
-
};
|
|
50240
|
+
if (!settings.apiKey)
|
|
50241
|
+
return null;
|
|
50242
|
+
try {
|
|
50243
|
+
const providerMap = {
|
|
50244
|
+
"openai": "openai",
|
|
50245
|
+
"gemini": "gemini",
|
|
50246
|
+
"claude": "claude",
|
|
50247
|
+
"anthropic": "claude",
|
|
50248
|
+
// Map anthropic to claude
|
|
50249
|
+
"cohere": "openai"
|
|
50250
|
+
// Use OpenAI as fallback for unsupported providers
|
|
50251
|
+
};
|
|
50252
|
+
const mappedProvider = providerMap[settings.provider] || "openai";
|
|
50253
|
+
return createAIProvider(mappedProvider, {
|
|
50254
|
+
apiKey: settings.apiKey,
|
|
50255
|
+
model: settings.model,
|
|
50256
|
+
temperature: settings.temperature,
|
|
50257
|
+
maxTokens: settings.maxTokens
|
|
50258
|
+
});
|
|
50259
|
+
} catch (error) {
|
|
50260
|
+
console.error("Failed to create AI provider:", error);
|
|
50261
|
+
return null;
|
|
50262
|
+
}
|
|
49970
50263
|
};
|
|
49971
50264
|
var EditorColorPicker = ({
|
|
49972
50265
|
onColorSelect,
|
|
@@ -50071,7 +50364,7 @@ function RichTextEditor({
|
|
|
50071
50364
|
aiConfig = {
|
|
50072
50365
|
provider: "openai",
|
|
50073
50366
|
apiKey: "",
|
|
50074
|
-
model: "gpt-
|
|
50367
|
+
model: "gpt-3.5-turbo",
|
|
50075
50368
|
temperature: 0.7,
|
|
50076
50369
|
maxTokens: 1e3
|
|
50077
50370
|
}
|
|
@@ -50304,6 +50597,9 @@ function RichTextEditor({
|
|
|
50304
50597
|
setIsProcessing(true);
|
|
50305
50598
|
try {
|
|
50306
50599
|
const provider = getAIProvider(aiSettings);
|
|
50600
|
+
if (!provider) {
|
|
50601
|
+
throw new Error("Failed to initialize AI provider");
|
|
50602
|
+
}
|
|
50307
50603
|
let response;
|
|
50308
50604
|
switch (action) {
|
|
50309
50605
|
case "rewrite":
|
|
@@ -50345,19 +50641,11 @@ function RichTextEditor({
|
|
|
50345
50641
|
default:
|
|
50346
50642
|
response = await provider.complete(text);
|
|
50347
50643
|
}
|
|
50348
|
-
|
|
50349
|
-
|
|
50350
|
-
title: "AI Error",
|
|
50351
|
-
description: response.error,
|
|
50352
|
-
variant: "destructive"
|
|
50353
|
-
});
|
|
50354
|
-
return null;
|
|
50355
|
-
}
|
|
50356
|
-
return response.text;
|
|
50357
|
-
} catch {
|
|
50644
|
+
return response;
|
|
50645
|
+
} catch (error) {
|
|
50358
50646
|
toast({
|
|
50359
50647
|
title: "AI Error",
|
|
50360
|
-
description: "Failed to process with AI
|
|
50648
|
+
description: error instanceof Error ? error.message : "Failed to process with AI",
|
|
50361
50649
|
variant: "destructive"
|
|
50362
50650
|
});
|
|
50363
50651
|
return null;
|
|
@@ -50378,15 +50666,44 @@ function RichTextEditor({
|
|
|
50378
50666
|
});
|
|
50379
50667
|
return;
|
|
50380
50668
|
}
|
|
50669
|
+
const processingToast = toast({
|
|
50670
|
+
title: "Processing with AI...",
|
|
50671
|
+
description: getActionDescription(action),
|
|
50672
|
+
duration: 6e4
|
|
50673
|
+
// Long duration
|
|
50674
|
+
});
|
|
50381
50675
|
const result = await callAI(action, selectedText || editor.getText());
|
|
50676
|
+
processingToast.dismiss();
|
|
50382
50677
|
if (result) {
|
|
50383
50678
|
if (selectedText) {
|
|
50384
50679
|
editor.chain().focus().deleteSelection().insertContent(result).run();
|
|
50385
50680
|
} else {
|
|
50386
50681
|
editor.chain().focus().insertContent(result).run();
|
|
50387
50682
|
}
|
|
50683
|
+
toast({
|
|
50684
|
+
title: "AI action completed",
|
|
50685
|
+
description: "Your text has been updated successfully."
|
|
50686
|
+
});
|
|
50388
50687
|
}
|
|
50389
50688
|
};
|
|
50689
|
+
const getActionDescription = (action) => {
|
|
50690
|
+
const descriptions = {
|
|
50691
|
+
rewrite: "Rewriting your text...",
|
|
50692
|
+
improve: "Improving your writing...",
|
|
50693
|
+
expand: "Expanding your text...",
|
|
50694
|
+
summarize: "Creating a summary...",
|
|
50695
|
+
fix: "Fixing grammar and spelling...",
|
|
50696
|
+
translate: "Translating to Turkish...",
|
|
50697
|
+
tone_professional: "Making text professional...",
|
|
50698
|
+
tone_casual: "Making text casual...",
|
|
50699
|
+
tone_friendly: "Making text friendly...",
|
|
50700
|
+
tone_formal: "Making text formal...",
|
|
50701
|
+
continue: "Continuing your writing...",
|
|
50702
|
+
ideas: "Generating ideas...",
|
|
50703
|
+
complete: "Completing your text..."
|
|
50704
|
+
};
|
|
50705
|
+
return descriptions[action] || "Processing...";
|
|
50706
|
+
};
|
|
50390
50707
|
const [linkUrl, setLinkUrl] = useState("");
|
|
50391
50708
|
const [imageUrl, setImageUrl] = useState("");
|
|
50392
50709
|
const [isLinkDialogOpen, setIsLinkDialogOpen] = useState(false);
|
|
@@ -50905,7 +51222,7 @@ function RichTextEditor({
|
|
|
50905
51222
|
{
|
|
50906
51223
|
variant: "ghost",
|
|
50907
51224
|
size: "sm",
|
|
50908
|
-
className: "h-8 px-3 bg-purple-100 hover:bg-purple-200 dark:bg-purple-900 dark:hover:bg-purple-800",
|
|
51225
|
+
className: "h-8 px-3 bg-purple-100 hover:bg-purple-200 dark:bg-purple-900 dark:hover:bg-purple-800 transition-colors",
|
|
50909
51226
|
disabled: isProcessing,
|
|
50910
51227
|
children: [
|
|
50911
51228
|
isProcessing ? /* @__PURE__ */ jsx(RefreshCw, { className: "w-4 h-4 mr-1 animate-spin" }) : /* @__PURE__ */ jsx(Wand2, { className: "w-4 h-4 mr-1" }),
|
|
@@ -50913,57 +51230,172 @@ function RichTextEditor({
|
|
|
50913
51230
|
]
|
|
50914
51231
|
}
|
|
50915
51232
|
) }),
|
|
50916
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { className: "w-
|
|
50917
|
-
/* @__PURE__ */ jsxs(
|
|
50918
|
-
/* @__PURE__ */ jsx(
|
|
50919
|
-
"
|
|
50920
|
-
] }),
|
|
50921
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("improve"), children: [
|
|
50922
|
-
/* @__PURE__ */ jsx(Wand2, { className: "w-4 h-4 mr-2" }),
|
|
50923
|
-
"Improve Writing"
|
|
50924
|
-
] }),
|
|
50925
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("expand"), children: [
|
|
50926
|
-
/* @__PURE__ */ jsx(Maximize, { className: "w-4 h-4 mr-2" }),
|
|
50927
|
-
"Expand Text"
|
|
50928
|
-
] }),
|
|
50929
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("summarize"), children: [
|
|
50930
|
-
/* @__PURE__ */ jsx(FileText, { className: "w-4 h-4 mr-2" }),
|
|
50931
|
-
"Summarize"
|
|
50932
|
-
] }),
|
|
50933
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("continue"), children: [
|
|
50934
|
-
/* @__PURE__ */ jsx(Plus, { className: "w-4 h-4 mr-2" }),
|
|
50935
|
-
"Continue Writing"
|
|
50936
|
-
] }),
|
|
50937
|
-
/* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {}),
|
|
50938
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("fix"), children: [
|
|
50939
|
-
/* @__PURE__ */ jsx(Check, { className: "w-4 h-4 mr-2" }),
|
|
50940
|
-
"Fix Grammar & Spelling"
|
|
51233
|
+
/* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { className: "w-64", children: [
|
|
51234
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-1.5 text-xs font-semibold text-muted-foreground flex items-center gap-2", children: [
|
|
51235
|
+
/* @__PURE__ */ jsx(Wand2, { className: "w-3 h-3" }),
|
|
51236
|
+
"Writing Improvements"
|
|
50941
51237
|
] }),
|
|
51238
|
+
/* @__PURE__ */ jsxs(
|
|
51239
|
+
MoonUIDropdownMenuItemPro,
|
|
51240
|
+
{
|
|
51241
|
+
onClick: () => handleAIAction("rewrite"),
|
|
51242
|
+
disabled: isProcessing,
|
|
51243
|
+
children: [
|
|
51244
|
+
/* @__PURE__ */ jsx(RefreshCw, { className: "w-4 h-4 mr-2" }),
|
|
51245
|
+
"Rewrite Selection",
|
|
51246
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: "Alt+R" })
|
|
51247
|
+
]
|
|
51248
|
+
}
|
|
51249
|
+
),
|
|
51250
|
+
/* @__PURE__ */ jsxs(
|
|
51251
|
+
MoonUIDropdownMenuItemPro,
|
|
51252
|
+
{
|
|
51253
|
+
onClick: () => handleAIAction("improve"),
|
|
51254
|
+
disabled: isProcessing,
|
|
51255
|
+
children: [
|
|
51256
|
+
/* @__PURE__ */ jsx(Sparkles, { className: "w-4 h-4 mr-2" }),
|
|
51257
|
+
"Improve Writing"
|
|
51258
|
+
]
|
|
51259
|
+
}
|
|
51260
|
+
),
|
|
51261
|
+
/* @__PURE__ */ jsxs(
|
|
51262
|
+
MoonUIDropdownMenuItemPro,
|
|
51263
|
+
{
|
|
51264
|
+
onClick: () => handleAIAction("expand"),
|
|
51265
|
+
disabled: isProcessing,
|
|
51266
|
+
children: [
|
|
51267
|
+
/* @__PURE__ */ jsx(Maximize, { className: "w-4 h-4 mr-2" }),
|
|
51268
|
+
"Expand Text"
|
|
51269
|
+
]
|
|
51270
|
+
}
|
|
51271
|
+
),
|
|
51272
|
+
/* @__PURE__ */ jsxs(
|
|
51273
|
+
MoonUIDropdownMenuItemPro,
|
|
51274
|
+
{
|
|
51275
|
+
onClick: () => handleAIAction("summarize"),
|
|
51276
|
+
disabled: isProcessing,
|
|
51277
|
+
children: [
|
|
51278
|
+
/* @__PURE__ */ jsx(FileText, { className: "w-4 h-4 mr-2" }),
|
|
51279
|
+
"Summarize"
|
|
51280
|
+
]
|
|
51281
|
+
}
|
|
51282
|
+
),
|
|
51283
|
+
/* @__PURE__ */ jsxs(
|
|
51284
|
+
MoonUIDropdownMenuItemPro,
|
|
51285
|
+
{
|
|
51286
|
+
onClick: () => handleAIAction("continue"),
|
|
51287
|
+
disabled: isProcessing,
|
|
51288
|
+
children: [
|
|
51289
|
+
/* @__PURE__ */ jsx(Plus, { className: "w-4 h-4 mr-2" }),
|
|
51290
|
+
"Continue Writing"
|
|
51291
|
+
]
|
|
51292
|
+
}
|
|
51293
|
+
),
|
|
50942
51294
|
/* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {}),
|
|
50943
|
-
/* @__PURE__ */ jsxs(
|
|
50944
|
-
/* @__PURE__ */ jsx(
|
|
50945
|
-
"
|
|
50946
|
-
] }),
|
|
50947
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("tone_casual"), children: [
|
|
50948
|
-
/* @__PURE__ */ jsx(Sparkles, { className: "w-4 h-4 mr-2" }),
|
|
50949
|
-
"Make Casual"
|
|
50950
|
-
] }),
|
|
50951
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("tone_friendly"), children: [
|
|
50952
|
-
/* @__PURE__ */ jsx(Sparkles, { className: "w-4 h-4 mr-2" }),
|
|
50953
|
-
"Make Friendly"
|
|
50954
|
-
] }),
|
|
50955
|
-
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAIAction("tone_formal"), children: [
|
|
50956
|
-
/* @__PURE__ */ jsx(Sparkles, { className: "w-4 h-4 mr-2" }),
|
|
50957
|
-
"Make Formal"
|
|
51295
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-1.5 text-xs font-semibold text-muted-foreground flex items-center gap-2", children: [
|
|
51296
|
+
/* @__PURE__ */ jsx(Palette, { className: "w-3 h-3" }),
|
|
51297
|
+
"Tone Adjustments"
|
|
50958
51298
|
] }),
|
|
51299
|
+
/* @__PURE__ */ jsxs(
|
|
51300
|
+
MoonUIDropdownMenuItemPro,
|
|
51301
|
+
{
|
|
51302
|
+
onClick: () => handleAIAction("tone_professional"),
|
|
51303
|
+
disabled: isProcessing,
|
|
51304
|
+
children: [
|
|
51305
|
+
/* @__PURE__ */ jsx(Briefcase, { className: "w-4 h-4 mr-2" }),
|
|
51306
|
+
"Make Professional"
|
|
51307
|
+
]
|
|
51308
|
+
}
|
|
51309
|
+
),
|
|
51310
|
+
/* @__PURE__ */ jsxs(
|
|
51311
|
+
MoonUIDropdownMenuItemPro,
|
|
51312
|
+
{
|
|
51313
|
+
onClick: () => handleAIAction("tone_casual"),
|
|
51314
|
+
disabled: isProcessing,
|
|
51315
|
+
children: [
|
|
51316
|
+
/* @__PURE__ */ jsx(MessageSquare, { className: "w-4 h-4 mr-2" }),
|
|
51317
|
+
"Make Casual"
|
|
51318
|
+
]
|
|
51319
|
+
}
|
|
51320
|
+
),
|
|
51321
|
+
/* @__PURE__ */ jsxs(
|
|
51322
|
+
MoonUIDropdownMenuItemPro,
|
|
51323
|
+
{
|
|
51324
|
+
onClick: () => handleAIAction("tone_friendly"),
|
|
51325
|
+
disabled: isProcessing,
|
|
51326
|
+
children: [
|
|
51327
|
+
/* @__PURE__ */ jsx(Heart, { className: "w-4 h-4 mr-2" }),
|
|
51328
|
+
"Make Friendly"
|
|
51329
|
+
]
|
|
51330
|
+
}
|
|
51331
|
+
),
|
|
51332
|
+
/* @__PURE__ */ jsxs(
|
|
51333
|
+
MoonUIDropdownMenuItemPro,
|
|
51334
|
+
{
|
|
51335
|
+
onClick: () => handleAIAction("tone_formal"),
|
|
51336
|
+
disabled: isProcessing,
|
|
51337
|
+
children: [
|
|
51338
|
+
/* @__PURE__ */ jsx(GraduationCap, { className: "w-4 h-4 mr-2" }),
|
|
51339
|
+
"Make Formal"
|
|
51340
|
+
]
|
|
51341
|
+
}
|
|
51342
|
+
),
|
|
50959
51343
|
/* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {}),
|
|
50960
|
-
/* @__PURE__ */ jsxs(
|
|
50961
|
-
/* @__PURE__ */ jsx(
|
|
50962
|
-
"
|
|
51344
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-1.5 text-xs font-semibold text-muted-foreground flex items-center gap-2", children: [
|
|
51345
|
+
/* @__PURE__ */ jsx(Zap, { className: "w-3 h-3" }),
|
|
51346
|
+
"Other Actions"
|
|
50963
51347
|
] }),
|
|
50964
|
-
/* @__PURE__ */ jsxs(
|
|
50965
|
-
|
|
50966
|
-
|
|
51348
|
+
/* @__PURE__ */ jsxs(
|
|
51349
|
+
MoonUIDropdownMenuItemPro,
|
|
51350
|
+
{
|
|
51351
|
+
onClick: () => handleAIAction("fix"),
|
|
51352
|
+
disabled: isProcessing,
|
|
51353
|
+
children: [
|
|
51354
|
+
/* @__PURE__ */ jsx(Check, { className: "w-4 h-4 mr-2" }),
|
|
51355
|
+
"Fix Grammar & Spelling",
|
|
51356
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: "F7" })
|
|
51357
|
+
]
|
|
51358
|
+
}
|
|
51359
|
+
),
|
|
51360
|
+
/* @__PURE__ */ jsxs(
|
|
51361
|
+
MoonUIDropdownMenuItemPro,
|
|
51362
|
+
{
|
|
51363
|
+
onClick: () => handleAIAction("translate"),
|
|
51364
|
+
disabled: isProcessing,
|
|
51365
|
+
children: [
|
|
51366
|
+
/* @__PURE__ */ jsx(Languages, { className: "w-4 h-4 mr-2" }),
|
|
51367
|
+
"Translate to Turkish"
|
|
51368
|
+
]
|
|
51369
|
+
}
|
|
51370
|
+
),
|
|
51371
|
+
/* @__PURE__ */ jsxs(
|
|
51372
|
+
MoonUIDropdownMenuItemPro,
|
|
51373
|
+
{
|
|
51374
|
+
onClick: () => handleAIAction("ideas"),
|
|
51375
|
+
disabled: isProcessing,
|
|
51376
|
+
children: [
|
|
51377
|
+
/* @__PURE__ */ jsx(Lightbulb, { className: "w-4 h-4 mr-2" }),
|
|
51378
|
+
"Generate Ideas"
|
|
51379
|
+
]
|
|
51380
|
+
}
|
|
51381
|
+
),
|
|
51382
|
+
!aiSettings.apiKey && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51383
|
+
/* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {}),
|
|
51384
|
+
/* @__PURE__ */ jsx("div", { className: "px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
51385
|
+
motion.div,
|
|
51386
|
+
{
|
|
51387
|
+
initial: { opacity: 0, y: -10 },
|
|
51388
|
+
animate: { opacity: 1, y: 0 },
|
|
51389
|
+
className: "text-xs text-muted-foreground bg-yellow-100 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3",
|
|
51390
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
51391
|
+
/* @__PURE__ */ jsx(Settings, { className: "w-3 h-3 mt-0.5 text-yellow-600 dark:text-yellow-400" }),
|
|
51392
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
51393
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-yellow-900 dark:text-yellow-200 mb-1", children: "API Key Required" }),
|
|
51394
|
+
/* @__PURE__ */ jsx("div", { className: "text-yellow-800 dark:text-yellow-300", children: "Click the settings icon to configure your AI provider and API key." })
|
|
51395
|
+
] })
|
|
51396
|
+
] })
|
|
51397
|
+
}
|
|
51398
|
+
) })
|
|
50967
51399
|
] })
|
|
50968
51400
|
] })
|
|
50969
51401
|
] }),
|
|
@@ -50989,7 +51421,19 @@ function RichTextEditor({
|
|
|
50989
51421
|
MoonUISelectPro,
|
|
50990
51422
|
{
|
|
50991
51423
|
value: aiSettings.provider,
|
|
50992
|
-
onValueChange: (value) =>
|
|
51424
|
+
onValueChange: (value) => {
|
|
51425
|
+
const defaultModels = {
|
|
51426
|
+
openai: "gpt-3.5-turbo",
|
|
51427
|
+
claude: "claude-3-sonnet-20240229",
|
|
51428
|
+
gemini: "gemini-2.0-flash",
|
|
51429
|
+
cohere: "command"
|
|
51430
|
+
};
|
|
51431
|
+
setAiSettings({
|
|
51432
|
+
...aiSettings,
|
|
51433
|
+
provider: value,
|
|
51434
|
+
model: defaultModels[value] || "gpt-3.5-turbo"
|
|
51435
|
+
});
|
|
51436
|
+
},
|
|
50993
51437
|
children: [
|
|
50994
51438
|
/* @__PURE__ */ jsx(MoonUISelectTriggerPro, { children: /* @__PURE__ */ jsx(MoonUISelectValuePro, {}) }),
|
|
50995
51439
|
/* @__PURE__ */ jsxs(MoonUISelectContentPro, { children: [
|
|
@@ -51035,8 +51479,9 @@ function RichTextEditor({
|
|
|
51035
51479
|
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "claude-3-haiku", children: "Claude 3 Haiku" })
|
|
51036
51480
|
] }),
|
|
51037
51481
|
aiSettings.provider === "gemini" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51038
|
-
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "gemini-
|
|
51039
|
-
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "gemini-
|
|
51482
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "gemini-2.0-flash", children: "Gemini 2.0 Flash" }),
|
|
51483
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "gemini-1.5-flash", children: "Gemini 1.5 Flash" }),
|
|
51484
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "gemini-1.5-pro", children: "Gemini 1.5 Pro" })
|
|
51040
51485
|
] }),
|
|
51041
51486
|
aiSettings.provider === "cohere" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51042
51487
|
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "command", children: "Command" }),
|
|
@@ -61148,7 +61593,7 @@ var MoonUIPhoneNumberInputPro = t__default.forwardRef(({
|
|
|
61148
61593
|
onPaste: handlePaste2,
|
|
61149
61594
|
onFocus: () => setIsFocused(true),
|
|
61150
61595
|
onBlur: () => setIsFocused(false),
|
|
61151
|
-
placeholder: selectedCountry
|
|
61596
|
+
placeholder: selectedCountry?.format?.replace(/x/g, "\u2022") || "Enter phone number",
|
|
61152
61597
|
className: cn(
|
|
61153
61598
|
"pr-10",
|
|
61154
61599
|
error && "border-destructive",
|