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

feat: Theia AI integration #172

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
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
Loading