MCPcopy Index your code
hub / github.com/cirediatpl/FigmaChain / generate_code

Function generate_code

generateCode.py:41–56  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

39
40# Define a function to generate code based on the input
41def generate_code(input):
42 # Get relevant nodes from the Figma document retriever
43 relevant_nodes = figma_doc_retreiver.get_relevant_documents(input)
44
45 # Create system and human message prompts
46 system_message_prompt = SystemMessagePromptTemplate.from_template(system_prompt_template)
47 human_message_prompt = HumanMessagePromptTemplate.from_template(human_prompt_template)
48
49 # Create the chat prompt using the system and human message prompts
50 conversation = [system_message_prompt, human_message_prompt]
51 chat_prompt = ChatPromptTemplate.from_messages(conversation)
52 response = gpt_4(chat_prompt.format_prompt(
53 context=relevant_nodes,
54 text=input).to_messages())
55
56 return response.content
57
58# Add argument parsing to allow for command-line input
59parser = argparse.ArgumentParser(description='Generate HTML/CSS code based on input.')

Callers 1

generateCode.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected