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

Chat AI #289

Merged
merged 42 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7885645
add chat capabilities
ajshedivy Mar 22, 2024
a58cf5c
Small bits
worksofliam Mar 23, 2024
6a95809
Minor changes
worksofliam Mar 23, 2024
8c32619
Change prompt inputs
worksofliam Mar 23, 2024
1fa8941
Word improvements
worksofliam Mar 23, 2024
82eaf14
Example variable
worksofliam Mar 25, 2024
9b446bf
Default to build
worksofliam Mar 25, 2024
18c93ea
Schema references
worksofliam Mar 25, 2024
1a9d7ba
Explicit references required
worksofliam Mar 25, 2024
52cb9cb
Change markdown format
worksofliam Mar 25, 2024
5360e3b
Merge branch 'main' into chatai
worksofliam Jun 20, 2024
097ec86
Update to VS Code 1.90
worksofliam Jun 20, 2024
a33eedf
Start of ollama support
worksofliam Jun 20, 2024
4141fa2
test ollama provider, update lm api
ajshedivy Jun 20, 2024
27fd03a
Fix broken legacy build
worksofliam Jun 21, 2024
005be60
Move some logic to new context file
worksofliam Jun 21, 2024
6a058cf
More configuration improvements
worksofliam Jun 21, 2024
6d8b363
add quick pick types
ajshedivy Jun 21, 2024
d05e242
Ability to select model
worksofliam Jun 21, 2024
2db60f9
Merge branch 'chatai' of github.com:codefori/vscode-db2i into chatai
worksofliam Jun 21, 2024
b8cf527
Correct message
worksofliam Jun 21, 2024
8fd7d49
Pass stream all the way down
worksofliam Jun 21, 2024
74426a5
Add additional return
worksofliam Jun 21, 2024
b9070d6
Cleanup of chat selector
worksofliam Jun 21, 2024
a54d8f2
fix ollama stream
ajshedivy Jun 21, 2024
ac41081
Merge branch 'chatai' of https://github.com/halcyon-tech/vscode-db2i …
ajshedivy Jun 21, 2024
57aa120
show seletected on copilot models
ajshedivy Jun 21, 2024
67cf28b
show model provider and model name when new model is selected
ajshedivy Jun 21, 2024
9637530
Merge branch 'main' into chatai
worksofliam Jul 1, 2024
491b5ca
WIP: allow users to reference tables with schema.table
ajshedivy Jul 1, 2024
bfb603d
Fix plural bug
worksofliam Jul 12, 2024
0776359
Merge branch 'dev' into chatai
ajshedivy Oct 1, 2024
0bfeaba
Remove Ollama from model selection
worksofliam Oct 4, 2024
a23d4f0
use JSON string in chat messages
ajshedivy Oct 7, 2024
ea25e01
Merge branch 'main' into chatai
worksofliam Oct 9, 2024
201702d
Fix the build
worksofliam Oct 9, 2024
f71a829
Fix broken words
worksofliam Oct 9, 2024
31f3428
Working history
worksofliam Oct 10, 2024
ace6371
fix bug with ref formatting
ajshedivy Oct 10, 2024
3ed6969
Merge pull request #281 from codefori/chatai
ajshedivy Oct 10, 2024
267b8e8
Merge branch 'main' into dev
worksofliam Oct 10, 2024
51db0a2
Copilot no longer a hard dependency
worksofliam Oct 10, 2024
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
4 changes: 3 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"type": "npm",
"script": "webpack-dev",
"problemMatcher": "$ts-webpack-watch",
"isBackground": false,

"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
"isDefault": true,
}
}
]
Expand Down
1,151 changes: 300 additions & 851 deletions package-lock.json

Large diffs are not rendered by default.

139 changes: 108 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Db2 for IBM i tools in VS Code",
"version": "1.5.2",
"engines": {
"vscode": "^1.70.0"
"vscode": "^1.90.0"
},
"icon": "media/logo.png",
"keywords": [
Expand Down Expand Up @@ -37,39 +37,31 @@
"language:test": "vitest",
"dsc": "npx tsx src/dsc",
"package": "vsce package",
"vscode:prepublish": "rm -rf dist && npm run webpack && npm run dsc",
"webpack": "vscd --clean && webpack --mode development",
"webpack-dev": "vscd --clean && webpack --mode development",
"vscode:prepublish": "rm -rf dist && webpack --mode production && npm run dsc",
"webpack": "webpack --mode development",
"webpack-dev": "webpack --mode development",
"typings": "npx -p typescript tsc ./src/extension.ts --declaration --allowJs --emitDeclarationOnly --outDir types --esModuleInterop -t es2019 --moduleResolution node"
},
"devDependencies": {
"@halcyontech/vscode-ibmi-types": "^2.12.1",
"@types/glob": "^7.1.3",
"@types/node": "14.x",
"@types/vscode": "^1.70.0",
"esbuild-loader": "^3.0.1",
"eslint": "^7.32.0",
"glob": "^7.1.7",
"octokit": "^3.1.2",
"raw-loader": "^4.0.2",
"ts-loader": "^9.3.1",
"typescript": "^4.3.2",
"vitest": "^0.33.0",
"vscd": "^1.0.0",
"vscode-test": "^1.5.2",
"webpack": "^5.91.0",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"@ibm/mapepire-js": "^0.3.0",
"chart.js": "^4.4.2",
"csv": "^6.1.3",
"json-to-markdown-table": "^1.0.0",
"node-fetch": "^3.3.1",
"showdown": "^2.1.0",
"sql-formatter": "^14.0.0"
},
"contributes": {
"chatParticipants": [
{
"id": "vscode-db2i.chat",
"name": "db2i",
"fullName": "Db2 for i",
"description": "Chat with the Db2 for i AI assistant",
"isSticky": true,
"commands": [
{
"name": "build",
"description": "Build an SQL statement"
},
{
"name": "activity",
"description": "Summarize the activity on the system"
}
]
}
],
"configuration": [
{
"id": "vscode-db2i",
Expand Down Expand Up @@ -128,6 +120,33 @@
}
}
},
{
"id": "vscode-db2i.ai",
"title": "Db2 for IBM i with AI",
"properties": {
"vscode-db2i.ai.provider": {
"order": 0,
"type": "string",
"description": "Model Provider",
"default": "none",
"enum": [
"none",
"Ollama",
"GitHub Copilot"
],
"enumDescriptions": [
"Ollama instance, with specific model",
"GitHub Copilot. Requires the GitHub Copilot extension to be installed"
]
},
"vscode-db2i.ai.model": {
"order": 1,
"type": "string",
"description": "Model to use with the provider",
"default": "ibm-granite"
}
}
},
{
"id": "vscode-db2i.resultsets",
"title": "Viewing Data",
Expand Down Expand Up @@ -306,6 +325,24 @@
]
},
"commands": [
{
"command": "vscode-db2i.ai.changeModel",
"title": "Change AI Model",
"category": "Db2 for i"
},
{
"command": "vscode-db2i.notebook.open",
"title": "New Notebook",
"category": "IBM i Notebooks",
"enablement": "code-for-ibmi:connected == true",
"icon": "$(notebook)"
},
{
"command": "vscode-db2i.notebook.fromSqlUri",
"title": "Open as Notebook",
"category": "IBM i Notebooks",
"icon": "$(notebook)"
},
{
"command": "vscode-db2i.json.pasteGenerator",
"title": "Paste JSON as SQL",
Expand Down Expand Up @@ -1225,6 +1262,18 @@
}
],
"snippets": [
{
"language": "sql",
"path": "snippets/scalars.code-snippets"
},
{
"language": "sql",
"path": "snippets/variables.code-snippets"
},
{
"language": "sql",
"path": "snippets/aggregates.code-snippets"
},
{
"language": "sql",
"path": "snippets/http.code-snippets"
Expand All @@ -1246,5 +1295,33 @@
"path": "snippets/aggregates.code-snippets"
}
]
},
"devDependencies": {
"@halcyontech/vscode-ibmi-types": "^2.0.0",
"@types/glob": "^7.1.3",
"@types/node": "14.x",
"@types/vscode": "^1.90.0",
"esbuild-loader": "^3.0.1",
"eslint": "^7.32.0",
"glob": "^7.1.7",
"octokit": "^3.1.2",
"raw-loader": "^4.0.2",
"ts-loader": "^9.3.1",
"typescript": "^4.3.2",
"vitest": "^0.33.0",
"vscode-test": "^1.5.2",
"webpack": "^5.91.0",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"@ibm/mapepire-js": "^0.3.0",
"chart.js": "^4.4.2",
"csv": "^6.1.3",
"json-to-markdown-table": "^1.0.0",
"lru-cache": "^6.0.0",
"node-fetch": "^3.3.1",
"ollama": "^0.5.2",
"showdown": "^2.1.0",
"sql-formatter": "^14.0.0"
}
}
25 changes: 25 additions & 0 deletions src/chat/aiConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Configuration from "../configuration";

/**
* Matches config vscode-db2i.ai.provider
*/
export type AiProvider = "none"|"Ollama"|"GitHub Copilot";

export class AiConfig {

static getProvider(): AiProvider {
return Configuration.get<AiProvider>(`ai.provider`);
}

static getModel(): string {
return Configuration.get<string>("ai.model");
}

static setProvider(provider: AiProvider) {
return Configuration.set(`ai.provider`, provider);
}

static setModel(model: string) {
return Configuration.set(`ai.model`, model);
}
}
Loading
Loading