File tree Expand file tree Collapse file tree 3 files changed +7
-18
lines changed
cli/cmd/tui/component/prompt Expand file tree Collapse file tree 3 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ export function Prompt(props: PromptProps) {
203203 }
204204 : {
205205 type : "file" as const ,
206- mime : mention . mime ,
206+ mime : mention . type === "directory" ? "application/x-directory" : "text/plain" ,
207207 filename : mention . filename ,
208208 url : mention . url ,
209209 source : {
Original file line number Diff line number Diff line change @@ -1637,7 +1637,7 @@ export namespace SessionPrompt {
16371637 type : "file" as const ,
16381638 url : mention . url ,
16391639 filename : mention . filename ,
1640- mime : mention . mime ,
1640+ mime : mention . type === "directory" ? "application/x-directory" : "text/plain" ,
16411641 }
16421642 ) )
16431643
Original file line number Diff line number Diff line change @@ -6,10 +6,9 @@ import { ConfigMarkdown } from "@/config/markdown"
66import { Agent } from "@/agent/agent"
77
88export interface FileMention {
9- type : "file"
9+ type : "file" | "directory"
1010 url : string
1111 filename : string
12- mime : string
1312 start : number
1413 end : number
1514}
@@ -23,6 +22,9 @@ export interface AgentMention {
2322
2423export type Mention = FileMention | AgentMention
2524
25+ /**
26+ * Resolves mentions matched in the command template to agents, directories or files.
27+ */
2628export async function resolveMentions ( text : string ) : Promise < Mention [ ] > {
2729 const files = ConfigMarkdown . files ( text )
2830 const parts : Mention [ ] = [ ]
@@ -49,23 +51,10 @@ export async function resolveMentions(text: string): Promise<Mention[]> {
4951 return
5052 }
5153
52- if ( stats . isDirectory ( ) ) {
53- parts . push ( {
54- type : "file" ,
55- url : `file://${ filepath } ` ,
56- filename : name ,
57- mime : "application/x-directory" ,
58- start : match . index ,
59- end : match . index + match [ 0 ] . length ,
60- } )
61- return
62- }
63-
6454 parts . push ( {
65- type : "file" ,
55+ type : stats . isDirectory ( ) ? "directory" : "file" ,
6656 url : `file://${ filepath } ` ,
6757 filename : name ,
68- mime : "text/plain" ,
6958 start : match . index ,
7059 end : match . index + match [ 0 ] . length ,
7160 } )
You can’t perform that action at this time.
0 commit comments