AI History Dialogue
Functional Description
AI History Dialogue
implements user identity recognition based on request headers and automatically caches the historical dialogues of corresponding users, which are then automatically filled into the context in subsequent dialogues. It also supports users to actively query historical dialogues.
Note
When the path suffix matches
ai-history/query
, it will return the historical dialogues.
Runtime Properties
Plugin Execution Phase: Default Phase
Plugin Execution Priority: 650
Configuration Fields
Name | Data Type | Required | Default Value | Description |
---|---|---|---|---|
identityHeader | string | optional | ”Authorization” | The request header for identity resolution, can be Authorization, X-Mse-Consumer, etc. |
fillHistoryCnt | integer | optional | 3 | Default number of historical dialogues to be filled. |
cacheKeyPrefix | string | optional | ”higress-ai-history:“ | Prefix for Redis cache key. |
cacheTTL | integer | optional | 0 | Cache expiration time in seconds, default value is 0, meaning it never expires. |
redis.serviceName | string | required | - | Redis service name, full FQDN name with service type, e.g., my-redis.dns, redis.my-ns.svc.cluster.local |
redis.servicePort | integer | optional | 6379 | Redis service port. |
redis.timeout | integer | optional | 1000 | Timeout for requests to Redis, in milliseconds. |
redis.username | string | optional | - | Username for logging into Redis. |
redis.password | string | optional | - | Password for logging into Redis. |
Usage Example
Configuration Information
Request Example
Auto-fill Request Example:
First Round Request:
After Request Fill:
First round request, no fill. Consistent with the original request.
First Round Response:
Second Round Request:
After Request Fill:
Second round request, automatically filled with the historical dialogue from the previous round.
Each round of requests only needs to include the current question and the number of historical dialogues to fill in, enabling automatic filling of historical dialogues.
Example of Retrieving Historical Data:
Response Example:
Returns three historical dialogues. If the cnt
parameter is not provided, it will default to returning all cached historical dialogues.