diff --git a/.DS_Store b/.DS_Store index fbab92ed..8a189235 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.hintrc b/.hintrc new file mode 100644 index 00000000..12c4655b --- /dev/null +++ b/.hintrc @@ -0,0 +1,8 @@ +{ + "extends": [ + "development" + ], + "hints": { + "typescript-config/strict": "off" + } +} \ No newline at end of file diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 00000000..07964678 Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/Compose with AI -Screenshot.png b/assets/Compose with AI -Screenshot.png deleted file mode 100644 index f73f9719..00000000 Binary files a/assets/Compose with AI -Screenshot.png and /dev/null differ diff --git a/assets/icon-128.png b/assets/icon-128.png index 6df91c7e..46961748 100644 Binary files a/assets/icon-128.png and b/assets/icon-128.png differ diff --git a/assets/icon-16.png b/assets/icon-16.png index 1424c925..ce3349d4 100644 Binary files a/assets/icon-16.png and b/assets/icon-16.png differ diff --git a/assets/icon-32.png b/assets/icon-32.png index 72d2f148..9954cee3 100644 Binary files a/assets/icon-32.png and b/assets/icon-32.png differ diff --git a/assets/icon-64.png b/assets/icon-64.png index 257857d2..46961748 100644 Binary files a/assets/icon-64.png and b/assets/icon-64.png differ diff --git a/assets/icon-80.png b/assets/icon-80.png index 0181aa5a..46961748 100644 Binary files a/assets/icon-80.png and b/assets/icon-80.png differ diff --git a/assets/logo-filled.png b/assets/logo-filled.png index c6b7fb4e..46961748 100644 Binary files a/assets/logo-filled.png and b/assets/logo-filled.png differ diff --git a/manifest.xml b/manifest.xml index 05c8187e..f5f1c193 100644 --- a/manifest.xml +++ b/manifest.xml @@ -4,11 +4,11 @@ 1.0.0.0 OutlookLLM RizLum en-US - - + + - + https://localhost diff --git a/src/summarizepane/components/App.jsx b/src/summarizepane/components/App.jsx index c593163e..39debb2d 100644 --- a/src/summarizepane/components/App.jsx +++ b/src/summarizepane/components/App.jsx @@ -1,8 +1,9 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import * as React from "react"; import PropTypes from "prop-types"; import Header from "./Header"; import HeroList from "./HeroList"; -import TextInsertion from "./TextInsertion"; +import Summarize from "./Summarize"; import { makeStyles } from "@fluentui/react-components"; import { Ribbon24Regular, LockOpen24Regular, DesignIdeas24Regular } from "@fluentui/react-icons"; import QuickResponse from "./QuickResponse"; @@ -18,8 +19,8 @@ const App = (props) => { return (
- - + + {/* */}
); }; diff --git a/src/summarizepane/components/TextInsertion.jsx b/src/summarizepane/components/Summarize.jsx similarity index 80% rename from src/summarizepane/components/TextInsertion.jsx rename to src/summarizepane/components/Summarize.jsx index 3ee25524..a86e9065 100644 --- a/src/summarizepane/components/TextInsertion.jsx +++ b/src/summarizepane/components/Summarize.jsx @@ -45,11 +45,16 @@ const useStyles = makeStyles({ }); -const TextInsertion = () => { +const Summarize = () => { const [showSpinner, setshowSpinner] = useState(false); const [showSpinnerdetails, setshowSpinnerdetails] = useState(false); const [emailsummary, setEmailsummary] = useState(""); const [emailsummarydetails, setEmailsummarydetails] = useState(""); + const [language, setLanguage] = useState("English"); // Default language is English + + const handleLanguageChange = (event) => { + setLanguage(event.target.value); + }; const getEmailContent = () => new Promise((resolve, reject) => { @@ -77,10 +82,10 @@ const TextInsertion = () => { body: JSON.stringify({ model: 'riz-text', messages: [ - { role: "system", content: "You are an email assistant." }, + { role: "system", content: "You are an email summarizer." }, { role: 'user', - content: 'Summarize briefly less than 40 words the content of the following email body: ' + emailContent, + content: `Summarize less than 50 words in ${language}$ the following email content into a concise summary:\n\n${emailContent}`, }, ], }), @@ -98,8 +103,7 @@ const TextInsertion = () => { console.error('Error fetching data:', error); } - setshowSpinner(false); - + setshowSpinner(false); }; const handleSummaryLong = async () => { @@ -117,10 +121,10 @@ const TextInsertion = () => { body: JSON.stringify({ model: 'riz-text', messages: [ - { role: "system", content: "You are an email assistant." }, + { role: "system", content: "You are an email summarizer." }, { role: 'user', - content: 'Summarize in detail less than 200 words the content of the following email body: ' + emailContent_detail, + content: `Summarize less than 200 words in ${language}$ the following email content into a concise summary:\n\n${emailContent_detail}$`, }, ], }), @@ -138,8 +142,7 @@ const TextInsertion = () => { console.error('Error fetching data:', error); } - setshowSpinnerdetails(false); - + setshowSpinnerdetails(false); }; const styles = useStyles(); @@ -147,11 +150,25 @@ const TextInsertion = () => { return (
Summarize with AI +
+ + +
{/* */} {emailsummary && ( @@ -167,8 +184,8 @@ const TextInsertion = () => { fontSize: "16px", // Improves text readability fontFamily: "'Segoe UI', Tahoma, Geneva, Verdana, sans-serif", // Uses a modern font lineHeight: "1.5", // Adds spacing for multiline content - padding: "12px", // Adds internal spacing for a spacious feel - borderRadius: "8px", // Smooth rounded corners + padding: "0px", // Adds internal spacing for a spacious feel + borderRadius: "5px", // Smooth rounded corners border: "1px solid #e1e4e8", // Subtle border for a clean outline boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)", // Adds a soft shadow for depth overflowY: "auto", // Ensures content is scrollable if it exceeds height @@ -184,7 +201,6 @@ const TextInsertion = () => { {emailsummarydetails && (
{ fontSize: "14px", // Improves text readability fontFamily: "'Segoe UI', Tahoma, Geneva, Verdana, sans-serif", // Uses a modern font lineHeight: "1.5", // Adds spacing for multiline content - padding: "12px", // Adds internal spacing for a spacious feel - borderRadius: "8px", // Smooth rounded corners + padding: "5px", // Adds internal spacing for a spacious feel + borderRadius: "5px", // Smooth rounded corners border: "1px solid #e1e4e8", // Subtle border for a clean outline boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)", // Adds a soft shadow for depth overflowY: "auto", // Ensures content is scrollable if it exceeds height - }} /> + }} + />
)}
); }; -export default TextInsertion; +export default Summarize; diff --git a/src/taskpane/components/TextInsertion.jsx b/src/taskpane/components/TextInsertion.jsx index 9df76b31..ca1095db 100644 --- a/src/taskpane/components/TextInsertion.jsx +++ b/src/taskpane/components/TextInsertion.jsx @@ -1,8 +1,10 @@ +/* eslint-disable no-undef */ /* eslint-disable prettier/prettier */ import * as React from "react"; import { useState } from "react"; import { Button, Field, Title3, Checkbox, Textarea, Text, Spinner, tokens, makeStyles } from "@fluentui/react-components"; -import { insertText } from "../outlook"; +//import { insertText } from "../outlook"; +import insertText from "../office-document"; const useStyles = makeStyles({ @@ -17,7 +19,7 @@ const useStyles = makeStyles({ marginLeft: "15px", marginTop: "30px", marginRight: "15px", - + marginBottom: "10px" }, textAreaField: { @@ -26,8 +28,15 @@ const useStyles = makeStyles({ marginRight: "15px", minHeight: "150px", + marginBottom: "15px" }, + textArea: { + padding: "8px", + marginBottom: "10px" + }, + + textCheck: { marginTop: "10px", marginLeft: "15px", @@ -42,19 +51,18 @@ const useStyles = makeStyles({ }); const TextInsertion = () => { - const [text, setText] = useState("Write an email to make a meeting with client"); + const [language, setLanguage] = useState("English"); // Default language is English + const [text, setText] = useState("Give some ideas to write the email"); const [showSpinner, setshowSpinner] = useState(false); - const [writeSubject, setWriteSubject] = useState(false); + const [writeSubject, setWriteSubject] = useState("Subject of emal (optional)"); let data = ""; + let subject_email = ""; const handleTextInsertion = async () => { - try { - - setshowSpinner(true); - - console.log("test before"); - //const fetchChatCompletion = async () => { - try { + try { + setshowSpinner(true); + console.log("test before"); + const res = await fetch('https://ai.rizlum.com/chat/completions', { method: 'POST', headers: { @@ -67,7 +75,16 @@ const TextInsertion = () => { { role: "system", content: "You are an email assistant." }, { role: 'user', - content: 'Write an email content without subject with the following content: ' + text, + content: `Generate a professionnal email content in ${language} without a subject based on the following ideas: ${text}. + + Formatting instructions: + 1. Include appropriate line breaks to separate paragraphs. + 2. Add a blank line (double line spacing) between paragraphs to improve readability. + 3. For example: + - Start with a salutation such as "Hello [Recipient's Name]," followed by a blank line. + - After each paragraph, leave a blank line before starting the next. + - End the email with a closing like "Best regards," followed by the sender's name, with a blank line between them. + Ensure the email is well-structured and visually appealing with clear spacing between sections.` }, ], }), @@ -77,65 +94,67 @@ const TextInsertion = () => { throw new Error(`HTTP error! status: ${res.status}`); } - data = await res.json(); - console.log(data); - // setResponse(data); - } catch (error) { - console.error('Error fetching chat completion:', error); - //setResponse('Error fetching data'); - } - //}; - - // const response = await fetch("http://localhost:11434/api/generate", { - // method: "POST", - // headers: { - // "Content-Type": "application/json", - // }, - // body: JSON.stringify({ - // model: "llama3.2", - // prompt: text, - // }) - // }); - //const response = "Hello World, we are Rizlum"; + data = await res.json(); console.log(data); - - // if (!response.ok) { - // throw new Error("Network response was not ok"); - // } - // Handle success response if needed console.log('Data sent successfully'); const textContent = data.choices[0].message.content; console.log(textContent); - //const textContent = "Insert this magic text from Riz Lum :D"; - //await insertText(textContent, writeSubject); - await insertText(textContent); + // Insert text and subject to the email compose + if (writeSubject == "Subject of emal (optional)") { + subject_email = ""; + } + else { + subject_email = writeSubject; + } + await insertText(textContent,subject_email); setshowSpinner(false); } catch (error) { setshowSpinner(false); console.error('Error sending data:',error); - } - - + } + }; + const handleLanguageChange = (event) => { + setLanguage(event.target.value); }; const handleTextChange = async (event) => { setText(event.target.value); }; + const handleSubjectChange = async (event) => { + setWriteSubject(event.target.value); + }; + const styles = useStyles(); return (
- Compose with AI - 1. Set the cursor where you want to insert the AI generated email. - -