export type modelType = 'KnowledgeQA' | 'Embedding' | 'Rerank' | 'VLLM'

export interface OllamaModel {
	name?: string
	digest?: string
	modified_at?: string
	size?: number
}

export interface DownloadTask {
	id: string
	modelName: string
	progress: number
	status: string
	startTime: string
	message: string
}

export interface ModelProvider {
	value: string
	label: string
	description: string
	modelTypes: modelType[]
	defaultUrls: {
		chat: string
		embedding: string
		rerank: string
		vllm: string
	}
}

export interface ModelItem {
	id: string
	name: string
	title: string
	description: string
	type: string
	source: string
	provider: string
	is_default: boolean
	status?: string
	creationTime: string
	updateTime?: string
}

export interface ModelCreateForm {
	/** 模型来源，local/remote */
	source: 'local' | 'remote'
	/** 模型类型 */
	type: modelType
	/** 模型名称 */
	name: string
	/** 模型展示标题 */
	title: string
	/** 模型描述 */
	description: string
	/** 模型供应商 */
	provider: string
	/** 访问地址 */
	base_url: string
	/** API Key */
	api_key: string
	/** 自定义请求头 */
	custom_headers: Record<string, string>
	/** embedding 模型维度 */
	dimension?: number
	/** embedding 模型截断长度 */
	truncate_prompt_tokens?: number
	/**支持视觉 对话模型、视觉模型、ollama模型 */
	supports_vision?: boolean
}

export interface ModelDetail {
	creationTime: string
	creatorUserId: string
	description: string
	id: string
	isDeleted: boolean
	is_default: boolean
	name: string
	parameters: {
		api_key: string
		base_url: string
		// 向量模型特有
		embedding_parameters?: {
			dimension: number
			truncate_prompt_tokens: number
		}
		provider: string
	}
	provider: string
	source: string
	status: string
	title: string
	type: ModelType
	updateTime: string
}
