Dhairya-007 opened a new pull request, #30049:
URL: https://github.com/apache/camel/pull/30049
## Problem
`ChatPredictor` clears a conversation on request:
```java
// Clear if requested
Boolean clear = exchange.getIn().getHeader("CamelChatClearHistory",
Boolean.class);
if (Boolean.TRUE.equals(clear)) {
chatHistories.remove(memoryId);
LOG.debug("Cleared chat history for ID: {}", memoryId);
}
```
Its class Javadoc lists the header under *Camel Headers Used*, so it is
clearly meant to be part of the component's contract:
```
* <li>{@code CamelChatClearHistory} (optional): Boolean to clear the
history for the current memory ID.</li>
```
But `HuggingFaceConstants` - which `HuggingFaceEndpoint` names as its
`headersClass` - declares one constant:
```java
public interface HuggingFaceConstants {
@Metadata(description = "The output from the model", javaType = "String")
String OUTPUT = "CamelHuggingFaceOutput";
}
```
So `CamelChatClearHistory` is the only header in the component read from a
bare literal, and the only way a user learns the name is by reading
`ChatPredictor`'s source: it is absent from `huggingface.json`, from the
catalog and from the generated header table. It is also the component's only
*input* header, which makes it the one a route actually has to set.
The sibling header in the same Javadoc, `CamelChatMemoryId`, does not have
this problem: its name comes from the `memoryIdHeader` option, which is
documented as an option.
## Fix
Add `CLEAR_HISTORY` to `HuggingFaceConstants` with `@Metadata`, read the
header through it, and point the Javadoc at the constant the way the same list
already does for `HuggingFaceConstants.OUTPUT`. The header name is unchanged.
The regenerated `huggingface.json` files are included.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]