mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 12:07:26 +08:00
[ai-cache] Implement a WASM plugin for LLM result retrieval based on vector similarity (#1290)
This commit is contained in:
2
plugins/wasm-go/extensions/request-block/Dockerfile
Normal file
2
plugins/wasm-go/extensions/request-block/Dockerfile
Normal file
@@ -0,0 +1,2 @@
|
||||
FROM scratch
|
||||
COPY main.wasm plugin.wasm
|
||||
4
plugins/wasm-go/extensions/request-block/Makefile
Normal file
4
plugins/wasm-go/extensions/request-block/Makefile
Normal file
@@ -0,0 +1,4 @@
|
||||
.DEFAULT:
|
||||
build:
|
||||
tinygo build -o main.wasm -scheduler=none -target=wasi -gc=custom -tags='custommalloc nottinygc_finalizer' ./main.go
|
||||
mv main.wasm ../../../../docker-compose-test/
|
||||
@@ -177,7 +177,9 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config RequestBlockConfig, lo
|
||||
}
|
||||
|
||||
func onHttpRequestBody(ctx wrapper.HttpContext, config RequestBlockConfig, body []byte, log wrapper.Log) types.Action {
|
||||
log.Infof("My request-block body: %s\n", string(body))
|
||||
bodyStr := string(body)
|
||||
|
||||
if !config.caseSensitive {
|
||||
bodyStr = strings.ToLower(bodyStr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user