bump kittycad.ts & pull thru project_name (#5359)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
		@ -26,7 +26,7 @@
 | 
			
		||||
    "@fortawesome/react-fontawesome": "^0.2.0",
 | 
			
		||||
    "@headlessui/react": "^1.7.19",
 | 
			
		||||
    "@headlessui/tailwindcss": "^0.2.0",
 | 
			
		||||
    "@kittycad/lib": "2.0.13",
 | 
			
		||||
    "@kittycad/lib": "2.0.17",
 | 
			
		||||
    "@lezer/highlight": "^1.2.1",
 | 
			
		||||
    "@lezer/lr": "^1.4.1",
 | 
			
		||||
    "@react-hook/resize-observer": "^2.0.1",
 | 
			
		||||
 | 
			
		||||
@ -34,6 +34,13 @@
 | 
			
		||||
    "title": "Car Wheel Assembly",
 | 
			
		||||
    "description": "A car wheel assembly with a rotor, tire, and lug nuts."
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "file": "main.kcl",
 | 
			
		||||
    "pathFromProjectDirectoryToFirstFile": "cycloidal-gear/main.kcl",
 | 
			
		||||
    "multipleFiles": false,
 | 
			
		||||
    "title": "Cycloidal Gear",
 | 
			
		||||
    "description": "A cycloidal gear is a gear with a continuous, curved tooth profile. They are used in watchmaking and high precision robotics actuation"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "file": "main.kcl",
 | 
			
		||||
    "pathFromProjectDirectoryToFirstFile": "dodecahedron/main.kcl",
 | 
			
		||||
@ -48,6 +55,13 @@
 | 
			
		||||
    "title": "Enclosure",
 | 
			
		||||
    "description": "An enclosure body and sealing lid for storing items"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "file": "main.kcl",
 | 
			
		||||
    "pathFromProjectDirectoryToFirstFile": "exhaust-manifold/main.kcl",
 | 
			
		||||
    "multipleFiles": false,
 | 
			
		||||
    "title": "Exhaust Manifold",
 | 
			
		||||
    "description": "A welded exhaust header for an inline 4-cylinder engine"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "file": "main.kcl",
 | 
			
		||||
    "pathFromProjectDirectoryToFirstFile": "flange-with-patterns/main.kcl",
 | 
			
		||||
 | 
			
		||||
@ -1199,6 +1199,7 @@ export const ModelingMachineProvider = ({
 | 
			
		||||
            selections: input.selection,
 | 
			
		||||
            token,
 | 
			
		||||
            artifactGraph: engineCommandManager.artifactGraph,
 | 
			
		||||
            projectName: context.project.name,
 | 
			
		||||
          })
 | 
			
		||||
        }),
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
@ -40,10 +40,12 @@ export async function submitPromptToEditToQueue({
 | 
			
		||||
  code,
 | 
			
		||||
  token,
 | 
			
		||||
  artifactGraph,
 | 
			
		||||
  projectName,
 | 
			
		||||
}: {
 | 
			
		||||
  prompt: string
 | 
			
		||||
  selections: Selections
 | 
			
		||||
  code: string
 | 
			
		||||
  projectName: string
 | 
			
		||||
  token?: string
 | 
			
		||||
  artifactGraph: ArtifactGraph
 | 
			
		||||
}): Promise<Models['TextToCadIteration_type'] | Error> {
 | 
			
		||||
@ -157,6 +159,8 @@ See later source ranges for more context. about the sweep`,
 | 
			
		||||
    original_source_code: code,
 | 
			
		||||
    prompt,
 | 
			
		||||
    source_ranges: ranges,
 | 
			
		||||
    project_name:
 | 
			
		||||
      projectName !== '' && projectName !== 'browser' ? projectName : undefined,
 | 
			
		||||
  }
 | 
			
		||||
  const url = VITE_KC_API_BASE_URL + '/ml/text-to-cad/iteration'
 | 
			
		||||
  const data: Models['TextToCadIteration_type'] | Error =
 | 
			
		||||
@ -203,11 +207,13 @@ export async function doPromptEdit({
 | 
			
		||||
  code,
 | 
			
		||||
  token,
 | 
			
		||||
  artifactGraph,
 | 
			
		||||
  projectName,
 | 
			
		||||
}: {
 | 
			
		||||
  prompt: string
 | 
			
		||||
  selections: Selections
 | 
			
		||||
  code: string
 | 
			
		||||
  token?: string
 | 
			
		||||
  projectName: string
 | 
			
		||||
  artifactGraph: ArtifactGraph
 | 
			
		||||
}): Promise<Models['TextToCadIteration_type'] | Error> {
 | 
			
		||||
  const toastId = toast.loading('Submitting to Text-to-CAD API...')
 | 
			
		||||
@ -217,6 +223,7 @@ export async function doPromptEdit({
 | 
			
		||||
    code,
 | 
			
		||||
    token,
 | 
			
		||||
    artifactGraph,
 | 
			
		||||
    projectName,
 | 
			
		||||
  })
 | 
			
		||||
  if (err(submitResult)) return submitResult
 | 
			
		||||
 | 
			
		||||
@ -269,12 +276,14 @@ export async function promptToEditFlow({
 | 
			
		||||
  code,
 | 
			
		||||
  token,
 | 
			
		||||
  artifactGraph,
 | 
			
		||||
  projectName,
 | 
			
		||||
}: {
 | 
			
		||||
  prompt: string
 | 
			
		||||
  selections: Selections
 | 
			
		||||
  code: string
 | 
			
		||||
  token?: string
 | 
			
		||||
  artifactGraph: ArtifactGraph
 | 
			
		||||
  projectName: string
 | 
			
		||||
}) {
 | 
			
		||||
  const result = await doPromptEdit({
 | 
			
		||||
    prompt,
 | 
			
		||||
@ -282,6 +291,7 @@ export async function promptToEditFlow({
 | 
			
		||||
    code,
 | 
			
		||||
    token,
 | 
			
		||||
    artifactGraph,
 | 
			
		||||
    projectName,
 | 
			
		||||
  })
 | 
			
		||||
  if (err(result)) return Promise.reject(result)
 | 
			
		||||
  const oldCode = codeManager.code
 | 
			
		||||
 | 
			
		||||
@ -19,9 +19,14 @@ import { toSync } from './utils'
 | 
			
		||||
 | 
			
		||||
async function submitTextToCadPrompt(
 | 
			
		||||
  prompt: string,
 | 
			
		||||
  projectName: string,
 | 
			
		||||
  token?: string
 | 
			
		||||
): Promise<Models['TextToCad_type'] | Error> {
 | 
			
		||||
  const body: Models['TextToCadCreateBody_type'] = { prompt }
 | 
			
		||||
  const body: Models['TextToCadCreateBody_type'] = {
 | 
			
		||||
    prompt,
 | 
			
		||||
    project_name:
 | 
			
		||||
      projectName !== '' && projectName !== 'browser' ? projectName : undefined,
 | 
			
		||||
  }
 | 
			
		||||
  // Glb has a smaller footprint than gltf, should we want to render it.
 | 
			
		||||
  const url = VITE_KC_API_BASE_URL + '/ai/text-to-cad/glb?kcl=true'
 | 
			
		||||
  const data: Models['TextToCad_type'] | Error = await crossPlatformFetch(
 | 
			
		||||
@ -100,7 +105,11 @@ export async function submitAndAwaitTextToKcl({
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const textToCadQueued = await submitTextToCadPrompt(trimmedPrompt, token)
 | 
			
		||||
  const textToCadQueued = await submitTextToCadPrompt(
 | 
			
		||||
    trimmedPrompt,
 | 
			
		||||
    context.project.name,
 | 
			
		||||
    token
 | 
			
		||||
  )
 | 
			
		||||
    .then((value) => {
 | 
			
		||||
      if (value instanceof Error) {
 | 
			
		||||
        return Promise.reject(value)
 | 
			
		||||
 | 
			
		||||
@ -1848,10 +1848,10 @@
 | 
			
		||||
    "@jridgewell/resolve-uri" "^3.1.0"
 | 
			
		||||
    "@jridgewell/sourcemap-codec" "^1.4.14"
 | 
			
		||||
 | 
			
		||||
"@kittycad/lib@2.0.13":
 | 
			
		||||
  version "2.0.13"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-2.0.13.tgz#e20aa17847ab1359065d21bed143ea330cf545d1"
 | 
			
		||||
  integrity sha512-wLn6/iRVdqbRCvf6t2FhNr8No6+I6elpCEVHGUexyHLoE+1XeUS1lHeapQqcfR0pEQiwtGpcKTDfUNSlmnmaFw==
 | 
			
		||||
"@kittycad/lib@2.0.17":
 | 
			
		||||
  version "2.0.17"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-2.0.17.tgz#26e74f8f6ef534d1987161dfccf62ac03d3b3ed1"
 | 
			
		||||
  integrity sha512-W4YcGvLfbeA2drjmAHDe1x6v2OXbvhB7nqtdjtKtPK39pGtMC41btcTx5MNvfz7pdnd32MIM02TCRqN6YV0RMw==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    openapi-types "^12.0.0"
 | 
			
		||||
    ts-node "^10.9.1"
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user