11import { invoke } from "@tauri-apps/api/core" ;
22import { emit } from "@tauri-apps/api/event" ;
33import { getCurrentWindow } from "@tauri-apps/api/window" ;
4- import { X , Plus , Trash2 } from "lucide-react" ;
4+ import { Plus , Trash2 , X } from "lucide-react" ;
55import { useEffect , useRef , useState } from "react" ;
66
77interface Tool {
@@ -24,18 +24,7 @@ interface Knowledge {
2424 file ?: string ;
2525}
2626
27- interface EnvVar {
28- name : string ;
29- value : string ;
30- description : string ;
31- }
3227
33- interface PresetTiming {
34- type : "once" | "minutely" | "hourly" | "daily" | "weekly" | "monthly" ;
35- time ?: string ; // HH:mm 格式
36- dayOfWeek ?: number ; // 0-6, 用于每周
37- dayOfMonth ?: number ; // 1-31, 用于每月
38- }
3928
4029interface Timing {
4130 type : "once" | "minutely" | "hourly" | "daily" | "weekly" | "monthly" ;
@@ -88,24 +77,13 @@ const presetTypes = [
8877
8978export function AgentAdd ( ) {
9079 const [ agent , setAgent ] = useState < Agent > ( defaultAgent ) ;
91- const [ models , setModels ] = useState < string [ ] > ( [ ] ) ;
9280 const [ activeTab , setActiveTab ] = useState < "basic" | "tools" | "knowledge" | "env" > ( "basic" ) ;
9381 const inputRef = useRef < HTMLInputElement > ( null ) ;
9482
9583 useEffect ( ( ) => {
9684 inputRef . current ?. focus ( ) ;
97- loadModels ( ) ;
9885 } , [ ] ) ;
9986
100- const loadModels = async ( ) => {
101- try {
102- const availableModels = await invoke ( "get_models" ) ;
103- setModels ( availableModels as string [ ] ) ;
104- } catch ( error ) {
105- console . error ( "加载模型列表失败:" , error ) ;
106- }
107- } ;
108-
10987 const handleClose = async ( ) => {
11088 const window = await getCurrentWindow ( ) ;
11189 setAgent ( defaultAgent ) ;
@@ -166,8 +144,8 @@ export function AgentAdd() {
166144
167145 return (
168146 < div className = "app-container flex flex-col h-screen bg-background" >
169- < div
170- className = "flex items-center justify-between h-12 px-4 border-b border-border"
147+ < div
148+ className = "flex items-center justify-between h-12 px-4 border-b border-border"
171149 data-tauri-drag-region
172150 >
173151 < div className = "text-sm font-medium text-foreground" > 添加代理</ div >
0 commit comments