@@ -33,14 +33,25 @@ export const RunCommand = cmd({
3333 array : true ,
3434 default : [ ] ,
3535 } )
36+ . option ( "continue" , {
37+ alias : [ "c" ] ,
38+ describe : "Continue the last session" ,
39+ type : "boolean" ,
40+ } )
3641 . option ( "session" , {
42+ alias : [ "s" ] ,
3743 describe : "Session ID to continue" ,
3844 type : "string" ,
3945 } )
4046 . option ( "share" , {
4147 type : "boolean" ,
4248 describe : "Share the session" ,
4349 } )
50+ . option ( "model" , {
51+ type : "string" ,
52+ alias : [ "m" ] ,
53+ describe : "Model to use in the format of provider/model" ,
54+ } )
4455 } ,
4556 handler : async ( args ) => {
4657 const message = args . message . join ( " " )
@@ -50,9 +61,22 @@ export const RunCommand = cmd({
5061 } ,
5162 async ( ) => {
5263 await Share . init ( )
53- const session = args . session
54- ? await Session . get ( args . session )
55- : await Session . create ( )
64+ const session = await ( async ( ) => {
65+ if ( args . continue ) {
66+ const first = await Session . list ( ) . next ( )
67+ if ( first . done ) return
68+ return first . value
69+ }
70+
71+ if ( args . session ) return Session . get ( args . session )
72+
73+ return Session . create ( )
74+ } ) ( )
75+
76+ if ( ! session ) {
77+ UI . error ( "Session not found" )
78+ return
79+ }
5680
5781 UI . empty ( )
5882 UI . println ( UI . logo ( ) )
@@ -71,7 +95,9 @@ export const RunCommand = cmd({
7195 }
7296 UI . empty ( )
7397
74- const { providerID, modelID } = await Provider . defaultModel ( )
98+ const { providerID, modelID } = args . model
99+ ? Provider . parseModel ( args . model )
100+ : await Provider . defaultModel ( )
75101 UI . println (
76102 UI . Style . TEXT_NORMAL_BOLD + "@ " ,
77103 UI . Style . TEXT_NORMAL + `${ providerID } /${ modelID } ` ,
0 commit comments