Initial commit: AI chat assistant with workflow chat, workspace, and profile tabs

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-12 17:23:00 +08:00
commit 3fc394921e
34 changed files with 3449 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/**
* useWorkflow — Current workflow selection state
*
* Manages which workflow is active (general, code, document, data, creative).
* The selection is persisted so it survives app restarts.
*/
import type { WorkflowId, WorkflowDef } from '@/types/index'
import { WORKFLOWS, STORAGE_KEYS } from '@/constants/index'
import { useStorage } from './useStorage'
export function useWorkflow() {
const { loadValue, saveValue } = useStorage()
// Initialize from storage, fallback to 'general'
const activeWorkflowId = ref<WorkflowId>(
loadValue<WorkflowId>(STORAGE_KEYS.ACTIVE_WORKFLOW_ID, 'general')
)
// All available workflows (static)
const workflows: WorkflowDef[] = WORKFLOWS
// Computed: the currently active workflow definition
const activeWorkflow = computed<WorkflowDef>(() => {
const found = workflows.find((w) => w.id === activeWorkflowId.value)
return found ?? workflows[0]
})
/**
* Select a workflow and persist the choice.
*/
function selectWorkflow(id: WorkflowId): void {
activeWorkflowId.value = id
saveValue(STORAGE_KEYS.ACTIVE_WORKFLOW_ID, id)
}
return {
activeWorkflowId,
workflows,
activeWorkflow,
selectWorkflow,
}
}