mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
(improvement)(Headless) Initialize meta vectors after initializing the model but before querying. (#964)
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
package com.tencent.supersonic.headless.server.listener;
|
||||||
|
|
||||||
|
import com.tencent.supersonic.headless.core.chat.parser.JavaLLMProxy;
|
||||||
|
import com.tencent.supersonic.headless.core.utils.ComponentFactory;
|
||||||
|
import com.tencent.supersonic.headless.server.schedule.EmbeddingTask;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@Order(2)
|
||||||
|
public class FullMetaEmbeddingListener implements CommandLineRunner {
|
||||||
|
@Autowired
|
||||||
|
private EmbeddingTask embeddingTask;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) {
|
||||||
|
initMetaEmbedding();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initMetaEmbedding() {
|
||||||
|
try {
|
||||||
|
if (ComponentFactory.getLLMProxy() instanceof JavaLLMProxy) {
|
||||||
|
embeddingTask.reloadMetaEmbedding();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("initMetaEmbedding error", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,12 +10,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@Order(0)
|
@Order(0)
|
||||||
public class EmbeddingInitListener implements CommandLineRunner {
|
public class SqlEmbeddingListener implements CommandLineRunner {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SqlExamplarLoader sqlExamplarLoader;
|
private SqlExamplarLoader sqlExamplarLoader;
|
||||||
Reference in New Issue
Block a user