@@ -27,9 +27,7 @@ use tempfile::Builder;
2727mod record;
2828use crate :: default_device_sink:: {
2929 default_device_name as get_default_output_device,
30- list_output_devices as list_audio_output_devices,
31- set_output_device,
32- DefaultDeviceSink ,
30+ list_output_devices as list_audio_output_devices, set_output_device, DefaultDeviceSink ,
3331} ;
3432use async_openai:: {
3533 types:: {
@@ -286,6 +284,10 @@ fn call_fn(
286284 Err ( e) => Some ( String :: from ( "Showing logs folder failed with: " ) + & e. to_string ( ) ) , // If unwrap fails, return Some with the error message
287285 }
288286 }
287+ "open_openai_billing" => match open:: that ( "https://platform.openai.com/usage?tab=month" ) {
288+ Ok ( _) => None ,
289+ Err ( e) => Some ( format ! ( "Failed to open OpenAI billing page: {}" , e) ) ,
290+ } ,
289291 "sysinfo" => Some ( get_system_info ( ) ) ,
290292
291293 "get_system_processes" => Some ( get_system_processes ( ) ) ,
@@ -1352,6 +1354,16 @@ async fn main() -> Result<(), Box<dyn Error>> {
13521354 } ) )
13531355 . build ( ) . unwrap ( ) ,
13541356
1357+ ChatCompletionFunctionsArgs :: default ( )
1358+ . name ( "open_openai_billing" )
1359+ . description ( "Opens the OpenAI usage dashboard for this month in the default web browser." )
1360+ . parameters ( json ! ( {
1361+ "type" : "object" ,
1362+ "properties" : { } ,
1363+ "required" : [ ] ,
1364+ } ) )
1365+ . build ( ) . unwrap ( ) ,
1366+
13551367 ChatCompletionFunctionsArgs :: default ( )
13561368 . name ( "sysinfo" )
13571369 . description ( "Returns this system's information." )
@@ -1510,7 +1522,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
15101522 "required" : [ ] ,
15111523 } ) )
15121524 . build ( ) . unwrap ( ) ,
1513-
1525+
15141526 ChatCompletionFunctionsArgs :: default ( )
15151527 . name ( "get_location" )
15161528 . description ( "Returns an approximate location based on the machine's IP address." )
0 commit comments