-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plumb streaming variant for chat requests (#21)
* Streaming support for chat interface * Refine all views and layout * Accordion in navbar removed. Logo moved to navbar. Content pane left justified. * Intro Inquiry and MetadataFilter model objects. Such requests are now POST requests. Use Playtika's ReactiveFeign client. * Fix CI and Release Github Actions. Fix serialization of metadata filter in streaming client.
- Loading branch information
Showing
26 changed files
with
299 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React, {useEffect, useState} from 'react'; | ||
import {ReactAdapterElement} from 'Frontend/generated/flow/ReactAdapter'; | ||
import {effect, signal} from "@vaadin/hilla-react-signals"; | ||
import Markdown from "react-markdown"; | ||
|
||
class MarkdownElement extends ReactAdapterElement { | ||
|
||
markdown = signal(''); | ||
|
||
protected override render() { | ||
// In a React component, we could use the signal value directly, | ||
// but it doesn't trigger an update in the ReactAdapterElement render method. | ||
// Instead, pass the signal value to useState for React. | ||
const [content, setContent] = useState(''); | ||
useEffect(() => effect(() => { | ||
setContent(this.markdown.value); | ||
}), []); | ||
return <Markdown>{content}</Markdown>; | ||
} | ||
} | ||
|
||
customElements.define('markdown-component', MarkdownElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/org/cftoolsuite/client/SanfordStreamingClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.cftoolsuite.client; | ||
|
||
import org.cftoolsuite.domain.chat.Inquiry; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import reactivefeign.spring.config.ReactiveFeignClient; | ||
import reactor.core.publisher.Flux; | ||
|
||
@ReactiveFeignClient(name="sanford-streaming-client", url="${document.service.url}") | ||
public interface SanfordStreamingClient { | ||
|
||
@PostMapping("/api/stream/chat") | ||
public Flux<String> streamResponseToQuestion(@RequestBody Inquiry inquiry); | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
src/main/java/org/cftoolsuite/domain/chat/FilterMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.cftoolsuite.domain.chat; | ||
|
||
public record FilterMetadata(String key, Object value) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.cftoolsuite.domain.chat; | ||
|
||
import java.util.List; | ||
|
||
public record Inquiry(String question, List<FilterMetadata> filter) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.