@@ -16,26 +16,21 @@ public function test_handle()
16
16
17
17
$ payload = get_fixture ('example_github.json ' );
18
18
19
- LlmDriverFacade::shouldReceive ('driver->onQueue ' )
20
- ->twice ()->andReturn ('default ' );
21
-
22
- LlmDriverFacade::shouldReceive ('driver->completion ' )
23
- ->once ()->andReturn (
24
- CompletionResponse::from ([
25
- 'content ' => get_fixture ('github_transformed.json ' , false ),
26
- ])
27
- );
19
+ LlmDriverFacade::shouldReceive ('driver->setToolType->chat ' )->once ()->andReturn (
20
+ CompletionResponse::from ([
21
+ 'content ' => 'foo bar ' ,
22
+ ])
23
+ );
28
24
29
25
$ source = Source::factory ()->create ();
30
26
31
27
(new \App \Domains \Sources \WebhookSource ())
32
28
->payload ($ payload )
33
29
->handle ($ source );
34
30
35
- $ this ->assertDatabaseCount ('documents ' , 2 );
36
- $ this ->assertDatabaseCount ('document_chunks ' , 2 );
31
+ $ this ->assertDatabaseCount ('documents ' , 1 );
37
32
38
- Bus::assertBatchCount (2 );
33
+ Bus::assertBatchCount (1 );
39
34
40
35
}
41
36
@@ -45,15 +40,11 @@ public function test_non_json()
45
40
46
41
$ payload = get_fixture ('example_github.json ' );
47
42
48
- LlmDriverFacade::shouldReceive ('driver->onQueue ' )
49
- ->once ()->andReturn ('default ' );
50
-
51
- LlmDriverFacade::shouldReceive ('driver->completion ' )
52
- ->once ()->andReturn (
53
- CompletionResponse::from ([
54
- 'content ' => 'Foo Bar ' ,
55
- ])
56
- );
43
+ LlmDriverFacade::shouldReceive ('driver->setToolType->chat ' )->once ()->andReturn (
44
+ CompletionResponse::from ([
45
+ 'content ' => 'foo bar ' ,
46
+ ])
47
+ );
57
48
58
49
$ source = Source::factory ()->create ();
59
50
@@ -62,7 +53,6 @@ public function test_non_json()
62
53
->handle ($ source );
63
54
64
55
$ this ->assertDatabaseCount ('documents ' , 1 );
65
- $ this ->assertDatabaseCount ('document_chunks ' , 1 );
66
56
67
57
Bus::assertBatchCount (1 );
68
58
@@ -74,15 +64,11 @@ public function test_prevent_duplicates_github()
74
64
75
65
$ payload = get_fixture ('example_github.json ' );
76
66
77
- LlmDriverFacade::shouldReceive ('driver->onQueue ' )
78
- ->times (2 )->andReturn ('default ' );
79
-
80
- LlmDriverFacade::shouldReceive ('driver->completion ' )
81
- ->once ()->andReturn (
82
- CompletionResponse::from ([
83
- 'content ' => get_fixture ('github_transformed.json ' , false ),
84
- ])
85
- );
67
+ LlmDriverFacade::shouldReceive ('driver->setToolType->chat ' )->once ()->andReturn (
68
+ CompletionResponse::from ([
69
+ 'content ' => 'foo bar ' ,
70
+ ])
71
+ );
86
72
87
73
$ source = Source::factory ()->create ();
88
74
@@ -94,10 +80,9 @@ public function test_prevent_duplicates_github()
94
80
->payload ($ payload )
95
81
->handle ($ source );
96
82
97
- $ this ->assertDatabaseCount ('documents ' , 2 );
98
- $ this ->assertDatabaseCount ('document_chunks ' , 2 );
83
+ $ this ->assertDatabaseCount ('documents ' , 1 );
99
84
100
- Bus::assertBatchCount (2 );
85
+ Bus::assertBatchCount (1 );
101
86
102
87
}
103
88
@@ -110,15 +95,11 @@ public function test_prevent_duplicates_statamic()
110
95
$ payload ['id ' ] = 'fake_id ' ;
111
96
$ payload ['content ' ] = $ payload ;
112
97
113
- LlmDriverFacade::shouldReceive ('driver->onQueue ' )
114
- ->once ()->andReturn ('default ' );
115
-
116
- LlmDriverFacade::shouldReceive ('driver->completion ' )
117
- ->times (1 )->andReturn (
118
- CompletionResponse::from ([
119
- 'content ' => 'Foo Bar ' ,
120
- ])
121
- );
98
+ LlmDriverFacade::shouldReceive ('driver->setToolType->chat ' )->once ()->andReturn (
99
+ CompletionResponse::from ([
100
+ 'content ' => 'foo bar ' ,
101
+ ])
102
+ );
122
103
123
104
$ source = Source::factory ()->create ();
124
105
@@ -131,7 +112,6 @@ public function test_prevent_duplicates_statamic()
131
112
->handle ($ source );
132
113
133
114
$ this ->assertDatabaseCount ('documents ' , 1 );
134
- $ this ->assertDatabaseCount ('document_chunks ' , 1 );
135
115
136
116
Bus::assertBatchCount (1 );
137
117
0 commit comments