Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC-730][docs-beta] creates ScoutOS Docusaurus plugin for embedded chat #27198

Merged
merged 10 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/docs-beta/.cursorrules → docs/.cursorrules
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
You are an expert in Python, Dagster, and data engineering.
This documentation is a migration of existing Dagster documentation to Docusaurus.
Documentation is in the `/docs` directory.
Components are in the `/src/components` directory.
Old Documentation is in the `/docs` directory.
New Documentation is in the `/docs/docs-beta` directory.
Components are in the `/docs/docs-beta/src/components` directory.

Key Principles
- Follow the Diataxis Principle for documentation.
Expand All @@ -13,6 +14,8 @@ Key Principles
Python/Dagster
- Prefer @asset over @op
- Use type hints for all function signatures. Prefer Pydantic models over raw dictionaries for input validation.
- For Dagster imports, use `import dagster as dg, @dg.asset`
- For Dagster library imports, use `from dagster_snowflake import snowflake_io_manager`

Guides
- Guides should include the following
Expand All @@ -22,7 +25,7 @@ Guides
- **Organization**, **Admin**, or **Editor** permissions on Dagster+
</details>
- Code examples should be in the following format
<CodeExample filePath="getting-started/hello-world.py" language="python" />
<CodeExample filePath="getting-started/hello-world.py" language="python" /
cmpadden marked this conversation as resolved.
Show resolved Hide resolved


Output Formatting
Expand Down
1 change: 1 addition & 0 deletions docs/.windsurfrules
1 change: 1 addition & 0 deletions docs/docs-beta/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const config: Config = {
plugins: [
require.resolve('docusaurus-plugin-sass'),
require.resolve('docusaurus-plugin-image-zoom'),
require.resolve('./src/plugins/scoutos'),
],
themeConfig: {
// Algolia environment variables are not required during development
Expand Down
105 changes: 105 additions & 0 deletions docs/docs-beta/src/plugins/scoutos/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// ScoutOS Docusaurus Plugin
//
// Injects the required HTML for the ScoutOS chat bot into all pages on Docusaurus.
//
// USAGE
//
// Include the plugin in your `docusaurus.config.js`:
//
// plugins: [
// require.resolve('./src/plugins/scoutos'),
// ],
//
// REFERENCE
//
// https://docs.scoutos.com/docs/integrations/scout-copilot
// https://docusaurus.io/docs/api/plugin-methods/lifecycle-apis#injectHtmlTags
//
//
//
//

const SCOUTOS_INNER_HTML = `
document.addEventListener('DOMContentLoaded', function() {
var copilot = document.createElement('co-pilot');
copilot.setAttribute('copilot_id', 'dagster');
copilot.innerHTML = \`
<div
slot="fab"
style="
background-color: var(--prism-background-color);
padding-left: 24px;
padding-right: 24px;
padding-top: 4px;
padding-bottom: 4px;
border-radius: 24px;
display: flex;
flex-direction: row;
align-items: center;
gap: 8px;
font-weight: 500;
font-family: "Geist", "Inter", "Arial", sans-serif;
"
>
<div style="padding-top: 4px;">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
>
<path
d="M6 14H14V12H6V14ZM6 11H18V9H6V11ZM6 8H18V6H6V8ZM2 22V4C2 3.45 2.19583 2.97917 2.5875 2.5875C2.97917 2.19583 3.45 2 4 2H20C20.55 2 21.0208 2.19583 21.4125 2.5875C21.8042 2.97917 22 3.45 22 4V16C22 16.55 21.8042 17.0208 21.4125 17.4125C21.0208 17.8042 20.55 18 20 18H6L2 22ZM5.15 16H20V4H4V17.125L5.15 16Z"
fill="currentColor"
/>
</svg>
</div>
<div>Ask AI</div>
</div>
\`;

document.body.appendChild(copilot);

var script = document.createElement('script');
script.setAttribute('type', 'module');
script.setAttribute('src', 'https://ui.scoutos.com/copilot.js');
document.body.appendChild(script);
});
`;

// https://docs.scoutos.com/docs/integrations/scout-copilot#adding-the-copilot-widget-to-your-website
const SCOUTOS_COPILOT_INNER_HTML = `
document.addEventListener('DOMContentLoaded', function() {
var copilot = document.createElement('scout-copilot');
copilot.setAttribute('copilot_id', 'copilot_cm61kissp00010es61qxro4dq');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PedramNavid , let me know if you'd like me to customize the button (but maybe fancier?) like old docs. Otherwise, we can rely on the image set in ScoutOS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea a new button would be great! Renaming Gary and changing the icon before we hit publish would be helpful too: https://studio.scoutos.com/integrations/copilots/v2/copilot_cm61kissp00010es61qxro4dq

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit the sparkle icon, but will tinker with it more tomorrow per our Slack convo.
image

document.body.appendChild(copilot);

var script = document.createElement('script');
script.setAttribute('type', 'module');
script.setAttribute('src', 'https://copilot.scoutos.com/copilot.js');
cmpadden marked this conversation as resolved.
Show resolved Hide resolved
document.body.appendChild(script);
});
`;

module.exports = function (context, options) {
return {
name: 'scoutos',
injectHtmlTags() {
return {
headTags: [
{
tagName: 'script',
attributes: {
type: 'text/javascript',
},
// NOTE: we load the HTML after the `DOMContenteLoader` event as we want to prevent this
// from being statically embedded in the HTML. One reason for this is because the
// custom `scout-os` element fails to build due to minification errors.
innerHTML: SCOUTOS_COPILOT_INNER_HTML,
},
],
};
},
};
};
Loading