flowquery 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -38
- package/dist/flowquery.min.js +1 -1
- package/dist/parsing/functions/aggregate_function.d.ts +1 -1
- package/dist/parsing/functions/aggregate_function.d.ts.map +1 -1
- package/dist/parsing/functions/aggregate_function.js.map +1 -1
- package/dist/parsing/functions/async_function.d.ts +4 -15
- package/dist/parsing/functions/async_function.d.ts.map +1 -1
- package/dist/parsing/functions/async_function.js +6 -59
- package/dist/parsing/functions/async_function.js.map +1 -1
- package/dist/parsing/functions/function.d.ts +1 -1
- package/dist/parsing/functions/function.d.ts.map +1 -1
- package/dist/parsing/functions/function.js +1 -1
- package/dist/parsing/functions/function.js.map +1 -1
- package/dist/parsing/functions/function_factory.d.ts +2 -0
- package/dist/parsing/functions/function_factory.d.ts.map +1 -1
- package/dist/parsing/functions/function_factory.js +12 -11
- package/dist/parsing/functions/function_factory.js.map +1 -1
- package/dist/parsing/functions/function_metadata.d.ts +53 -24
- package/dist/parsing/functions/function_metadata.d.ts.map +1 -1
- package/dist/parsing/functions/function_metadata.js +57 -53
- package/dist/parsing/functions/function_metadata.js.map +1 -1
- package/dist/parsing/functions/predicate_function.d.ts +1 -1
- package/dist/parsing/functions/predicate_function.d.ts.map +1 -1
- package/dist/parsing/functions/predicate_function.js +1 -1
- package/dist/parsing/functions/predicate_function.js.map +1 -1
- package/dist/parsing/operations/load.js +1 -1
- package/dist/parsing/operations/load.js.map +1 -1
- package/dist/parsing/parser.d.ts.map +1 -1
- package/dist/parsing/parser.js +1 -2
- package/dist/parsing/parser.js.map +1 -1
- package/docs/flowquery.min.js +1 -1
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/misc/apps/RAG/README.md +0 -12
- package/misc/apps/RAG/package.json +1 -2
- package/misc/apps/RAG/src/components/ChatContainer.tsx +33 -6
- package/misc/apps/RAG/src/components/ChatMessage.css +24 -0
- package/misc/apps/RAG/src/components/ChatMessage.tsx +51 -2
- package/misc/apps/RAG/src/components/FlowQueryAgent.ts +566 -286
- package/misc/apps/RAG/src/plugins/index.ts +3 -1
- package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +6 -5
- package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +3 -3
- package/misc/apps/RAG/src/plugins/loaders/Form.ts +5 -5
- package/misc/apps/RAG/src/plugins/loaders/Llm.ts +14 -14
- package/misc/apps/RAG/src/plugins/loaders/MockData.ts +5 -5
- package/misc/apps/RAG/src/plugins/loaders/Table.ts +4 -4
- package/misc/apps/RAG/src/plugins/loaders/Weather.ts +126 -0
- package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +4 -0
- package/package.json +1 -1
- package/src/parsing/functions/aggregate_function.ts +1 -1
- package/src/parsing/functions/async_function.ts +5 -50
- package/src/parsing/functions/function.ts +2 -2
- package/src/parsing/functions/function_factory.ts +18 -9
- package/src/parsing/functions/function_metadata.ts +57 -56
- package/src/parsing/functions/predicate_function.ts +2 -2
- package/src/parsing/operations/load.ts +1 -1
- package/src/parsing/parser.ts +2 -1
- package/tests/extensibility.test.ts +50 -12
- package/tests/parsing/parser.test.ts +2 -2
- package/misc/apps/RAG/.env.example +0 -14
|
@@ -56,6 +56,30 @@
|
|
|
56
56
|
color: #666;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
.flowquery-toggle-link {
|
|
60
|
+
font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
color: #666;
|
|
64
|
+
background: none;
|
|
65
|
+
border: none;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
padding: 2px 6px;
|
|
68
|
+
border-radius: 4px;
|
|
69
|
+
transition: background-color 0.15s ease, color 0.15s ease;
|
|
70
|
+
margin-left: 4px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.flowquery-toggle-link:hover {
|
|
74
|
+
background-color: rgba(0, 120, 212, 0.1);
|
|
75
|
+
color: #0078d4;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.flowquery-toggle-link.active {
|
|
79
|
+
color: #0078d4;
|
|
80
|
+
background-color: rgba(0, 120, 212, 0.1);
|
|
81
|
+
}
|
|
82
|
+
|
|
59
83
|
.chat-message-text {
|
|
60
84
|
white-space: pre-wrap;
|
|
61
85
|
word-break: break-word;
|
|
@@ -67,6 +67,7 @@ interface MessageContentProps {
|
|
|
67
67
|
content: string;
|
|
68
68
|
isStreaming?: boolean;
|
|
69
69
|
adaptiveCard?: Record<string, unknown>;
|
|
70
|
+
showFlowQuery?: boolean;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
interface MessageContentState {
|
|
@@ -107,7 +108,7 @@ class MessageContent extends Component<MessageContentProps, MessageContentState>
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
render() {
|
|
110
|
-
const { content, isStreaming } = this.props;
|
|
111
|
+
const { content, isStreaming, showFlowQuery } = this.props;
|
|
111
112
|
const { runnerQuery } = this.state;
|
|
112
113
|
|
|
113
114
|
const flowQueryBlocks = this.getFlowQueryBlocks();
|
|
@@ -126,6 +127,21 @@ class MessageContent extends Component<MessageContentProps, MessageContentState>
|
|
|
126
127
|
);
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
// If FlowQuery blocks are hidden, render content without code blocks
|
|
131
|
+
if (!showFlowQuery) {
|
|
132
|
+
// Remove FlowQuery code blocks from content for display
|
|
133
|
+
const contentWithoutFlowQuery = content.replace(/```flowquery\n[\s\S]*?```/gi, '').trim();
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
{contentWithoutFlowQuery}
|
|
137
|
+
{allAdaptiveCards.map((card, index) => (
|
|
138
|
+
<AdaptiveCardRenderer key={`card-${index}`} card={card} />
|
|
139
|
+
))}
|
|
140
|
+
{isStreaming && <Spinner size="tiny" className="streaming-indicator" />}
|
|
141
|
+
</>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
129
145
|
// Split content by FlowQuery code blocks and render with buttons
|
|
130
146
|
const parts: React.ReactNode[] = [];
|
|
131
147
|
let lastIndex = 0;
|
|
@@ -204,10 +220,31 @@ class MessageContent extends Component<MessageContentProps, MessageContentState>
|
|
|
204
220
|
}
|
|
205
221
|
}
|
|
206
222
|
|
|
207
|
-
|
|
223
|
+
interface ChatMessageState {
|
|
224
|
+
showFlowQuery: boolean;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export class ChatMessage extends Component<ChatMessageProps, ChatMessageState> {
|
|
228
|
+
constructor(props: ChatMessageProps) {
|
|
229
|
+
super(props);
|
|
230
|
+
this.state = {
|
|
231
|
+
showFlowQuery: false
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private hasFlowQueryBlocks(): boolean {
|
|
236
|
+
return /```flowquery\n[\s\S]*?```/gi.test(this.props.message.content);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private toggleFlowQuery = (): void => {
|
|
240
|
+
this.setState(prev => ({ showFlowQuery: !prev.showFlowQuery }));
|
|
241
|
+
};
|
|
242
|
+
|
|
208
243
|
render() {
|
|
209
244
|
const { message } = this.props;
|
|
245
|
+
const { showFlowQuery } = this.state;
|
|
210
246
|
const isUser = message.role === 'user';
|
|
247
|
+
const hasFlowQuery = !isUser && this.hasFlowQueryBlocks();
|
|
211
248
|
|
|
212
249
|
return (
|
|
213
250
|
<div className={`chat-message ${isUser ? 'chat-message-user' : 'chat-message-assistant'}`}>
|
|
@@ -222,12 +259,24 @@ export class ChatMessage extends Component<ChatMessageProps> {
|
|
|
222
259
|
<span className="chat-message-time">
|
|
223
260
|
{message.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
|
|
224
261
|
</span>
|
|
262
|
+
{hasFlowQuery && (
|
|
263
|
+
<Tooltip content={showFlowQuery ? 'Hide FlowQuery' : 'Show FlowQuery'} relationship="label">
|
|
264
|
+
<button
|
|
265
|
+
className={`flowquery-toggle-link ${showFlowQuery ? 'active' : ''}`}
|
|
266
|
+
onClick={this.toggleFlowQuery}
|
|
267
|
+
aria-label={showFlowQuery ? 'Hide FlowQuery code' : 'Show FlowQuery code'}
|
|
268
|
+
>
|
|
269
|
+
</>
|
|
270
|
+
</button>
|
|
271
|
+
</Tooltip>
|
|
272
|
+
)}
|
|
225
273
|
</div>
|
|
226
274
|
<div className="chat-message-text">
|
|
227
275
|
<MessageContent
|
|
228
276
|
content={message.content}
|
|
229
277
|
isStreaming={message.isStreaming}
|
|
230
278
|
adaptiveCard={message.adaptiveCard}
|
|
279
|
+
showFlowQuery={showFlowQuery}
|
|
231
280
|
/>
|
|
232
281
|
</div>
|
|
233
282
|
</div>
|