mirror of
https://github.com/mindverse/Second-Me.git
synced 2026-11-06 06:18:51 +00:00
* Enhance GGUF model handling with timestamps, metadata and memory training status * Check if is_trained exists * fix * cloud service * Change the data type of the is_trained field to boolean and update the related logic to reflect this change * Change the data type of the is_trained field to boolean and update the related logic to reflect this change * Add gguf path to json file * Added model selection function, updated model list acquisition logic, and enhanced model information display * Update the model service startup logic, add integrity check for the model path, and support obtaining the model path from different fields * Service Change * full cloud service * feat: implement async cloud training process with job tracking and API key management * Progress bar modification * feat: Add Local and Cloud Training Configuration Components - Introduced LocalTrainingConfig component for configuring local training parameters. - Updated TrainingConfiguration component to include tabs for Local and Cloud training configurations. - Added API functions for setting and getting cloud service API keys. - Created useCloudProviderStore for managing cloud provider configurations. - Enhanced event utility to include a new event for showing cloud provider modal. * Refactor cloud provider and training configuration components - Updated CloudProviderModal to handle cloud service API key management. - Replaced API key handling with model configuration updates in CloudProviderModal. - Enhanced CloudTrainingConfig to manage cloud models based on API key availability. - Introduced new cloud service functions for listing available models and managing training jobs. - Modified LocalTrainingConfig to ensure default model selection and synchronization. - Updated TrainingConfiguration to manage model switching between local and cloud environments. - Refactored useCloudProviderStore to integrate cloud service API key handling. - Adjusted useTrainingStore to prioritize model name selection based on the active environment. * Stream Output * feat: Enhance training configuration and progress components - Updated LocalTrainingConfig to improve default model handling and avoid unnecessary updates. - Introduced LocalTrainingProgress component to manage local training progress display. - Refactored TrainingConfiguration to support both local and cloud training types, including updated button text and actions. - Modified TrainingProgress to conditionally render local or cloud training progress based on the selected training type. - Added cloud service functions for starting training and managing job information. - Adjusted training parameter interfaces to ensure consistency across local and cloud models. * Stream response change * feat: Enhance cloud training and inference capabilities - Updated TrainingProgress component to handle cloud training progress data and job ID. - Modified trainExposureModel to allow nullable path and added optional stageName. - Enhanced useSSE hook to support cloud model inference with new parameters. - Introduced CloudProgressData type to align cloud training progress with local training structure. - Implemented cloud inference request handling with local knowledge retrieval in cloudService. - Added utility functions for managing active cloud model state in cloudModelUtils. - Updated cloud inference endpoint to support local knowledge retrieval before cloud inference. - Refactored advanced chat service to utilize new message structure for cloud inference. - Enhanced prompt strategies to incorporate knowledge retrieval based on user messages. * feat: Delete the training parameter debugging information component * Resume training at breakpoint * Repair data redundancy * Stop system modification * fix error: reset training * fix stop and reset * Change chat reply format * Enhance cloud and local service management with status tracking and improved progress reporting - Implemented service status file management in cloud and local services to track active status and model information. - Added endpoints to start and stop cloud services, including validation for existing services. - Enhanced local service management with status checks and progress updates during document processing and chunk embedding. - Introduced real-time progress tracking for document embedding and chunk processing, allowing for incremental updates. - Improved error handling and logging throughout the service management processes. - Refactored chat request handling to intelligently route between local and cloud services based on current status. * feat:Cleaned up code comment * translate Chinese comments to English in cloud service modules * translate into chinese * feat: Enhance cloud provider configuration and training management with API key handling and tab switching logic * bug fix * Add is_trained field modification in the cloud * feat: Refactor training parameters management to separate local and cloud configurations * feat: Update training parameter types to improve type safety and consistency * feat: Add data synthesis mode to cloud training parameters and update related components * feat: The document embedding part is restored to its original state * refactor: optimize cloud training process with improved stop handling and file path updates * feat: Update the default values and merging logic of cloud training parameters to ensure parameter consistency * feat: Add API key preloading function to optimize the loading experience when the modal box is opened * feat: Optimize CloudProviderModal component, add API key preloading and state management * fix: Simplify cloud provider display by removing conditional rendering for Alibaba Cloud * feat: Update .gitignore to include job_id.json and add .gitkeep for gguf directory --------- Co-authored-by: wyx-hhhh <1360479992@qq.com>
77 lines
3.6 KiB
Python
77 lines
3.6 KiB
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, String, DateTime
|
|
from lpm_kernel.common.repository.database_session import Base
|
|
|
|
|
|
class UserLLMConfig(Base):
|
|
"""User-defined LLM configuration model with separate chat and embedding settings"""
|
|
__tablename__ = 'user_llm_configs'
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
provider_type = Column(String(50), nullable=False, default='openai', comment='Provider type (e.g., openai)')
|
|
key = Column(String(200), nullable=True, comment='Common API key for provider-specific configurations')
|
|
|
|
# Chat configuration
|
|
chat_endpoint = Column(String(200), nullable=True, comment='Chat API endpoint')
|
|
chat_api_key = Column(String(200), nullable=True, comment='Chat API key')
|
|
chat_model_name = Column(String(200), nullable=True, comment='Chat model name')
|
|
|
|
# Embedding configuration
|
|
embedding_endpoint = Column(String(200), nullable=True, comment='Embedding API endpoint')
|
|
embedding_api_key = Column(String(200), nullable=True, comment='Embedding API key')
|
|
embedding_model_name = Column(String(200), nullable=True, comment='Embedding model name')
|
|
|
|
# Thinking configuration
|
|
thinking_model_name = Column(String(200), nullable=True, comment='Thinking model name')
|
|
thinking_endpoint = Column(String(200), nullable=True, comment='Thinking API endpoint')
|
|
thinking_api_key = Column(String(200), nullable=True, comment='Thinking API key')
|
|
|
|
# Cloud Service configuration
|
|
cloud_service_api_key = Column(String(200), nullable=True, comment='Cloud Service API key')
|
|
|
|
created_at = Column(DateTime, default=datetime.utcnow, comment='Creation time')
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, comment='Update time')
|
|
|
|
def __repr__(self):
|
|
return f'<UserLLMConfig {self.id}>'
|
|
|
|
def to_dict(self):
|
|
"""Convert to dictionary"""
|
|
return {
|
|
'id': self.id,
|
|
'provider_type': self.provider_type,
|
|
'key': self.key,
|
|
'chat_endpoint': self.chat_endpoint,
|
|
'chat_api_key': self.chat_api_key,
|
|
'chat_model_name': self.chat_model_name,
|
|
'embedding_endpoint': self.embedding_endpoint,
|
|
'embedding_api_key': self.embedding_api_key,
|
|
'embedding_model_name': self.embedding_model_name,
|
|
'thinking_model_name': self.thinking_model_name,
|
|
'thinking_endpoint': self.thinking_endpoint,
|
|
'thinking_api_key': self.thinking_api_key,
|
|
'cloud_service_api_key': self.cloud_service_api_key,
|
|
'created_at': self.created_at,
|
|
'updated_at': self.updated_at
|
|
}
|
|
|
|
@classmethod
|
|
def from_dict(cls, data):
|
|
"""Create instance from dictionary"""
|
|
return cls(
|
|
id=data.get('id'),
|
|
provider_type=data.get('provider_type', 'openai'),
|
|
key=data.get('key'),
|
|
chat_endpoint=data.get('chat_endpoint'),
|
|
chat_api_key=data.get('chat_api_key'),
|
|
chat_model_name=data.get('chat_model_name'),
|
|
embedding_endpoint=data.get('embedding_endpoint'),
|
|
embedding_api_key=data.get('embedding_api_key'),
|
|
embedding_model_name=data.get('embedding_model_name'),
|
|
thinking_model_name=data.get('thinking_model_name'),
|
|
thinking_endpoint=data.get('thinking_endpoint'),
|
|
thinking_api_key=data.get('thinking_api_key'),
|
|
cloud_service_api_key=data.get('cloud_service_api_key'),
|
|
created_at=data.get('created_at'),
|
|
updated_at=data.get('updated_at')
|
|
)
|