How to use @jupyterlab/chatbox - 4 common examples

To help you get started, we’ve selected a few @jupyterlab/chatbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / chatbox-extension / src / index.ts View on Github external
function activateChatbox(app: JupyterLab, rendermime: IRenderMime, palette: ICommandPalette, editorServices: IEditorServices, docManager: IDocumentManager, restorer: ILayoutRestorer): void {
  const id = 'chatbox';
  let { commands, shell } = app;
  let category = 'Chatbox';
  let command: string;

  /**
   * Create a chatbox for a given path.
   */
  let editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
  let contentFactory = new ChatboxPanel.ContentFactory({ editorFactory });
  let panel = new ChatboxPanel({
    rendermime: rendermime.clone(),
    contentFactory
  });

  // Add the chatbox panel to the tracker.
  panel.title.label = 'Chat';
  panel.id = id;

  restorer.add(panel, 'chatbox');

  command = CommandIDs.clear;
  commands.addCommand(command, {
    label: 'Clear Chat',
    execute: args => {
      panel.chatbox.clear();
    }
github jupyterlab / jupyterlab / packages / chatbox-extension / src / index.ts View on Github external
function activateChatbox(app: JupyterLab, rendermime: IRenderMime, palette: ICommandPalette, editorServices: IEditorServices, docManager: IDocumentManager, restorer: ILayoutRestorer): void {
  const id = 'chatbox';
  let { commands, shell } = app;
  let category = 'Chatbox';
  let command: string;

  /**
   * Create a chatbox for a given path.
   */
  let editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
  let contentFactory = new ChatboxPanel.ContentFactory({ editorFactory });
  let panel = new ChatboxPanel({
    rendermime: rendermime.clone(),
    contentFactory
  });

  // Add the chatbox panel to the tracker.
  panel.title.label = 'Chat';
  panel.id = id;

  restorer.add(panel, 'chatbox');

  command = CommandIDs.clear;
  commands.addCommand(command, {
    label: 'Clear Chat',
    execute: args => {
      panel.chatbox.clear();
github jupyterlab / jupyterlab / test / src / chatbox / chatbox.spec.ts View on Github external
beforeEach(() => {
      chatbox = new Chatbox({
        rendermime, contentFactory
      });
      modelDB = new DummyCollaborativeDB();
      docmodel = new DocumentModel('', modelDB);
      chatbox.model = docmodel;
    });
github jupyterlab / jupyterlab / test / src / chatbox / chatbox.spec.ts View on Github external
import {
  ModelDB, ObservableMap, ObservableList, ICollaborator
} from '@jupyterlab/coreutils';

import {
  defaultRenderMime
} from '../utils';


/**
 * Factory stuff.
 */
const editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
const contentFactory = new Chatbox.ContentFactory({ editorFactory });
const rendermime = defaultRenderMime();

/**
 * Create a dummy collaborator map.
 */
class DummyCollaboratorMap extends ObservableMap {
  type: 'Map';

  readonly localCollaborator: ICollaborator = {
    userId: '1234',
    sessionId: '5678',
    displayName: 'A. U. Thor',
    color: '#00FF33',
    shortName: 'AU'
  }
}

@jupyterlab/chatbox

JupyterLab - Chatbox

BSD-3-Clause
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Similar packages