Skip to content

Commit 6171a02

Browse files
committed
refactor: address code review feedback
- Remove console.log/error from Extension.vue for production readiness - Add comments to encodeAIGenerateParams explaining field filtering logic Resolves review feedback from yuluo-yx and LinuxSuRen
1 parent 95a5496 commit 6171a02

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

console/atest-ui/src/views/Extension.vue

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,20 @@ const loadPlugin = async (): Promise<void> => {
2727
const checkPluginLoad = (retries = 0, maxRetries = 10) => {
2828
const plugin = (window as any).ATestPlugin;
2929
30-
console.log(`Plugin load attempt ${retries + 1}/${maxRetries + 1}`);
31-
3230
if (plugin && plugin.mount) {
33-
console.log('extension load success');
3431
const container = document.getElementById("plugin-container");
3532
if (container) {
3633
container.innerHTML = ''; // Clear previous content
3734
plugin.mount(container);
3835
loading.value = false;
3936
} else {
40-
console.error('Plugin container not found');
4137
loading.value = false;
4238
}
4339
} else if (retries < maxRetries) {
4440
// Incremental retry mechanism: 50ms, 100ms, 150ms...
4541
const delay = 50 + retries * 50;
46-
console.log(`ATestPlugin not ready, retrying in ${delay}ms (attempt ${retries + 1}/${maxRetries + 1})`);
4742
setTimeout(() => checkPluginLoad(retries + 1, maxRetries), delay);
4843
} else {
49-
console.error('ATestPlugin not found or missing mount method after max retries');
50-
console.error('Window.ATestPlugin value:', (window as any).ATestPlugin);
5144
loading.value = false;
5245
}
5346
};
@@ -56,14 +49,13 @@ const loadPlugin = async (): Promise<void> => {
5649
checkPluginLoad();
5750
});
5851
} catch (error) {
59-
console.log(`extension load error: ${(error as Error).message}`);
6052
loading.value = false; // Set loading to false on error
6153
}
6254
};
6355
try {
6456
loadPlugin();
6557
} catch (error) {
66-
console.error('extension load error:', error);
58+
// Handle error silently, loading state will indicate failure
6759
}
6860
</script>
6961

pkg/testing/remote/grpc_store.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,12 @@ func (g *gRPCLoader) handleAIQuery(query map[string]string) (testing.DataResult,
485485
return g.convertAIResponse(dataResult), nil
486486
}
487487

488-
// encodeAIGenerateParams encodes AI generation parameters into SQL field
488+
// encodeAIGenerateParams filters and encodes AI generation parameters into JSON string.
489+
// This function intentionally creates a new map to exclude the "method" field from the query,
490+
// as "method" is used for routing decisions and should not be forwarded to AI plugins.
491+
// Only the actual AI parameters (model, prompt, config) are encoded and sent via the SQL field.
489492
func (g *gRPCLoader) encodeAIGenerateParams(query map[string]string) string {
493+
// Extract only AI-specific parameters, excluding the routing field "method"
490494
params := map[string]string{
491495
"model": query["model"],
492496
"prompt": query["prompt"],

0 commit comments

Comments
 (0)