Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

574 B
Raw Blame
import { providerInitials } from './provider-initials.generated'

export function getProviderLetter(firstChar: string) {
  const code = firstChar.charCodeAt(0)
  const pinyinInitial =
    code >= 0x4e00 && code <= 0x9fa5 ? providerInitials[code - 0x4e00] : firstChar
  const letter = (pinyinInitial || firstChar).toUpperCase()

  return /[A-Z]/.test(letter) ? letter : '#'
}

export function compareProviderLetters(left: string, right: string) {
  if (left === right) return 0
  if (left === '#') return 1
  if (right === '#') return -1
  return left.localeCompare(right)
}