Skip to content

Commit

Permalink
Theia AI LLM Support [Experimental]
Browse files Browse the repository at this point in the history
Implements AI LLM support via optionally consumable Theia extensions.

The base functionality is provided by the following extensions:
- @theia/ai-core
- @theia/ai-chat
- @theia/ai-chat-ui

'ai-core' contains the basic LLM integration and defines the core
concepts for interacting with LLM via agents, prompts and variables.
'ai-chat' builts on top to define a model for chat like conversations.
'ai-chat-ui' provides the actual Chat UI.

The AI integration was built from the ground up to be flexible,
inspectible, customizable and configurable.

This feature is still highly experimental. Therefore, even when the AI
extensions are included in a Theia based application, they are turned
off by default and need to be enabled in the preferences. The
preferences include a convenient: turn all AI features off setting.

Additional features and integrations are offered by the remaining
extensions:
- @theia/ai-history
- @theia/ai-code-completion
- @theia/ai-terminal
- @theia/ai-workspace-agent
- @theia/ai-openai

'ai-history' offers a service to record requests and responses. The
recordings can be inspected via the 'AI History View'.
'ai-code-completion' offers AI based code completion via completion
items and inline suggestions.
'ai-terminal' offers a specialized AI for the Theia terminal which
will suggest commands to execute.
'ai-workspace-agent' is a specialized agent which is able to inspect
the current workspace content for context specific questions.
'ai-openai' integrates the LLM offerings of Open AI into Theia.

Co-authored-by: Alexandra Muntean <[email protected]>
Co-authored-by: Camille Letavernier <[email protected]>
Co-authored-by: Christian W. Damus <[email protected]>
Co-authored-by: Eugen Neufeld <[email protected]>
Co-authored-by: Haydar Metin <[email protected]>
Co-authored-by: Johannes Faltermeier <[email protected]>
Co-authored-by: Jonas Helming <[email protected]>
Co-authored-by: Lucas Koehler <[email protected]>
Co-authored-by: Martin Fleck <[email protected]>
Co-authored-by: Maximilian Koegel <[email protected]>
Co-authored-by: Nina Doschek <[email protected]>
Co-authored-by: Olaf Lessenich <[email protected]>
Co-authored-by: Philip Langer <[email protected]>
Co-authored-by: Remi Schnekenburger <[email protected]>
Co-authored-by: Simon Graband <[email protected]>
Co-authored-by: Tobias Ortmayr <[email protected]>
  • Loading branch information
17 people committed Aug 14, 2024
1 parent a9345da commit f9b258c
Show file tree
Hide file tree
Showing 160 changed files with 12,569 additions and 19 deletions.
6 changes: 6 additions & 0 deletions examples/browser-only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
}
},
"dependencies": {
"@theia/ai-chat": "1.52.0",
"@theia/ai-chat-ui": "1.52.0",
"@theia/ai-code-completion": "1.52.0",
"@theia/ai-core": "1.52.0",
"@theia/ai-history": "1.52.0",
"@theia/ai-openai": "1.52.0",
"@theia/api-samples": "1.52.0",
"@theia/bulk-edit": "1.52.0",
"@theia/callhierarchy": "1.52.0",
Expand Down
18 changes: 18 additions & 0 deletions examples/browser-only/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@
{
"path": "../../dev-packages/cli"
},
{
"path": "../../packages/ai-chat"
},
{
"path": "../../packages/ai-chat-ui"
},
{
"path": "../../packages/ai-code-completion"
},
{
"path": "../../packages/ai-core"
},
{
"path": "../../packages/ai-history"
},
{
"path": "../../packages/ai-openai"
},
{
"path": "../../packages/bulk-edit"
},
Expand Down
8 changes: 8 additions & 0 deletions examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
}
},
"dependencies": {
"@theia/ai-chat": "1.52.0",
"@theia/ai-chat-ui": "1.52.0",
"@theia/ai-code-completion": "1.52.0",
"@theia/ai-core": "1.52.0",
"@theia/ai-history": "1.52.0",
"@theia/ai-openai": "1.52.0",
"@theia/ai-terminal": "1.52.0",
"@theia/ai-workspace-agent": "1.52.0",
"@theia/api-provider-sample": "1.52.0",
"@theia/api-samples": "1.52.0",
"@theia/bulk-edit": "1.52.0",
Expand Down
24 changes: 24 additions & 0 deletions examples/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
{
"path": "../../dev-packages/cli"
},
{
"path": "../../packages/ai-chat"
},
{
"path": "../../packages/ai-chat-ui"
},
{
"path": "../../packages/ai-code-completion"
},
{
"path": "../../packages/ai-core"
},
{
"path": "../../packages/ai-history"
},
{
"path": "../../packages/ai-openai"
},
{
"path": "../../packages/ai-terminal"
},
{
"path": "../../packages/ai-workspace-agent"
},
{
"path": "../../packages/bulk-edit"
},
Expand Down
8 changes: 8 additions & 0 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
}
},
"dependencies": {
"@theia/ai-chat": "1.52.0",
"@theia/ai-chat-ui": "1.52.0",
"@theia/ai-code-completion": "1.52.0",
"@theia/ai-core": "1.52.0",
"@theia/ai-history": "1.52.0",
"@theia/ai-openai": "1.52.0",
"@theia/ai-terminal": "1.52.0",
"@theia/ai-workspace-agent": "1.52.0",
"@theia/api-provider-sample": "1.52.0",
"@theia/api-samples": "1.52.0",
"@theia/bulk-edit": "1.52.0",
Expand Down
24 changes: 24 additions & 0 deletions examples/electron/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,30 @@
{
"path": "../../dev-packages/cli"
},
{
"path": "../../packages/ai-chat"
},
{
"path": "../../packages/ai-chat-ui"
},
{
"path": "../../packages/ai-code-completion"
},
{
"path": "../../packages/ai-core"
},
{
"path": "../../packages/ai-history"
},
{
"path": "../../packages/ai-openai"
},
{
"path": "../../packages/ai-terminal"
},
{
"path": "../../packages/ai-workspace-agent"
},
{
"path": "../../packages/bulk-edit"
},
Expand Down
10 changes: 10 additions & 0 deletions packages/ai-chat-ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: [
'../../configs/build.eslintrc.json'
],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
}
};
32 changes: 32 additions & 0 deletions packages/ai-chat-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div align='center'>

<br />

<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />

<h2>ECLIPSE THEIA - AI Chat UI EXTENSION</h2>

<hr />

</div>

## Description

The `@theia/ai-chat-ui` extension contributes the `AI Chat` view.\
The `AI Chat view` can be used to easily communicate with a language model.

It is based on `@theia/ai-chat`.

## Additional Information

- [Theia - GitHub](https://github.com/eclipse-theia/theia)
- [Theia - Website](https://theia-ide.org/)

## License

- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)

## Trademark
"Theia" is a trademark of the Eclipse Foundation
https://www.eclipse.org/theia
58 changes: 58 additions & 0 deletions packages/ai-chat-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "@theia/ai-chat-ui",
"version": "1.52.0",
"description": "Theia - AI Chat UI Extension",
"dependencies": {
"@theia/ai-core": "1.52.0",
"@theia/ai-chat": "1.52.0",
"@theia/core": "1.52.0",
"@theia/editor": "1.52.0",
"@theia/filesystem": "1.52.0",
"@theia/monaco": "1.52.0",
"@theia/monaco-editor-core": "1.83.101",
"@theia/editor-preview": "1.52.0",
"@theia/workspace": "1.52.0",
"minimatch": "^5.1.0",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
},
"publishConfig": {
"access": "public"
},
"theiaExtensions": [
{
"frontend": "lib/browser/aichat-ui-frontend-module",
"secondaryWindow": "lib/browser/aichat-ui-frontend-module"
}
],
"keywords": [
"theia-extension"
],
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-theia/theia.git"
},
"bugs": {
"url": "https://github.com/eclipse-theia/theia/issues"
},
"homepage": "https://github.com/eclipse-theia/theia",
"files": [
"lib",
"src"
],
"scripts": {
"build": "theiaext build",
"clean": "theiaext clean",
"compile": "theiaext compile",
"lint": "theiaext lint",
"test": "theiaext test",
"watch": "theiaext watch"
},
"devDependencies": {
"@theia/ext-scripts": "1.52.0"
},
"nyc": {
"extends": "../../configs/nyc.json"
}
}
41 changes: 41 additions & 0 deletions packages/ai-chat-ui/src/browser/ai-chat-command-contribution.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// *****************************************************************************
// Copyright (C) 2024 EclipseSource GmbH.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { COMMAND_CHAT_RESPONSE_COMMAND } from '@theia/ai-chat/lib/common';
import { Command, CommandContribution, CommandRegistry } from '@theia/core';
import { injectable } from '@theia/core/shared/inversify';

export interface AIChatCommandArguments {
command: Command;
handler?: (...commandArgs: unknown[]) => Promise<void>;
arguments?: unknown[];
}

@injectable()
export class AIChatCommandContribution implements CommandContribution {

registerCommands(commands: CommandRegistry): void {
commands.registerCommand(COMMAND_CHAT_RESPONSE_COMMAND, {
execute: async (arg: AIChatCommandArguments) => {
if (arg.handler) {
arg.handler();
} else {
console.error(`No handle available which is necessary when using the default command '${COMMAND_CHAT_RESPONSE_COMMAND.id}'.`);
}
}
});
}
}
Loading

0 comments on commit f9b258c

Please sign in to comment.