AI rule node: add file name to Vertex AI provider config; change service account key to be string
This commit is contained in:
parent
8d87031b9a
commit
944d80df9d
@ -29,7 +29,6 @@ import dev.langchain4j.model.chat.ChatModel;
|
||||
import dev.langchain4j.model.chat.request.ChatRequestParameters;
|
||||
import dev.langchain4j.model.vertexai.gemini.VertexAiGeminiChatModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.common.util.JacksonUtil;
|
||||
import org.thingsboard.server.common.data.ai.model.chat.AmazonBedrockChatModel;
|
||||
import org.thingsboard.server.common.data.ai.model.chat.AnthropicChatModel;
|
||||
import org.thingsboard.server.common.data.ai.model.chat.AzureOpenAiChatModel;
|
||||
@ -113,9 +112,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
// construct service account credentials using service account key JSON
|
||||
ServiceAccountCredentials serviceAccountCredentials;
|
||||
try {
|
||||
serviceAccountCredentials = ServiceAccountCredentials.fromStream(
|
||||
new ByteArrayInputStream(JacksonUtil.writeValueAsBytes(providerConfig.serviceAccountKey()))
|
||||
);
|
||||
serviceAccountCredentials = ServiceAccountCredentials.fromStream(new ByteArrayInputStream(providerConfig.serviceAccountKey().getBytes()));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to parse service account key JSON", e);
|
||||
}
|
||||
|
||||
@ -15,12 +15,11 @@
|
||||
*/
|
||||
package org.thingsboard.server.common.data.ai.provider;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public record GoogleVertexAiGeminiProviderConfig(
|
||||
String fileName, // not used on BE, but needed for UI
|
||||
String projectId,
|
||||
String location,
|
||||
ObjectNode serviceAccountKey
|
||||
String serviceAccountKey
|
||||
) implements AiProviderConfig {
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user