-
Notifications
You must be signed in to change notification settings - Fork 62
feat(ai-plugin): implement AI model auto-detection and enhance plugin loading reliability #837
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
base: master
Are you sure you want to change the base?
Conversation
I am thinking about whether model-detectors should be incorporated into the ai plugin... |
if (container) { | ||
container.innerHTML = ''; // Clear previous content | ||
plugin.mount(container); | ||
// Implement retry mechanism with exponential backoff |
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.
This is good. But I don't know when it will fail. I never meet the failure.
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.
In some cases this may happen:
- The JavaScript file has been loaded but the global object window.ATestPlugin has not been initialized
- The resources that the plugin depends on are still being loaded asynchronously
- It takes time for the browser to execute scripts, especially large plugins.
|
||
<span v-for="menu in extensionMenus" :key="menu.index" :index="menu.index"> | ||
<Extension v-if="panelName === menu.index" :name="menu.name" /> | ||
<Extension v-if="panelName === menu.index" :name="menu.index" /> |
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.
Why not name?
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.
The index is more stable as a unique identifier, while the name may change due to internationalization or user customization. I have encountered this problem many times in plugin development. Do you mean that this change cannot be made here?
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.
i'm sorry... i'm now trying to find a better way to solve this
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.
yes, you're right.
Adds support for AI-powered features via a new extension mechanism. This includes dynamically loading the AI extension's CSS and JS, and retrying the plugin mounting process with exponential backoff to ensure proper initialization. Also, provides a basic GRPC querying functionality which could call AI methods, and converts the AI response to standard data format. The AI plugin can be built from source or downloaded from a binary URL.
Restore two essential bug fixes that were incorrectly removed: 1. vite.config.ts fixes: - Fix test-id removal logic: only remove in production, preserve for E2E tests - Improve build performance: replace single chunk with optimized chunk splitting - Separate vue, element-plus, and vendor chunks for better caching 2. App.vue fix: - Fix Extension component prop: use menu.index instead of menu.name - Ensures AI plugin can be correctly identified and loaded These fixes are critical for AI plugin functionality and should not be reverted.
Consolidates the vite build configuration to output a single chunk, simplifying the config and potentially improving build times in some scenarios. The previous manual chunk configuration is removed.
Updates the AI model name description to indicate that the model is automatically detected from available models. Sets the default value for the model to an empty string, reflecting the auto-detection behavior.
…AI parameters. Adjust the stores.yaml file structure and add more configuration parameters such as provider and endpoint for AI plug-ins.
The AI plugin build process is removed from the makefile. The AI plugin is assumed to be pre-built or handled by a separate process, simplifying the build and execution flow.
|
const checkPluginLoad = (retries = 0, maxRetries = 10) => { | ||
const plugin = (window as any).ATestPlugin; | ||
console.log(`Plugin load attempt ${retries + 1}/${maxRetries + 1}`); |
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.
We should try to avoid console log output in production-ready code. It is only used during the development or debugging phases.
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.
+1 from me
params := map[string]string{ | ||
"model": query["model"], | ||
"prompt": query["prompt"], | ||
"config": query["config"], | ||
} |
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.
Do you think it's necessary? It looks like you just convert the map data into a JSON string.
What type of PR is this?
implement AI model auto-detection and enhance plugin loading reliability
What this PR does / why we need it:
This PR introduces comprehensive AI plugin integration capabilities with intelligent model detection and robust plugin loading mechanisms. The changes address critical reliability issues in plugin initialization and provide a foundation for dynamic AI model management.
Key Features:
AI Model Auto-Detection System (
pkg/testing/model_detector.go
)Enhanced Plugin Loading Reliability (
console/atest-ui/src/views/Extension.vue
)AI Plugin Communication Infrastructure (
pkg/testing/remote/grpc_store.go
)ai.generate
,ai.capabilities
)Configuration Optimization (
cmd/testdata/stores.yaml
)unix:///tmp/atest-ext-ai.sock
)Development Environment Improvements
Why we need it:
Testing:
This PR transforms the AI plugin system from a basic proof-of-concept into a production-ready, intelligent, and reliable integration platform.