RED-9352: Fixed security config
This commit is contained in:
parent
da3cd318a3
commit
a9173f6988
@ -1,12 +1,8 @@
|
||||
package com.knecon.fforesight.llm.service.queue;
|
||||
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ -14,14 +10,12 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@RequiredArgsConstructor
|
||||
public class MessageHandler {
|
||||
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@RabbitHandler
|
||||
@RabbitListener(queues = "#{llmServiceSettings.getRequestQueueName()}")
|
||||
public void receiveIndexingRequest(Message message) {
|
||||
|
||||
// TODO: Do something.
|
||||
}
|
||||
// @SneakyThrows
|
||||
// @RabbitHandler
|
||||
// @RabbitListener(queues = "#{llmServiceSettings.getRequestQueueName()}")
|
||||
// public void receiveIndexingRequest(Message message) {
|
||||
//
|
||||
// // TODO: Do something.
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -53,18 +53,18 @@ public class LlmService {
|
||||
ChatCompletionsOptions options = new ChatCompletionsOptions(chatMessages);
|
||||
options.setStream(true);
|
||||
Flux<ChatCompletions> chatCompletions = client.getChatCompletionsStream(settings.getModel(), options);
|
||||
String userId = KeycloakSecurity.getUserId();
|
||||
chatCompletions.subscribe(chatCompletion -> {
|
||||
sendWebsocketEvent(chatCompletion.getChoices()
|
||||
sendWebsocketEvent(userId, chatCompletion.getChoices()
|
||||
.get(0).getDelta().getContent());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void sendWebsocketEvent(String token) {
|
||||
private void sendWebsocketEvent(String userId, String token) {
|
||||
|
||||
System.out.println("/topic/" + TenantContext.getTenantId() + "/chat-events/" + KeycloakSecurity.getUserId());
|
||||
websocketTemplate.convertAndSend("/topic/" + TenantContext.getTenantId() + "/chat-events/" + KeycloakSecurity.getUserId(), new ChatEvent(token));
|
||||
websocketTemplate.convertAndSend("/topic/" + TenantContext.getTenantId() + "/chat-events/" + userId, new ChatEvent(token));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ fforesight:
|
||||
llm-service:
|
||||
base-path: '/api/llm'
|
||||
keycloak:
|
||||
ignored-endpoints: [ '/actuator/health', '/actuator/health/**', '/api/llm', '/api/llm/', '/internal/**', '/api/llm/docs/**', '/api/llm/docs', '/api/llm/chat-async', '/api/llm/llm-websocket' ]
|
||||
ignored-endpoints: [ '/actuator/health', '/actuator/health/**', '/api/llm', '/api/llm/', '/internal/**', '/api/llm/docs/**', '/api/llm/docs', '/api/llm/llm-websocket' ]
|
||||
enabled: true
|
||||
springdoc:
|
||||
base-path: '/api/llm'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user