Fix: 修复文本资源解析为空

This commit is contained in:
LuanY77
2025-07-29 22:44:49 +08:00
parent b2e5156c66
commit b50047a052
3 changed files with 13 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ public class TextPromptResource extends AbstractPromptResource {
return Optional
.ofNullable(location)
.filter(s -> s.startsWith(prefix))
.map(s -> s.startsWith(prefix) ? s.substring(prefix.length()) : s)
.orElse("");
.map(s -> s.substring(prefix.length()))
.orElse(location);
}
}

View File

@@ -2,6 +2,8 @@ package com.yomahub.liteflow.test.cmp;
import com.yomahub.liteflow.ai.annotation.AIChat;
import com.yomahub.liteflow.ai.annotation.AIComponent;
import com.yomahub.liteflow.ai.annotation.AIInput;
import com.yomahub.liteflow.ai.annotation.InputField;
/**
* TODO
@@ -18,7 +20,14 @@ import com.yomahub.liteflow.ai.annotation.AIComponent;
model = "qwen3:32b"
)
@AIChat(
userPrompt = "Why sky is blue?"
systemPrompt = "classpath:system_prompt.txt",
userPrompt = "{{question}}, {{answer}}"
)
@AIInput(
mapping = {
@InputField(name = "question", expression = "test", defaultValue = "Why sky is blue?"),
@InputField(name = "answer", expression = "test", defaultValue = "The sky appears blue due to the scattering of sunlight by the atmosphere.")
}
)
public interface AICmp {
}

View File

@@ -0,0 +1 @@
You are a chatbot that helps users with their questions about the LiteFlow framework.