├── .github ├── dependabot.yml └── workflows │ ├── build-frontend.yml │ ├── build.yml │ ├── docker-frontend.yaml │ ├── docker.yaml │ └── release.yaml ├── .gitignore ├── CHANGELOG.md ├── CNAME ├── Dockerfile ├── LICENSE ├── README.md ├── _fixtures └── testing │ ├── .gitignore │ ├── requirements.txt │ └── st.py ├── build.gradle.kts ├── choc-ui ├── .editorconfig ├── .env.example ├── .eslintrc.json ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── __tests__ │ └── dsl-parse.test.js ├── app │ ├── editor │ │ └── page.tsx │ ├── globals.css │ ├── layout.tsx │ └── page.tsx ├── assets │ └── fonts │ │ ├── Inter-Bold.woff │ │ └── Inter-Regular.woff ├── components │ ├── button-scroll-to-bottom.tsx │ ├── chat-list.tsx │ ├── chat-message-actions.tsx │ ├── chat-message.tsx │ ├── chat-panel.tsx │ ├── chat-scroll-anchor.tsx │ ├── chat.tsx │ ├── clear-history.tsx │ ├── dsl │ │ ├── design-block.tsx │ │ ├── design-dsl-render.tsx │ │ └── design-dsl.ts │ ├── editor │ │ ├── live-editor.tsx │ │ └── styles.css │ ├── empty-screen.tsx │ ├── external-link.tsx │ ├── flow │ │ ├── types.ts │ │ ├── use-chat.ts │ │ └── utils.ts │ ├── footer.tsx │ ├── header.tsx │ ├── interpreter │ │ ├── iframe.tsx │ │ └── message.ts │ ├── markdown.tsx │ ├── prompt-form.tsx │ ├── providers.tsx │ ├── sidebar-actions.tsx │ ├── sidebar-footer.tsx │ ├── sidebar-item.tsx │ ├── sidebar.tsx │ ├── tailwind-indicator.tsx │ ├── theme-toggle.tsx │ ├── toaster.tsx │ ├── ui │ │ ├── alert-dialog.tsx │ │ ├── badge.tsx │ │ ├── button.tsx │ │ ├── codeblock.tsx │ │ ├── dialog.tsx │ │ ├── dropdown-menu.tsx │ │ ├── icons.tsx │ │ ├── input.tsx │ │ ├── label.tsx │ │ ├── select.tsx │ │ ├── separator.tsx │ │ ├── sheet.tsx │ │ ├── switch.tsx │ │ ├── textarea.tsx │ │ └── tooltip.tsx │ └── workflow │ │ ├── domains.tsx │ │ ├── prompt-example.ts │ │ ├── stage.ts │ │ ├── workflow-dto.ts │ │ └── workflow.ts ├── docs │ └── test-case-1.md ├── jest.config.js ├── jest.setup.js ├── lib │ ├── analytics.ts │ ├── fonts.ts │ ├── hooks │ │ ├── use-at-bottom.tsx │ │ ├── use-copy-to-clipboard.tsx │ │ ├── use-enter-submit.tsx │ │ └── use-local-storage.ts │ ├── types.ts │ └── utils.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── pnpm-lock.yaml ├── postcss.config.js ├── prettier.config.cjs ├── public │ ├── favicon-16x16.png │ ├── next.svg │ ├── thirteen.svg │ └── vercel.svg ├── tailwind.config.js └── tsconfig.json ├── cocoa-core ├── README.md ├── build.gradle.kts └── src │ ├── main │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ ├── agent │ │ └── Tool.kt │ │ ├── cf │ │ └── core │ │ │ ├── Domain.kt │ │ │ ├── cache │ │ │ └── CachableEmbedding.kt │ │ │ ├── context │ │ │ ├── DslContext.kt │ │ │ ├── DslContextBuilder.kt │ │ │ └── variable │ │ │ │ ├── Variable.kt │ │ │ │ └── VariableResolver.kt │ │ │ ├── dsl │ │ │ ├── Dsl.kt │ │ │ ├── DslCompiler.kt │ │ │ ├── DslInterpreter.kt │ │ │ ├── IndexElement.kt │ │ │ ├── Interpreter.kt │ │ │ └── InterpreterContext.kt │ │ │ ├── flow │ │ │ ├── DomainDeclaration.kt │ │ │ ├── ProblemAnalyzer.kt │ │ │ ├── ProblemClarifier.kt │ │ │ ├── SolutionDesigner.kt │ │ │ ├── SolutionExecutor.kt │ │ │ ├── SolutionReviewer.kt │ │ │ ├── Workflow.kt │ │ │ ├── model │ │ │ │ ├── Answer.kt │ │ │ │ ├── ChatWebContext.kt │ │ │ │ ├── FlowActionFlag.kt │ │ │ │ ├── StageContext.kt │ │ │ │ └── WorkflowResult.kt │ │ │ └── related │ │ │ │ └── RelatedQueryService.kt │ │ │ ├── llms │ │ │ ├── ChatMessage.kt │ │ │ ├── LlmProvider.kt │ │ │ ├── MockLlmProvider.kt │ │ │ └── TemperatureMode.kt │ │ │ ├── parser │ │ │ └── MarkdownCode.kt │ │ │ ├── prompt │ │ │ ├── PromptExample.kt │ │ │ ├── QAExample.kt │ │ │ ├── ReActPrompt.kt │ │ │ ├── StringTemplate.kt │ │ │ └── UpdatableExample.kt │ │ │ └── utils │ │ │ ├── Constants.kt │ │ │ └── IdUtil.kt │ │ ├── docs │ │ └── Document.kt │ │ ├── nlp │ │ ├── embedding │ │ │ ├── Embedding.kt │ │ │ ├── EmbeddingElement.kt │ │ │ ├── EmbeddingProvider.kt │ │ │ ├── EncodingTokenizer.kt │ │ │ ├── OpenAiEncoding.kt │ │ │ └── text │ │ │ │ └── EnglishTextEmbeddingProvider.kt │ │ ├── search │ │ │ └── TfIdf.kt │ │ ├── similarity │ │ │ ├── CosineSimilarity.kt │ │ │ ├── JaccardSimilarity.kt │ │ │ ├── RelevanceScore.kt │ │ │ ├── Similarity.kt │ │ │ └── SimilarityScore.kt │ │ └── tokenizer │ │ │ ├── CodeNamingTokenizer.kt │ │ │ ├── SplittingRegExpTokenizer.kt │ │ │ ├── Tokenizer.kt │ │ │ ├── WordTokenizer.kt │ │ │ └── regexp │ │ │ ├── RegexTokenizerOptions.kt │ │ │ └── RegexpTokenizer.kt │ │ ├── rag │ │ ├── document │ │ │ ├── Document.kt │ │ │ ├── DocumentOrder.kt │ │ │ ├── DocumentParser.kt │ │ │ ├── DocumentType.kt │ │ │ └── Metadata.kt │ │ ├── loader │ │ │ ├── JsonLoader.kt │ │ │ └── Loader.kt │ │ ├── memory │ │ │ └── Memory.kt │ │ ├── retriever │ │ │ ├── EmbeddingStoreRetriever.kt │ │ │ └── Retriever.kt │ │ ├── splitter │ │ │ ├── CharacterTextSplitter.kt │ │ │ ├── MarkdownHeaderTextSplitter.kt │ │ │ ├── Splitter.kt │ │ │ ├── TextSplitter.kt │ │ │ └── TokenTextSplitter.kt │ │ └── store │ │ │ ├── EmbeddingMatch.kt │ │ │ ├── EmbeddingStore.kt │ │ │ ├── InMemoryEmbeddingStore.kt │ │ │ └── InMemoryEnglishTextStore.kt │ │ └── template │ │ ├── PromptCompiler.kt │ │ ├── TemplateEngineType.kt │ │ ├── TemplateRoleSplitter.kt │ │ └── VelocityCompiler.kt │ └── test │ └── kotlin │ └── cc │ └── unitmesh │ ├── cf │ └── core │ │ ├── flow │ │ └── model │ │ │ └── FlowActionFlagTest.kt │ │ └── parser │ │ └── MarkdownCodeTest.kt │ ├── nlp │ ├── similarity │ │ ├── CosineSimilarityTest.kt │ │ └── JaccardSimilarityTest.kt │ └── tokenizer │ │ └── SplittingRegExpTokenizerTest.kt │ └── rag │ ├── document │ └── DocumentOrderTest.kt │ ├── splitter │ ├── CharacterTextSplitterTest.kt │ └── MarkdownHeaderTextSplitterTest.kt │ └── store │ ├── InMemoryEmbeddingStoreTest.kt │ └── InMemoryEnglishTextStoreTest.kt ├── code-modules ├── README.md ├── api-tool-parser │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ ├── kotlin │ │ │ └── cc │ │ │ │ └── unitmesh │ │ │ │ └── processor │ │ │ │ └── api │ │ │ │ └── ApiProcessorDetector.kt │ │ └── resources │ │ │ ├── logback-test.xml │ │ │ └── logback.xml │ │ └── test │ │ ├── kotlin │ │ └── cc │ │ │ └── unitmesh │ │ │ └── processor │ │ │ └── api │ │ │ └── ApiProcessorDetectorTest.kt │ │ └── resources │ │ ├── openapi │ │ ├── Box.json │ │ └── CircleCI.postman_collection.json │ │ ├── postman │ │ └── Wechat-Simple.postman_collection.json │ │ └── testsets │ │ ├── postman.json │ │ ├── swagger-3.json │ │ └── swagger-3.yaml ├── code-language │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ ├── kotlin │ │ │ └── cc │ │ │ │ └── unitmesh │ │ │ │ └── language │ │ │ │ ├── Language.kt │ │ │ │ ├── LanguageService.kt │ │ │ │ └── Trie.kt │ │ └── resources │ │ │ └── languages.json │ │ └── test │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── language │ │ ├── LanguageServiceTest.kt │ │ └── TrieTest.kt ├── code-splitter │ ├── LICENSE │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── cc │ │ │ └── unitmesh │ │ │ └── cf │ │ │ └── code │ │ │ └── CodeSplitter.kt │ │ └── test │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── cf │ │ └── code │ │ └── CodeSplitterTest.kt ├── git-commit-message │ ├── README.md │ ├── build.gradle.kts │ ├── docs │ │ └── conventional.js │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── org │ │ │ └── changelog │ │ │ ├── CommitBase.kt │ │ │ ├── CommitParser.kt │ │ │ ├── LICENSE.md │ │ │ ├── ParserOptions.kt │ │ │ ├── ParserRegexes.kt │ │ │ └── RegexParser.kt │ │ └── test │ │ ├── kotlin │ │ └── org │ │ │ └── changelog │ │ │ ├── CommentMentionsCommitParserTest.kt │ │ │ ├── CommitParserTest.kt │ │ │ ├── FooterCommitParserTest.kt │ │ │ └── RegexParserTest.kt │ │ └── resources │ │ └── commits │ │ ├── allows-for-multiple-newlines-between-summary-and-body.json │ │ ├── parses-commit-summary-footer.json │ │ ├── parses-summary-with-multiple-spaces-after-separator.json │ │ ├── parses-summary-with-no-scope.json │ │ ├── parses-summary-with-scope.json │ │ └── supports-multiline-breaking-changes-via-continuation.json └── git-differ │ ├── build.gradle.kts │ └── src │ ├── main │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── cf │ │ └── code │ │ ├── ChangedLineCount.kt │ │ ├── ChangedNode.kt │ │ ├── GitCommand.kt │ │ ├── GitDiffer.kt │ │ ├── OptimizePatch.kt │ │ └── command │ │ ├── Command.kt │ │ ├── ExecListeners.kt │ │ └── OS.kt │ └── test │ ├── kotlin │ └── cc │ │ └── unitmesh │ │ └── cf │ │ └── code │ │ ├── GitCommandTest.kt │ │ ├── GitDifferTest.kt │ │ └── command │ │ └── CommandTest.kt │ └── resources │ └── logback.xml ├── docker-compose.yml ├── docs-builder ├── README.md ├── build.gradle.kts └── src │ ├── main │ └── kotlin │ │ ├── cc │ │ └── unitmesh │ │ │ └── docs │ │ │ ├── KDocGen.kt │ │ │ ├── Runner.kt │ │ │ ├── kdoc │ │ │ └── findKDoc.kt │ │ │ ├── model │ │ │ ├── DocContent.kt │ │ │ ├── DocGenerator.kt │ │ │ └── RootDocContent.kt │ │ │ ├── render │ │ │ └── Render.kt │ │ │ └── sample │ │ │ ├── ClassSample.kt │ │ │ └── FunctionSample.kt │ │ └── com │ │ └── pinterest │ │ └── ktlint │ │ ├── Code.kt │ │ ├── FileUtils.kt │ │ └── KtFileProcessor.kt │ └── test │ └── kotlin │ └── cc │ └── unitmesh │ └── docs │ ├── KDocGenTest.kt │ └── RunnerTest.kt ├── docs ├── CNAME ├── _config.yml ├── architecture.svg ├── dsl │ ├── design.md │ ├── dsl.md │ └── semantic-dsl.md ├── evaluation │ ├── evaluation.md │ └── github-copilot.md ├── faq.md ├── favicon.ico ├── home.md ├── images │ └── chocolate-factory.svg ├── logo.svg ├── modules │ ├── code-splitter.md │ ├── interpreter.md │ ├── local-embedding.md │ └── modules.md ├── patterns │ ├── coordinate-model.md │ ├── flare.md │ ├── hyde.md │ ├── light-weight-llm.md │ ├── long-context-reorder.md │ ├── patterns.md │ ├── pre-built-embedding.md │ └── query-to-doc.md ├── prompt-script │ ├── connection-config.md │ ├── job-strategy.md │ ├── prompt-script.md │ ├── template-datasource.md │ └── validate-rule.md ├── prompt │ ├── frontend │ │ ├── frontend-clarify.md │ │ ├── frontend-design.md │ │ ├── frontend-execute.md │ │ └── frontend-overview.md │ ├── prompt.md │ ├── qa │ │ ├── qa-clarify.md │ │ └── qa-design.md │ └── semantic │ │ ├── compare.md │ │ ├── semantic-analysis.md │ │ ├── semantic-execute.md │ │ └── semantic-overview.md ├── rag-script │ ├── prompt-text.md │ ├── rag-script.md │ └── workflow.md ├── rag │ ├── data-manage.md │ ├── document.md │ ├── embedding-model.md │ ├── rag.md │ ├── splitter.md │ └── vector-store.md ├── resources.md ├── setup.md └── workflow │ ├── semantic-code-search.md │ ├── workflow-development.md │ └── workflow.md ├── dsl └── design │ ├── README.md │ ├── build.gradle.kts │ └── src │ ├── main │ ├── antlr │ │ └── Design.g4 │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── dsl │ │ └── design │ │ ├── DesignAppListener.kt │ │ ├── DesignDsl.kt │ │ └── DesignModel.kt │ └── test │ └── kotlin │ └── cc │ └── unitmesh │ └── dsl │ └── design │ └── DesignDslTest.kt ├── examples ├── prompt-script │ ├── .gitignore │ ├── code-complete.open-ai.vm │ ├── connection.yml │ ├── datasource.json │ └── prompt.unit-mesh.yml └── rag-script │ ├── code-semantic.main.kts │ ├── english-text.main.kts │ ├── filename.txt │ └── sentence-transformers.main.kts ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── llm-modules ├── connection │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── cc │ │ │ └── unitmesh │ │ │ └── connection │ │ │ ├── ConnectionConfig.kt │ │ │ ├── MockLlmConnection.kt │ │ │ └── OpenAiConnection.kt │ │ └── test │ │ └── resources │ │ ├── connection │ │ ├── azure_openai.yml │ │ ├── custom.yml │ │ ├── openai.yml │ │ └── serp.yml │ │ └── schemas │ │ ├── AzureOpenAIConnection.schema.json │ │ ├── CustomConnection.schema.json │ │ ├── OpenAIConnection.schema.json │ │ └── SerpConnection.schema.json ├── dan-bert-tiny │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── resources │ │ ├── bert-base-uncased.txt │ │ ├── dan_optimized_fp16.onnx │ │ └── tokenizer_config.json ├── local-embedding │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ ├── kotlin │ │ │ └── cc │ │ │ │ └── unitmesh │ │ │ │ └── cf │ │ │ │ ├── Embedding.kt │ │ │ │ └── LocalEmbedding.kt │ │ └── resources │ │ │ └── model │ │ │ ├── LICENSE │ │ │ ├── model.onnx │ │ │ ├── special_tokens_map.json │ │ │ ├── tokenizer.json │ │ │ ├── tokenizer_config.json │ │ │ └── vocab.txt │ │ └── test │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── cf │ │ ├── DanBertTest.kt │ │ └── STSemanticTest.kt ├── openai │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ ├── azure │ │ ├── AzureOpenAIDto.kt │ │ ├── AzureOpenAiProvider.kt │ │ └── ResponseBodyCallback.kt │ │ └── openai │ │ ├── MsgConverter.kt │ │ ├── OpenAiEmbeddingProvider.kt │ │ └── OpenAiProvider.kt └── prompt-script │ ├── README.md │ ├── build.gradle.kts │ └── src │ ├── main │ ├── kotlin │ │ └── cc │ │ │ └── unitmesh │ │ │ └── prompt │ │ │ ├── Main.kt │ │ │ ├── PromptScriptCommand.kt │ │ │ ├── executor │ │ │ ├── ScriptExecutor.kt │ │ │ ├── base │ │ │ │ ├── JobStrategyExecutor.kt │ │ │ │ └── SingleJobExecuteStrategy.kt │ │ │ └── strategy │ │ │ │ ├── ConnectionExecuteStrategy.kt │ │ │ │ ├── DatasourceCollectionStrategy.kt │ │ │ │ └── RepeatExecuteStrategy.kt │ │ │ ├── model │ │ │ ├── Job.kt │ │ │ ├── JobStrategy.kt │ │ │ ├── PromptScript.kt │ │ │ ├── TemplateDatasource.kt │ │ │ ├── ValidateRule.kt │ │ │ └── Variable.kt │ │ │ ├── template │ │ │ └── TemplateDataCompile.kt │ │ │ └── validate │ │ │ ├── CodeCompletionValidator.kt │ │ │ ├── ExtToolValidator.kt │ │ │ ├── JsonPathValidator.kt │ │ │ ├── JsonValidator.kt │ │ │ ├── MarkdownCodeBlockValidator.kt │ │ │ ├── RegexValidator.kt │ │ │ ├── StringValidator.kt │ │ │ └── Validator.kt │ └── resources │ │ └── logback.xml │ └── test │ ├── kotlin │ └── cc │ │ └── unitmesh │ │ └── prompt │ │ ├── PromptManagerTest.kt │ │ ├── PromptScriptCommandTest.kt │ │ ├── executor │ │ ├── ScriptExecutorTest.kt │ │ └── TemplateRoleSplitterTest.kt │ │ ├── model │ │ ├── JobTest.kt │ │ ├── PromptScriptTest.kt │ │ ├── ValidateRuleTest.kt │ │ └── VariableTest.kt │ │ └── validate │ │ ├── CodeCompletionValidatorTest.kt │ │ ├── ExtToolValidatorTest.kt │ │ ├── JsonPathValidatorTest.kt │ │ ├── JsonValidatorTest.kt │ │ ├── MarkdownCodeBlockValidatorTest.kt │ │ ├── RegexValidatorTest.kt │ │ └── StringValidatorTest.kt │ └── resources │ ├── connection │ └── prompt-connection.yml │ ├── flow │ ├── Flow.schema.json │ └── flow.dag.yaml │ ├── prompt.unit-mesh.yml │ └── testdata │ ├── sample.json │ └── ui-clarify.open_ai.vm ├── llm-tools ├── interpreter │ ├── .gitignore │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── cc │ │ │ └── unitmesh │ │ │ └── code │ │ │ ├── interpreter │ │ │ ├── KotlinInterpreter.kt │ │ │ ├── api │ │ │ │ └── InterpreterRequest.kt │ │ │ └── compiler │ │ │ │ ├── CustomLibraryResolver.kt │ │ │ │ ├── ExtendLibraries.kt │ │ │ │ ├── KotlinReplWrapper.kt │ │ │ │ └── SimpleLibraryDefinition.kt │ │ │ ├── magic │ │ │ ├── LangCodeWrapper.kt │ │ │ ├── SimpleMagicMatcher.kt │ │ │ └── lang │ │ │ │ ├── KtorLangBuilder.kt │ │ │ │ ├── LangBuilder.kt │ │ │ │ └── SpringLangBuilder.kt │ │ │ └── messaging │ │ │ ├── Message.kt │ │ │ └── MessageType.kt │ │ └── test │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── code │ │ └── interpreter │ │ ├── KotlinInterpreterTest.kt │ │ ├── KotlinReplWrapperTest.kt │ │ └── LetsPlotInterpreterTest.kt └── web-tools │ ├── build.gradle.kts │ └── src │ ├── main │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── tools │ │ └── web │ │ └── Wikimedia.kt │ └── test │ └── kotlin │ └── cc │ └── unitmesh │ └── tools │ └── web │ └── WikimediaTest.kt ├── nginx ├── Dockerfile └── default.conf ├── packages ├── .gitignore └── ui-components-parser │ ├── .gitignore │ ├── README.md │ ├── mui │ ├── docs-parser.js │ └── mui-parser.js │ ├── package.json │ └── pnpm-lock.yaml ├── rag-modules ├── document │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── cc │ │ │ └── unitmesh │ │ │ └── document │ │ │ ├── DocumentFactory.kt │ │ │ └── parser │ │ │ ├── MdDocumentParser.kt │ │ │ ├── MsOfficeDocumentParser.kt │ │ │ ├── PdfDocumentParser.kt │ │ │ └── TextDocumentParser.kt │ │ └── test │ │ ├── kotlin │ │ └── cc │ │ │ └── unitmesh │ │ │ └── document │ │ │ └── parser │ │ │ ├── MdDocumentParserTest.kt │ │ │ └── MsOfficeDocumentParserTest.kt │ │ └── resources │ │ ├── ChocolateFactory.docx │ │ └── sample.pptx ├── rag-script │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── docs │ │ └── metric.md │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── cc │ │ │ └── unitmesh │ │ │ └── rag │ │ │ ├── CodeDsl.kt │ │ │ ├── DocumentDsl.kt │ │ │ ├── EmbeddingEngine.kt │ │ │ ├── Exec.kt │ │ │ ├── HttpDsl.kt │ │ │ ├── LlmConnector.kt │ │ │ ├── PromptText.kt │ │ │ ├── Rag.kt │ │ │ ├── Store.kt │ │ │ ├── Text.kt │ │ │ └── base │ │ │ └── RagScript.kt │ │ └── test │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── rag │ │ ├── PromptTextTest.kt │ │ └── WorkflowTest.kt ├── store-elasticsearch │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── store │ │ ├── ElasticsearchRequestFailedException.kt │ │ └── ElasticsearchStore.kt ├── store-milvus │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ └── cc │ │ └── unitmesh │ │ └── store │ │ └── MilvusEmbeddingStore.kt └── store-pinecone │ ├── build.gradle.kts │ └── src │ └── main │ └── kotlin │ └── cc │ └── unitmesh │ └── store │ └── PineconeEmbeddingStore.kt ├── server ├── build.gradle.kts ├── elastic-search.http ├── src │ ├── main │ │ ├── kotlin │ │ │ └── cc │ │ │ │ └── unitmesh │ │ │ │ └── cf │ │ │ │ ├── ChocolateFactoryApplication.kt │ │ │ │ ├── domains │ │ │ │ ├── DomainClassify.kt │ │ │ │ ├── SupportedDomains.kt │ │ │ │ ├── frontend │ │ │ │ │ ├── FEDomainDecl.kt │ │ │ │ │ ├── FEWorkflow.kt │ │ │ │ │ ├── context │ │ │ │ │ │ ├── FEContext.kt │ │ │ │ │ │ ├── FEDslContextBuilder.kt │ │ │ │ │ │ ├── FEVariableResolver.kt │ │ │ │ │ │ └── FEVariables.kt │ │ │ │ │ ├── flow │ │ │ │ │ │ ├── FEProblemClarifier.kt │ │ │ │ │ │ ├── FESolutionDesigner.kt │ │ │ │ │ │ └── FESolutionExecutor.kt │ │ │ │ │ └── model │ │ │ │ │ │ ├── AtomicElement.kt │ │ │ │ │ │ ├── UiComponent.kt │ │ │ │ │ │ └── UiPage.kt │ │ │ │ ├── interpreter │ │ │ │ │ ├── CodeInterpreter.kt │ │ │ │ │ ├── CodeInterpreterDomainDecl.kt │ │ │ │ │ ├── CodeInterpreterWorkflow.kt │ │ │ │ │ └── flow │ │ │ │ │ │ └── CodeSolutionExecutor.kt │ │ │ │ ├── semantic │ │ │ │ │ ├── CodeSemanticDecl.kt │ │ │ │ │ ├── CodeSemanticWorkflow.kt │ │ │ │ │ ├── context │ │ │ │ │ │ ├── SemanticVariableResolver.kt │ │ │ │ │ │ └── SemanticVariables.kt │ │ │ │ │ ├── flow │ │ │ │ │ │ ├── SemanticProblemAnalyzer.kt │ │ │ │ │ │ └── SemanticSolutionExecutor.kt │ │ │ │ │ └── model │ │ │ │ │ │ └── ExplainQuery.kt │ │ │ │ ├── spec │ │ │ │ │ ├── SpecDomainDecl.kt │ │ │ │ │ ├── SpecRelevantSearch.kt │ │ │ │ │ ├── SpecWorkflow.kt │ │ │ │ │ └── flow │ │ │ │ │ │ └── SpecSolutionExecutor.kt │ │ │ │ ├── sql │ │ │ │ │ ├── SqlWorkflow.kt │ │ │ │ │ └── domain │ │ │ │ │ │ └── SqlDsl.kt │ │ │ │ └── testcase │ │ │ │ │ ├── TestcaseDomainDecl.kt │ │ │ │ │ ├── TestcaseWorkflow.kt │ │ │ │ │ ├── context │ │ │ │ │ ├── TestcaseVariableResolver.kt │ │ │ │ │ └── TestcaseVariables.kt │ │ │ │ │ ├── flow │ │ │ │ │ ├── TestcaseProblemAnalyzer.kt │ │ │ │ │ ├── TestcaseSolutionDesigner.kt │ │ │ │ │ └── TestcaseSolutionReviewer.kt │ │ │ │ │ └── model │ │ │ │ │ └── TestcasePrinciples.kt │ │ │ │ ├── infrastructure │ │ │ │ ├── cache │ │ │ │ │ ├── CachedEmbeddingService.kt │ │ │ │ │ ├── EmbeddingCache.kt │ │ │ │ │ └── utils │ │ │ │ │ │ └── EmbeddingConverter.kt │ │ │ │ ├── llms │ │ │ │ │ ├── LlmProviderFactory.kt │ │ │ │ │ ├── completion │ │ │ │ │ │ ├── MockLlmProvider.kt │ │ │ │ │ │ ├── OpenAiCompletionService.kt │ │ │ │ │ │ └── model │ │ │ │ │ │ │ └── SimpleOpenAIFormat.kt │ │ │ │ │ ├── configuration │ │ │ │ │ │ └── OpenAiConfiguration.kt │ │ │ │ │ └── embedding │ │ │ │ │ │ ├── OpenAiEmbeddingService.kt │ │ │ │ │ │ └── SentenceTransformersEmbedding.kt │ │ │ │ └── repository │ │ │ │ │ └── EmbeddingCacheRepository.kt │ │ │ │ └── presentation │ │ │ │ ├── AgentController.kt │ │ │ │ ├── ArchGuardScanController.kt │ │ │ │ ├── ChatController.kt │ │ │ │ ├── CodeDocumentController.kt │ │ │ │ ├── DslController.kt │ │ │ │ ├── WorkflowController.kt │ │ │ │ ├── config │ │ │ │ └── WebConfig.kt │ │ │ │ └── dto │ │ │ │ └── DomainResponse.kt │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── be │ │ │ └── specification.md │ │ │ └── frontend │ │ │ ├── components │ │ │ └── mui-mini.json │ │ │ └── layouts │ │ │ └── layout-style.json │ └── test │ │ ├── kotlin │ │ ├── RagIntegrationTests.kt │ │ └── cc │ │ │ └── unitmesh │ │ │ └── cf │ │ │ ├── ChocolateFactoryApplicationTests.kt │ │ │ ├── domains │ │ │ ├── DomainClassifyTest.kt │ │ │ ├── frontend │ │ │ │ ├── context │ │ │ │ │ └── FEVariableResolverTest.kt │ │ │ │ ├── model │ │ │ │ │ └── UiPageTest.kt │ │ │ │ └── prompt │ │ │ │ │ └── FEWorkflowTestController.kt │ │ │ ├── interpreter │ │ │ │ └── CodeInterpreterWorkflowTest.kt │ │ │ ├── semantic │ │ │ │ ├── CodeSemanticWorkflowTest.kt │ │ │ │ └── model │ │ │ │ │ └── ExplainQueryTest.kt │ │ │ └── testcase │ │ │ │ └── TestcaseWorkflowTest.kt │ │ │ ├── infrastructure │ │ │ └── llms │ │ │ │ └── completion │ │ │ │ └── OpenAiCompletionServiceTest.kt │ │ │ └── presentation │ │ │ └── DslControllerTest.kt │ │ └── resources │ │ ├── application.yml │ │ └── rag │ │ ├── be.md │ │ └── bikes.json └── workflow-testing.http └── settings.gradle.kts /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Dependabot configuration: 2 | # https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates 3 | 4 | version: 2 5 | updates: 6 | # Maintain dependencies for Gradle dependencies 7 | - package-ecosystem: "gradle" 8 | directory: "/" 9 | target-branch: "next" 10 | schedule: 11 | interval: "daily" 12 | # Maintain dependencies for GitHub Actions 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | target-branch: "next" 16 | schedule: 17 | interval: "daily" 18 | -------------------------------------------------------------------------------- /.github/workflows/build-frontend.yml: -------------------------------------------------------------------------------- 1 | name: Frontend CI 2 | 3 | on: [ push ] 4 | 5 | permissions: 6 | contents: write 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | defaults: 12 | run: 13 | working-directory: ./choc-ui 14 | 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v3 18 | 19 | - name: Install Node.js 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: 18 23 | 24 | - uses: pnpm/action-setup@v2 25 | name: Install pnpm 26 | with: 27 | version: 8 28 | run_install: false 29 | 30 | - name: Get pnpm store directory 31 | shell: bash 32 | run: | 33 | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV 34 | 35 | - uses: actions/cache@v3 36 | name: Setup pnpm cache 37 | with: 38 | path: ${{ env.STORE_PATH }} 39 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} 40 | restore-keys: | 41 | ${{ runner.os }}-pnpm-store- 42 | 43 | - name: Install dependencies 44 | run: pnpm install --no-frozen-lockfile 45 | 46 | - name: Build my App 47 | run: npm run build 48 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [ push ] 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | matrix: 9 | os: [ macos-latest, ubuntu-latest, windows-latest ] 10 | runs-on: ${{ matrix.os }} 11 | 12 | steps: 13 | - uses: actions/checkout@v3 14 | with: 15 | fetch-depth: 10 16 | - uses: actions/setup-java@v3 17 | with: 18 | distribution: 'zulu' 19 | java-version: '17' 20 | 21 | - name: Setup Gradle 22 | uses: gradle/gradle-build-action@v2.8.0 23 | with: 24 | arguments: build 25 | 26 | - name: Execute Gradle build 27 | run: ./gradlew build 28 | 29 | - name: Execute Gradle Coverage 30 | run: ./gradlew check 31 | 32 | - name: Execute Gradle Coverage 33 | if: runner.os == 'macOS' 34 | run: bash <(curl -s https://codecov.io/bash) 35 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | assets: 14 | - server/build/libs/server-*.jar 15 | - llm-modules/prompt-script/build/libs/prompt-script-*-all.jar 16 | 17 | permissions: 18 | contents: write 19 | packages: write 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: actions/setup-java@v3 23 | with: 24 | distribution: 'zulu' 25 | java-version: '17' 26 | cache: 'gradle' 27 | 28 | - name: Setup Gradle 29 | run: ./gradlew build --no-daemon -x test 30 | 31 | - name: Upload assets to release 32 | uses: svenstaro/upload-release-action@v2 33 | with: 34 | repo_token: ${{ secrets.GITHUB_TOKEN }} 35 | file: ${{ matrix.assets }} 36 | tag: ${{ github.ref }} 37 | overwrite: true 38 | file_glob: true 39 | 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | .gradle 3 | build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | !**/src/main/**/build/ 6 | !**/src/test/**/build/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | bin/ 17 | !**/src/main/**/bin/ 18 | !**/src/test/**/bin/ 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | out/ 26 | !**/src/main/**/out/ 27 | !**/src/test/**/out/ 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /nbbuild/ 32 | /dist/ 33 | /nbdist/ 34 | /.nb-gradle/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | .env 39 | server/src/main/resources/application-dev.yml 40 | server/src/main/resources/frontend/components/mui-components.json 41 | devops-genius.yml 42 | connection.yml 43 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | framework.unitmesh.cc 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gradle:jdk11 as build 2 | WORKDIR /app 3 | COPY . . 4 | RUN rm -rf choc-ui 5 | RUN ./gradlew build -x test --no-daemon 6 | 7 | FROM openjdk:11-jdk 8 | WORKDIR /app 9 | COPY --from=build /app/server/build/libs/server-*.jar app.jar 10 | RUN ls -la 11 | ENV OPENAI_HOST "https://api.openai.com/" 12 | ENV OPENAI_API_KEY "" 13 | CMD ["java", "-jar", "app.jar"] 14 | EXPOSE 18080 -------------------------------------------------------------------------------- /_fixtures/testing/.gitignore: -------------------------------------------------------------------------------- 1 | venv -------------------------------------------------------------------------------- /_fixtures/testing/requirements.txt: -------------------------------------------------------------------------------- 1 | sentence-transformers -------------------------------------------------------------------------------- /_fixtures/testing/st.py: -------------------------------------------------------------------------------- 1 | from sentence_transformers import SentenceTransformer 2 | 3 | # Download model 4 | model = SentenceTransformer('paraphrase-MiniLM-L6-v2') 5 | 6 | # The sentences we'd like to encode 7 | sentences = ['Python is an interpreted high-level general-purpose programming language.', 8 | 'Python is dynamically-typed and garbage-collected.', 9 | 'The quick brown fox jumps over the lazy dog.'] 10 | 11 | # Get embeddings of sentences 12 | embeddings = model.encode(sentences) 13 | 14 | # Print the embeddings 15 | for sentence, embedding in zip(sentences, embeddings): 16 | print("Sentence:", sentence) 17 | print("Embedding:", embedding.__len__()) 18 | print("") 19 | -------------------------------------------------------------------------------- /choc-ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain 2 | # consistent coding styles between different editors and IDEs. 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /choc-ui/.env.example: -------------------------------------------------------------------------------- 1 | # You must first activate a Billing Account here: https://platform.openai.com/account/billing/overview 2 | # Then get your OpenAI API Key here: https://platform.openai.com/account/api-keys 3 | # OPENAI_API_KEY=XXXXXXXX 4 | 5 | # Set the following only when deployed. In this example, we can reuse the same OAuth app, but if you are storing users, we recommend using a different OAuth app for development/production so that you don't mix your test and production user base. 6 | # AUTH_REDIRECT_PROXY_URL=https://YOURAPP.vercel.app/api/auth 7 | 8 | # Instructions to create kv database here: https://vercel.com/docs/storage/vercel-kv/quickstart and 9 | #KV_URL=XXXXXXXX 10 | #KV_REST_API_URL=XXXXXXXX 11 | #KV_REST_API_TOKEN=XXXXXXXX 12 | #KV_REST_API_READ_ONLY_TOKEN=XXXXXXXX 13 | #NEXT_PUBLIC_API_SERVER_URL=http://localhost:18080 14 | 15 | -------------------------------------------------------------------------------- /choc-ui/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/eslintrc", 3 | "root": true, 4 | "extends": [ 5 | "next/core-web-vitals", 6 | "prettier", 7 | "plugin:tailwindcss/recommended" 8 | ], 9 | "plugins": ["tailwindcss"], 10 | "rules": { 11 | "tailwindcss/no-custom-classname": "off" 12 | }, 13 | "settings": { 14 | "tailwindcss": { 15 | "callees": ["cn", "cva"], 16 | "config": "tailwind.config.js" 17 | } 18 | }, 19 | "overrides": [ 20 | { 21 | "files": ["*.ts", "*.tsx"], 22 | "parser": "@typescript-eslint/parser" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /choc-ui/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | coverage 10 | 11 | # next.js 12 | .next/ 13 | out/ 14 | build 15 | 16 | # misc 17 | .DS_Store 18 | *.pem 19 | 20 | # debug 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | .pnpm-debug.log* 25 | 26 | # local env files 27 | .env.local 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | 32 | # turbo 33 | .turbo 34 | 35 | .contentlayer 36 | .env 37 | .vercel 38 | .vscode 39 | .swc 40 | -------------------------------------------------------------------------------- /choc-ui/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023 Vercel, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /choc-ui/app/editor/page.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import LiveEditor from "@/components/editor/live-editor"; 4 | import {cn} from "@/lib/utils"; 5 | 6 | export default function IndexPage() { 7 | return
8 | 9 |
10 | } 11 | -------------------------------------------------------------------------------- /choc-ui/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { nanoid } from '@/lib/utils' 2 | import { Chat } from '@/components/chat' 3 | 4 | // export const runtime = 'edge' 5 | 6 | export default function IndexPage() { 7 | const id = nanoid() 8 | 9 | return 10 | } 11 | -------------------------------------------------------------------------------- /choc-ui/assets/fonts/Inter-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unit-mesh/choco-builder/fdd4d700f9dc04d0bdef3bbc41b8955804cad135/choc-ui/assets/fonts/Inter-Bold.woff -------------------------------------------------------------------------------- /choc-ui/assets/fonts/Inter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unit-mesh/choco-builder/fdd4d700f9dc04d0bdef3bbc41b8955804cad135/choc-ui/assets/fonts/Inter-Regular.woff -------------------------------------------------------------------------------- /choc-ui/components/button-scroll-to-bottom.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | 5 | import { cn } from '@/lib/utils' 6 | import { useAtBottom } from '@/lib/hooks/use-at-bottom' 7 | import { Button, type ButtonProps } from '@/components/ui/button' 8 | import { IconArrowDown } from '@/components/ui/icons' 9 | 10 | export function ButtonScrollToBottom({ className, ...props }: ButtonProps) { 11 | const isAtBottom = useAtBottom() 12 | 13 | return ( 14 | 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /choc-ui/components/chat-list.tsx: -------------------------------------------------------------------------------- 1 | import { type Message } from 'ai' 2 | 3 | import { Separator } from '@/components/ui/separator' 4 | import { ChatMessage } from '@/components/chat-message' 5 | 6 | export interface ChatList { 7 | messages: Message[] 8 | } 9 | 10 | export function ChatList({ messages }: ChatList) { 11 | if (!messages.length) { 12 | return null 13 | } 14 | 15 | return ( 16 |
17 | {messages.map((message, index) => ( 18 |
19 | 20 | {index < messages.length - 1 && ( 21 | 22 | )} 23 |
24 | ))} 25 |
26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /choc-ui/components/chat-message-actions.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { type Message } from 'ai' 4 | 5 | import { Button } from '@/components/ui/button' 6 | import { IconCheck, IconCopy } from '@/components/ui/icons' 7 | import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard' 8 | import { cn } from '@/lib/utils' 9 | 10 | interface ChatMessageActionsProps extends React.ComponentProps<'div'> { 11 | message: Message 12 | } 13 | 14 | export function ChatMessageActions({ 15 | message, 16 | className, 17 | ...props 18 | }: ChatMessageActionsProps) { 19 | const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 }) 20 | 21 | const onCopy = () => { 22 | if (isCopied) return 23 | copyToClipboard(message.content) 24 | } 25 | 26 | return ( 27 |
34 | 38 |
39 | ) 40 | } 41 | -------------------------------------------------------------------------------- /choc-ui/components/chat-scroll-anchor.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import { useInView } from 'react-intersection-observer' 5 | 6 | import { useAtBottom } from '@/lib/hooks/use-at-bottom' 7 | 8 | interface ChatScrollAnchorProps { 9 | trackVisibility?: boolean 10 | } 11 | 12 | export function ChatScrollAnchor({ trackVisibility }: ChatScrollAnchorProps) { 13 | const isAtBottom = useAtBottom() 14 | const { ref, entry, inView } = useInView({ 15 | trackVisibility, 16 | delay: 100, 17 | rootMargin: '0px 0px -150px 0px' 18 | }) 19 | 20 | React.useEffect(() => { 21 | if (isAtBottom && trackVisibility && !inView) { 22 | entry?.target.scrollIntoView({ 23 | block: 'start' 24 | }) 25 | } 26 | }, [inView, entry, isAtBottom, trackVisibility]) 27 | 28 | return
29 | } 30 | -------------------------------------------------------------------------------- /choc-ui/components/dsl/design-block.tsx: -------------------------------------------------------------------------------- 1 | import { DesignDslRender } from '@/components/dsl/design-dsl-render' 2 | import { useEffect, useState } from 'react' 3 | import {CodeBlock} from "@/components/ui/codeblock"; 4 | 5 | interface DslOutput { 6 | name: string 7 | description: string 8 | output: any 9 | dsl: any 10 | } 11 | 12 | export function DesignBlock({ value }: { value: string }) { 13 | const [dsl, setDsl] = useState(null) 14 | 15 | useEffect(() => { 16 | fetch(`/api/dsl/Design`, { 17 | method: 'POST', 18 | headers: { 19 | 'Content-Type': 'application/json;charset=UTF-8' 20 | }, 21 | body: JSON.stringify({ dsl: value }) 22 | }) 23 | .then(res => res.json()) 24 | .then((data: DslOutput) => { 25 | setDsl(data.output) 26 | }) 27 | }, []) 28 | 29 | if (!dsl) { 30 | return 31 | } 32 | 33 | if (dsl.layouts.length == 0) { 34 | return 35 | } 36 | 37 | return 38 | } 39 | -------------------------------------------------------------------------------- /choc-ui/components/editor/styles.css: -------------------------------------------------------------------------------- 1 | /* Basic editor styles */ 2 | .tiptap > * + * { 3 | margin-top: 0.75em; 4 | } 5 | .tiptap ul, .tiptap ol { 6 | padding: 0 1rem; 7 | } 8 | .tiptap h1, .tiptap h2, .tiptap h3, .tiptap h4, .tiptap h5, .tiptap h6 { 9 | line-height: 1.1; 10 | } 11 | .tiptap code { 12 | background-color: rgba(97, 97, 97, 0.1); 13 | color: #616161; 14 | } 15 | .tiptap pre { 16 | background: #0d0d0d; 17 | color: #fff; 18 | font-family: 'JetBrainsMono', monospace; 19 | padding: 0.75rem 1rem; 20 | border-radius: 0.5rem; 21 | } 22 | .tiptap pre code { 23 | color: inherit; 24 | padding: 0; 25 | background: none; 26 | font-size: 0.8rem; 27 | } 28 | .tiptap img { 29 | max-width: 100%; 30 | height: auto; 31 | } 32 | .tiptap blockquote { 33 | padding-left: 1rem; 34 | border-left: 2px solid rgba(13, 13, 13, 0.1); 35 | } 36 | .tiptap hr { 37 | border: none; 38 | border-top: 2px solid rgba(13, 13, 13, 0.1); 39 | margin: 2rem 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /choc-ui/components/external-link.tsx: -------------------------------------------------------------------------------- 1 | export function ExternalLink({ 2 | href, 3 | children 4 | }: { 5 | href: string 6 | children: React.ReactNode 7 | }) { 8 | return ( 9 | 14 | {children} 15 | 27 | 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /choc-ui/components/footer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import { cn } from '@/lib/utils' 4 | import { ExternalLink } from '@/components/external-link' 5 | import {Span} from "next/dist/server/lib/trace/tracer"; 6 | 7 | export function FooterText({ className, ...props }: React.ComponentProps<'p'>) { 8 | return ( 9 |

16 | Open source LLM helper factor built with{' '} 17 | 18 | ChocoBuilder 19 | 20 | . 21 |

22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /choc-ui/components/header.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import Link from 'next/link' 3 | 4 | import { cn } from '@/lib/utils' 5 | import { buttonVariants } from '@/components/ui/button' 6 | import { IconGitHub } from '@/components/ui/icons' 7 | 8 | export async function Header() { 9 | return ( 10 |
11 |
12 | 13 | ChocoBuilder 14 | 15 |
16 | 27 |
28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /choc-ui/components/interpreter/message.ts: -------------------------------------------------------------------------------- 1 | export type InterpreterMessage = { 2 | id: number 3 | resultValue: string 4 | displayValue: string 5 | className: string 6 | msgType: MsgType 7 | content: MessageContent 8 | } 9 | 10 | export type MsgType = 'none' | 'error' | 'html' | 'running' 11 | 12 | export type MessageContent = { 13 | type: string 14 | // when type is "cc.unitmesh.code.messaging.HtmlContent" 15 | html?: string 16 | } 17 | -------------------------------------------------------------------------------- /choc-ui/components/markdown.tsx: -------------------------------------------------------------------------------- 1 | import { FC, memo } from 'react' 2 | import ReactMarkdown, { Options } from 'react-markdown' 3 | 4 | export const MemoizedReactMarkdown: FC = memo( 5 | ReactMarkdown, 6 | (prevProps, nextProps) => 7 | prevProps.children === nextProps.children && 8 | prevProps.className === nextProps.className 9 | ) 10 | -------------------------------------------------------------------------------- /choc-ui/components/providers.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import { ThemeProvider as NextThemesProvider } from 'next-themes' 5 | import { ThemeProviderProps } from 'next-themes/dist/types' 6 | 7 | import { TooltipProvider } from '@/components/ui/tooltip' 8 | 9 | export function Providers({ children, ...props }: ThemeProviderProps) { 10 | return ( 11 | 12 | {children} 13 | 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /choc-ui/components/sidebar-footer.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from '@/lib/utils' 2 | 3 | export function SidebarFooter({ 4 | children, 5 | className, 6 | ...props 7 | }: React.ComponentProps<'div'>) { 8 | return ( 9 |
13 | {children} 14 |
15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /choc-ui/components/sidebar.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | 5 | import { Button } from '@/components/ui/button' 6 | import { 7 | Sheet, 8 | SheetContent, 9 | SheetHeader, 10 | SheetTitle, 11 | SheetTrigger 12 | } from '@/components/ui/sheet' 13 | import { IconSidebar } from '@/components/ui/icons' 14 | 15 | export interface SidebarProps { 16 | children?: React.ReactNode 17 | } 18 | 19 | export function Sidebar({ children }: SidebarProps) { 20 | return ( 21 | 22 | 23 | 27 | 28 | 29 | 30 | Chat History 31 | 32 | {children} 33 | 34 | 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /choc-ui/components/tailwind-indicator.tsx: -------------------------------------------------------------------------------- 1 | export function TailwindIndicator() { 2 | if (process.env.NODE_ENV === 'production') return null 3 | 4 | return ( 5 |
6 |
xs
7 |
sm
8 |
md
9 |
lg
10 |
xl
11 |
2xl
12 |
13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /choc-ui/components/theme-toggle.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import { useTheme } from 'next-themes' 5 | 6 | import { Button } from '@/components/ui/button' 7 | import { IconMoon, IconSun } from '@/components/ui/icons' 8 | 9 | export function ThemeToggle() { 10 | const { setTheme, theme } = useTheme() 11 | const [_, startTransition] = React.useTransition() 12 | 13 | return ( 14 | 30 | ) 31 | } 32 | -------------------------------------------------------------------------------- /choc-ui/components/toaster.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export { Toaster } from 'react-hot-toast' 4 | -------------------------------------------------------------------------------- /choc-ui/components/ui/badge.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { cva, type VariantProps } from 'class-variance-authority' 3 | 4 | import { cn } from '@/lib/utils' 5 | 6 | const badgeVariants = cva( 7 | 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 8 | { 9 | variants: { 10 | variant: { 11 | default: 12 | 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80', 13 | secondary: 14 | 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', 15 | destructive: 16 | 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80', 17 | outline: 'text-foreground' 18 | } 19 | }, 20 | defaultVariants: { 21 | variant: 'default' 22 | } 23 | } 24 | ) 25 | 26 | export interface BadgeProps 27 | extends React.HTMLAttributes, 28 | VariantProps {} 29 | 30 | function Badge({ className, variant, ...props }: BadgeProps) { 31 | return ( 32 |
33 | ) 34 | } 35 | 36 | export { Badge, badgeVariants } 37 | -------------------------------------------------------------------------------- /choc-ui/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | import { cn } from '@/lib/utils' 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes {} 7 | 8 | const Input = React.forwardRef( 9 | ({ className, type, ...props }, ref) => { 10 | return ( 11 | 20 | ) 21 | } 22 | ) 23 | Input.displayName = 'Input' 24 | 25 | export { Input } 26 | -------------------------------------------------------------------------------- /choc-ui/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as LabelPrimitive from "@radix-ui/react-label" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 11 | ) 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )) 24 | Label.displayName = LabelPrimitive.Root.displayName 25 | 26 | export { Label } 27 | -------------------------------------------------------------------------------- /choc-ui/components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import * as SeparatorPrimitive from '@radix-ui/react-separator' 5 | 6 | import { cn } from '@/lib/utils' 7 | 8 | const Separator = React.forwardRef< 9 | React.ElementRef, 10 | React.ComponentPropsWithoutRef 11 | >( 12 | ( 13 | { className, orientation = 'horizontal', decorative = true, ...props }, 14 | ref 15 | ) => ( 16 | 27 | ) 28 | ) 29 | Separator.displayName = SeparatorPrimitive.Root.displayName 30 | 31 | export { Separator } 32 | -------------------------------------------------------------------------------- /choc-ui/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | import { cn } from '@/lib/utils' 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes {} 7 | 8 | const Textarea = React.forwardRef( 9 | ({ className, ...props }, ref) => { 10 | return ( 11 |