tablestore-java-mcp-server-rag/tablestore-mcp-server/src/main/java/com/alicloud/openservices/tablestore/sample/service/TablestoreService.java [383:416]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();

    private static float[] parseEmbeddingString(String embeddingString) {
        return JSON_MAPPER.convertValue(embeddingString, float[].class);
    }

    private static String embeddingToString(float[] embedding) {
        try {
            return JSON_MAPPER.writeValueAsString(embedding);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(String.format("failed to write embedding to string, embedding:%s", Arrays.toString(embedding)), e);
        }
    }

    private static String maxLogOrNull(String str) {
        if (str == null) {
            return null;
        }
        int max = 200;
        if (str.length() <= max) {
            return str;
        }
        return str.substring(0, max) + "......";
    }

    @Override
    @PreDestroy
    public void close() throws IOException {
        log.info("closing tablestore client");
        if (client != null) {
            try {
                client.shutdown();
            } catch (Exception e) {
                log.error("failed to shutdown tablestore client", e);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



tablestore-java-mcp-server/src/main/java/com/alicloud/openservices/tablestore/sample/service/TablestoreService.java [297:330]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();

    private static float[] parseEmbeddingString(String embeddingString) {
        return JSON_MAPPER.convertValue(embeddingString, float[].class);
    }

    private static String embeddingToString(float[] embedding) {
        try {
            return JSON_MAPPER.writeValueAsString(embedding);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(String.format("failed to write embedding to string, embedding:%s", Arrays.toString(embedding)), e);
        }
    }

    private static String maxLogOrNull(String str) {
        if (str == null) {
            return null;
        }
        int max = 200;
        if (str.length() <= max) {
            return str;
        }
        return str.substring(0, max) + "......";
    }

    @Override
    @PreDestroy
    public void close() throws IOException {
        log.info("closing tablestore client");
        if (client != null) {
            try {
                client.shutdown();
            } catch (Exception e) {
                log.error("failed to shutdown tablestore client", e);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



