@@ -27,10 +27,15 @@ Application entry point.
27
27
extern crate hamcrest;
28
28
use crate :: args:: cli:: Cli ;
29
29
use crate :: args:: env:: env;
30
+ use crate :: github:: github:: github;
30
31
use crate :: github:: github_issue:: GithubIssue ;
31
32
use crate :: github:: issue:: Issue ;
32
- use crate :: probe:: deep_infra_request:: { ProbeDeepInfra , ProbeMessage } ;
33
+ use crate :: probe:: assistant:: assistant;
34
+ use crate :: probe:: probe_deep_infra:: ProbeDeepInfra ;
33
35
use crate :: probe:: probe_request:: ProbeRequest ;
36
+ use crate :: report:: report:: Report ;
37
+ use crate :: report:: report_fork:: ReportFork ;
38
+ use crate :: report:: tagged_response:: tagged;
34
39
use clap:: Parser ;
35
40
use log:: { debug, info} ;
36
41
@@ -40,6 +45,8 @@ pub mod args;
40
45
pub mod github;
41
46
/// Probes.
42
47
pub mod probe;
48
+ /// Reporting.
49
+ pub mod report;
43
50
44
51
#[ tokio:: main]
45
52
async fn main ( ) {
@@ -57,24 +64,26 @@ async fn main() {
57
64
let ghtoken = env ( String :: from ( "GITHUB_TOKEN" ) ) ;
58
65
debug ! ( "Reading DEEPINFRA_TOKEN from environment..." ) ;
59
66
let deeptoken = env ( String :: from ( "DEEPINFRA_TOKEN" ) ) ;
60
- let issue =
61
- GithubIssue :: new ( Issue :: new ( args. repo , args. issue ) , ghtoken) . await ;
67
+ let github = github ( ghtoken) ;
68
+ let issue = GithubIssue :: new (
69
+ Issue :: new ( args. repo . clone ( ) , args. issue ) ,
70
+ github. clone ( ) ,
71
+ )
72
+ . await ;
62
73
info ! (
63
74
"Issue says (created by @{}): {}" ,
64
75
issue. clone( ) . author( ) ,
65
76
issue. clone( ) . body( )
66
77
) ;
78
+ let author = issue. clone ( ) . author ( ) ;
67
79
let response = ProbeDeepInfra :: new (
68
80
String :: from ( "https://api.deepinfra.com/v1/openai/chat/completions" ) ,
69
81
deeptoken,
70
82
)
71
- . complete ( vec ! [ ProbeMessage :: new(
72
- String :: from( "user" ) ,
73
- // @todo #7:30min Develop a prompt as probe message.
74
- // Let's create a prompt for a probe message that would
75
- // analyze quality of given bug report.
76
- String :: from( "Hello!" ) ,
77
- ) ] )
83
+ . complete ( assistant ( issue) )
78
84
. await ;
79
- info ! ( "{}" , response) ;
85
+ debug ! ( "Received response: {}" , response) ;
86
+ ReportFork :: new ( args. stdout , github, args. repo , args. issue )
87
+ . publish ( tagged ( response, author) )
88
+ . await ;
80
89
}
0 commit comments