-
Notifications
You must be signed in to change notification settings - Fork 61
feat: Added AI extension support and SQL generation APIs #804
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
Closed
KariHall619
wants to merge
6
commits into
LinuxSuRen:master
from
KariHall619:feat-Added-AI-extension-APIs
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1f4d036
feat: Added AI extension support and SQL generation APIs
KariHall619 14edd88
你feat: implement unified AI extension service with gRPC interface
KariHall619 e955c68
feat: implement protobuf generation and fix Python gRPC imports
KariHall619 e0bdb76
Refactor: Removed legacy SQL generation APIs and unified with Generat…
KariHall619 4eddc7b
Resolve merge conflicts: integrate AI extension with database drivers
KariHall619 eff1d43
Fix TypeScript error in store.ts - replace find() with for loop for E…
KariHall619 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
| const ExtensionKindMongoDB = "atest-store-mongodb" | ||
| const ExtensionKindElasticsearch = "atest-store-elasticsearch" | ||
| const ExtensionKindOpengeMini = "atest-store-opengemini" | ||
| const ExtensionKindAI = "atest-ext-ai" | ||
|
|
||
| export const ExtensionKind = { | ||
| ExtensionKindGit, | ||
|
|
@@ -49,7 +50,8 @@ | |
| ExtensionKindRedis, | ||
| ExtensionKindMongoDB, | ||
| ExtensionKindElasticsearch, | ||
| ExtensionKindOpengeMini | ||
| ExtensionKindOpengeMini, | ||
| ExtensionKindAI | ||
| } | ||
|
|
||
| const MySQL = "mysql"; | ||
|
|
@@ -61,13 +63,151 @@ | |
| export const GetDriverName = (store: Store): string => { | ||
| switch (store.kind.name) { | ||
| case 'atest-store-orm': | ||
| return store.properties.find((p: Pair) => p.key === 'driver')?.value || MySQL; | ||
| const properties = store.properties as Pair[]; | ||
| for (let i = 0; i < properties.length; i++) { | ||
| if (properties[i].key === 'driver') { | ||
| return properties[i].value || MySQL; | ||
| } | ||
| } | ||
| return MySQL; | ||
| case 'atest-store-cassandra': | ||
| return Cassandra; | ||
| } | ||
| return "" | ||
| } | ||
|
|
||
| const storeExtensions = [ | ||
| { | ||
| name: ExtensionKindGit, | ||
| params: [{ | ||
| key: 'insecure' | ||
| }, { | ||
| key: 'timeout' | ||
| }, { | ||
| key: 'targetpath' | ||
| }, { | ||
| key: 'branch' | ||
| }, { | ||
| key: 'email', | ||
| description: 'See also: git config --local user.email [email protected]' | ||
| }, { | ||
| key: 'name', | ||
| description: 'See also: git config --local user.name xxx' | ||
| }], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-git' | ||
| }, | ||
| { | ||
| name: ExtensionKindS3, | ||
| params: [{ | ||
| key: 'accesskeyid' | ||
| }, { | ||
| key: 'secretaccesskey' | ||
| }, { | ||
| key: 'sessiontoken' | ||
| }, { | ||
| key: 'region' | ||
| }, { | ||
| key: 'disablessl' | ||
| }, { | ||
| key: 'forcepathstyle' | ||
| }, { | ||
| key: 'bucket' | ||
| }], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-s3' | ||
| }, | ||
| { | ||
| name: ExtensionKindORM, | ||
| params: [{ | ||
| key: 'driver', | ||
| defaultValue: 'mysql', | ||
| enum: [MySQL, Postgres, SQLite, TDengine], | ||
| description: 'Supported: mysql, postgres, sqlite, tdengine' | ||
| }, { | ||
| key: 'database', | ||
| defaultValue: 'atest' | ||
| }, { | ||
| key: 'historyLimit', | ||
| defaultValue: '', | ||
| // type: 'number', | ||
| description: 'Set the limit of the history record count' | ||
| }], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-orm' | ||
| }, | ||
| { | ||
| name: ExtensionKindIotDB, | ||
| params: [], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-iotdb' | ||
| }, | ||
| { | ||
| name: ExtensionKindCassandra, | ||
| params: [{ | ||
| key: 'keyspace', | ||
| defaultValue: '' | ||
| }], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-cassandra' | ||
| }, | ||
| { | ||
| name: ExtensionKindEtcd, | ||
| params: [], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-etcd' | ||
| }, | ||
| { | ||
| name: ExtensionKindRedis, | ||
| params: [], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-redis' | ||
| }, | ||
| { | ||
| name: ExtensionKindMongoDB, | ||
| params: [{ | ||
| key: 'collection' | ||
| }, { | ||
| key: 'database', | ||
| defaultValue: 'atest' | ||
| }], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-mongodb' | ||
| }, | ||
| { | ||
| name: ExtensionKindElasticsearch, | ||
| params: [], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-elasticsearch' | ||
| }, | ||
| { | ||
| name: ExtensionKindOpengeMini, | ||
| params: [], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-store-opengemini' | ||
| }, | ||
| { | ||
| name: ExtensionKindAI, | ||
| params: [{ | ||
| key: 'model_provider', | ||
| defaultValue: 'ollama', | ||
| enum: ['ollama', 'openai'], | ||
| description: 'AI model provider used in GenerateContentRequest.parameters for content generation' | ||
| }, { | ||
| key: 'model_name', | ||
| defaultValue: 'llama3.2', | ||
| description: 'AI model name passed to GenerateContentRequest.parameters["model_name"] for specific model selection' | ||
| }, { | ||
| key: 'api_key', | ||
| defaultValue: '', | ||
| description: 'API key for external providers, used in GenerateContentRequest.parameters["api_key"] for authentication' | ||
| }, { | ||
| key: 'base_url', | ||
| defaultValue: 'http://localhost:11434', | ||
| description: 'Base URL for AI service, used in GenerateContentRequest.parameters["base_url"] to specify service endpoint' | ||
| }, { | ||
| key: 'temperature', | ||
| defaultValue: '0.7', | ||
| description: 'Controls randomness in AI responses (0.0-1.0), passed via GenerateContentRequest.parameters["temperature"]' | ||
| }, { | ||
| key: 'max_tokens', | ||
| defaultValue: '2048', | ||
| description: 'Maximum tokens in AI response, used in GenerateContentRequest.parameters["max_tokens"] to limit output length' | ||
| }], | ||
| link: 'https://github.com/LinuxSuRen/atest-ext-ai' | ||
| } | ||
| ] | ||
|
|
||
| export const Driver = { | ||
| MySQL, Postgres, SQLite, TDengine, Cassandra | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个变量该怎么用呢?下面的接口里没有体现到。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,接口的定义后续会重构。大体的思路是:
LinuxSuRen/atest-ext-data-swagger#1
#803
重构完成后再调整即可。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExtensionKindAI 变量定义了AI扩展的配置参数:
这些参数通过 GenerateContentRequest.parameters 字段传递给AI服务,用于配置AI模型的行为。在接口中作为 parameters 映射传递给AI扩展服务。