diff --git a/liteflow-ai/liteflow-ai-core/src/main/java/com/yomahub/liteflow/ai/parse/prompt/resource/impl/TextPromptResource.java b/liteflow-ai/liteflow-ai-core/src/main/java/com/yomahub/liteflow/ai/parse/prompt/resource/impl/TextPromptResource.java index 0e49d7b77..dea4d241c 100644 --- a/liteflow-ai/liteflow-ai-core/src/main/java/com/yomahub/liteflow/ai/parse/prompt/resource/impl/TextPromptResource.java +++ b/liteflow-ai/liteflow-ai-core/src/main/java/com/yomahub/liteflow/ai/parse/prompt/resource/impl/TextPromptResource.java @@ -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); } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/java/com/yomahub/liteflow/test/cmp/AICmp.java b/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/java/com/yomahub/liteflow/test/cmp/AICmp.java index d40fc7274..396074ad3 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/java/com/yomahub/liteflow/test/cmp/AICmp.java +++ b/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/java/com/yomahub/liteflow/test/cmp/AICmp.java @@ -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 { } diff --git a/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/resources/system_prompt.txt b/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/resources/system_prompt.txt new file mode 100644 index 000000000..0f21b0356 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-ai/src/test/resources/system_prompt.txt @@ -0,0 +1 @@ +You are a chatbot that helps users with their questions about the LiteFlow framework. \ No newline at end of file