Skip to content

Commit 4ef6dd7

Browse files
committed
Step 5 results -> Gemini
1 parent 9f5985a commit 4ef6dd7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

colorist/step_05/lib/services/gemini_chat_service.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,25 @@ class GeminiChatService {
3535

3636
if (response.functionCalls.isNotEmpty) {
3737
final geminiTools = ref.read(geminiToolsProvider);
38+
final results = <(String, Map<String, Object?>)>[];
3839
for (final functionCall in response.functionCalls) {
39-
geminiTools.handleFunctionCall(functionCall.name, functionCall.args);
40+
results.add((
41+
functionCall.name,
42+
geminiTools.handleFunctionCall(
43+
functionCall.name,
44+
functionCall.args,
45+
),
46+
));
47+
final response = await chatSession.sendMessage(
48+
Content.functionResponses(
49+
results.map((result) => FunctionResponse(result.$1, result.$2)),
50+
),
51+
);
52+
final responseText = response.text;
53+
if (responseText != null) {
54+
logStateNotifier.logLlmText(responseText);
55+
chatStateNotifier.appendToMessage(llmMessage.id, responseText);
56+
}
4057
}
4158
}
4259
} catch (e, st) {

0 commit comments

Comments
 (0)