Tag: ai

Dkphhh Created@

今天粗浅地学习和应用了任务队列和 Server-Sent Events,GitHub Copilot 说我写的程序有严重的时序竞争 bug,但是我测试了十几遍都跑的没问题,我赢了 ✌️

(可能确实有 bug,但是我的标准是能跑就行)

阅读关于 2025-05-05 23:37:02 的文章
Dkphhh Created@

GitHub Copilot 堪称本年度到目前为止最值消费,一年 $100 相当于给自己雇了个编程老师 + 服务器运维,哪里不会问哪里,答案基本八九不离十,偶尔还能给我提供情绪价值,夸夸我 👍。

阅读关于 2025-05-03 16:36:40 的文章
Dkphhh Created@

我现在只要看到了很尬的比喻,就会下意识的怀疑是 deepseek 写的

阅读关于 2025-03-18 16:40:01 的文章
Dkphhh Created@
阅读关于 2025-03-13 23:40:42 的文章
Bekir Çankaya Published@

How to Extend GitHub Copilot Context for RAG

After watching GitHub Universe 2024 presentations, I decided to explore and test some of the new features. While it works great in VSCode, I wanted to dig deeper into its background. Specifically, I aimed to explore whether I could enhance its context capabilities without relying on additional plugins or programs. In this post, I’ll share my somewhat scattered notes on experimenting with the context of GitHub Copilot in VSCode.

Environment Setup:

  • VSCode Version: 1.95.2
  • Copilot Version: v1.245.0
  • Copilot Chat Version: v0.23.2024102903 (pre-release)

In VSCode, I frequently use the @workspace symbol while working with Copilot. This allows Copilot to index all files within the workspace (except those ignored in .gitignore).

What Happens When You Ask a Question?

  • The question is converted into an embedding vector.
  • This vector is compared to the pre-generated embeddings of your project files.
  • The closest matches are retrieved and sent along with your question to the LLM.

This approach is known as Retrieval-Augmented Generation (RAG).

Get Bekir Çankaya’s stories in your inbox

Join Medium for free to get updates from this writer.

Advantages of This Approach:

  • Speed and Efficiency: In large file archives, this method is significantly faster than traditional keyword-based searches.
  • Semantic Search: Embeddings allow for context-based retrieval, not just keyword matches. For instance, asking about “AI technologies” might surface files containing “artificial intelligence.”

Notes:

  • To begin indexing, type 'Build local workspace index' into the command palette (⇧⌘P). Even if you do not run this command, the indexing process starts when you ask a question starting with the @workspace symbol in chat.
  • To view logs, go to the Command Palette and select Output: Show Output Channels, then choose GitHub Copilot Chat. You can see more logs by clicking the settings button in the top right corner and selecting Trace.
  • It’s essential to execute the “developer: reload window” command when adding a file to .gitignore or removing a directory from the workspace.
  • For simultaneous use of different folders in the same chat, you can add different folders with the “Add folder to workspace” command.
  • Typing Build local workspace index in the command palette (⇧⌘P) might return: “Could not build local workspace index. @workspace’s indexing currently is limited to 2000 files. Found 2504 potential files to index in the workspace. A sparse local index will be used to answer questions instead.”
    If there are too many files, indexing won’t occur, and just the IDE’s indexing will be used, potentially leading to poorer answers. To overcome this, you can alter the plugin code.
    Edit the getAutoIndexFileCap and getManualIndexFileCap functions in the extension file, /Users/{computerUserName}/.vscode/extensions/github.copilot-chat-{version}/dist/extension.js by replacing their contents with return 3000 and return 4e3. The value 2e3 is in scientific notation, equating to 2000.
  • On Windows, the extension file path is: C:\Users\\{computerUserName}\\.vscode\extensions\github.copilot-chat-{version}\dist\extension.js
  • After modifying the extension file, run the window reload command or restart extension host command.
  • Since the extension code is minimized, using [js-beautify](https://github.com/beautifier/js-beautify) can improve readability when inspecting the code.
  • I inserted console.log() at places in the extension code I wanted to monitor. Open the console with the Toggle Developer Tools command and follow the logs from there.
  • Given that my computer has 8 cores, I changed parallelism: 2 to parallelism: 8, but I haven't measured any impact on performance.
  • Upon asking questions while indexing isn’t complete, a warning appears: “Still building the workspace index, response may be less accurate.”
    This indicates the usage of a local index (maybe IDE’s index).
  • Cache files on my Mac are saved to /Users/{computerUserName}/Library/Application Support/Code/User/workspaceStorage/{workspaceId}/GitHub.copilot-chat/workspaceEmbeddingsCache-text-embedding-3-small512.json.
  • A workspaceEmbeddingsCache file of maximum size 31.9 MB is generated, though I’m unsure of the reason and specifics behind this limit. Excess files might generate unhealthy data. To increase the limit, I incremented the max: 5e3 when creating the _embeddingsCache value. I modified it to 20e3.
  • In sizable projects, a timeout error arises while searching in context. Hence, I changed this.shouldSearchTimeout from !0 to !1 in the extension file.
  • I experimented with using symbolic links to index files with Copilot without transferring them to the project, but Copilot didn’t recognize them.
  • We have the ability to index our repositories on GitHub and use them as context, but there are certain limitations.
  • I couldn’t find a file listing indexed items. Instead, I reviewed the references sent during the chat.
  • We can use cmd+enter to submit questions without explicitly typing @workspace.
  • We can navigate through previously asked questions using the up/down arrow keys.

I honestly don’t know what caused the removal of these restrictions, I just changed the allowed parts and learned information I didn’t know before. I hope it is useful information for those who read it.

Sources:

阅读关于 How to Extend GitHub Copilot Context for RAG 的文章
Dkphhh Created@

我的双 11 购物,腾讯云服务器 199,一本讲 ai 的电子书,99

阅读关于 2024-11-11 12:28:00 的文章
Dkphhh Created@

Reflex 就是一个理所应当的黑箱魔法,诱人但是无法掌握。

阅读关于 2024-10-20 21:53:00 的文章
Dkphhh Created@

人类的大脑只能并发,不能并行。

阅读关于 2024-08-28 09:15:00 的文章
Dkphhh Created@

需要在不可预测的环境中具有大量机动性和灵活性的熟练工,比如管道工或电工。自动化这些工作需要科幻级别的机器人,类似于《星球大战》中的 C-3PO。“这是机器人领域最困难的挑战。我认为这些工作要很长时间后才受到威胁。”福特说。

来源:从无人车到副总统候选人万斯,技术进步的 80 亿种可能

阅读关于 2024-07-25 08:05:00 的文章
Dkphhh Created@

主流经济学对技术进步后果的回答是,新技术虽然会消灭一部分工作岗位,但也会创造新的产业和就业机会。这会存在一个经济规律自动调节的过程,不必担心。 所谓自动调节在两个方面发挥作用。一个是“补偿”。比如新技术可以降低产品价格、提供更好服务或者创造新的就业岗位,从而增加公司对劳动力的需求。典型例子是自动取款机(ATM)在 1990 年代美国推出后,并没有减少银行柜员数量。相反,它使银行能够开设更多分支机构,柜员数量实际上增加了。 另一个是“互补”。比如人们会学习如何使用新技术,提高自己的工作技能。这也是人类与机器互补、融合或者协同进化的过程。乔布斯曾把个人电脑比作“大脑的自行车”,微软的纳德拉则说 AI 像“大脑的蒸汽机”。 但是,“补偿”或者“互补”都存在缺陷。 “补偿”的缺陷之一是无法保证“需求”调节技术对社会的影响能在短期内完成,别忘记工业革命初期的过渡以三代英国工人为代价。“互补”的缺陷之一是高估每个人的能力。事实上,只有少数人能够顺利掌握新技术,大部分人都会落伍。

来源:从无人车到副总统候选人万斯,技术进步的 80 亿种可能

阅读关于 2024-07-25 08:03:00 的文章
1358