当前位置:   article > 正文

国内智能编程助手简易对比:文心一言、通义千问、智谱AI、讯飞星火、Kimi_文心一言,讯飞星火,智谱ai的区别

文心一言,讯飞星火,智谱ai的区别

最近想给IDE选择一个智能编程助手插件,但鉴于国内百花齐放的现状,一时也不好选择用哪个。挑了几个主流的的平台,分别输入“用python实现雪花纷飞的场景”的简单需求,看看效果对比。备注:因国外插件使用成本远高于国内的原因,暂时放弃目前的头牌Copilot

简单粗暴地甄选,来吧。

1.文心一言

( IDE插件名称:Baidu Comate)

生成代码:

  1. import pygame
  2. import random
  3. import math
  4. # 初始化pygame
  5. pygame.init()
  6. # 设置窗口大小
  7. WIDTH, HEIGHT = 800, 600
  8. screen = pygame.display.set_mode((WIDTH, HEIGHT))
  9. pygame.display.set_caption("雪花纷飞")
  10. # 定义雪花类
  11. class Snowflake:
  12. def __init__(self):
  13. self.x = random.randint(0, WIDTH)
  14. self.y = random.randint(0, HEIGHT)
  15. self.size = random.randint(1, 5)
  16. self.speed = random.randint(1, 3)
  17. self.direction = random.randint(0, 360) / 180 * math.pi
  18. def move(self):
  19. self.x += self.speed * math.cos(self.direction)
  20. self.y += self.speed * math.sin(self.direction)
  21. # 如果雪花移出屏幕,则重新初始化位置
  22. if self.x < 0 or self.x > WIDTH or self.y < 0 or self.y > HEIGHT:
  23. self.__init__()
  24. def draw(self):
  25. pygame.draw.circle(screen, (255, 255, 255), (int(self.x), int(self.y)), self.size)
  26. # 创建雪花列表
  27. snowflakes = [Snowflake() for _ in range(100)]
  28. # 游戏主循环
  29. running = True
  30. while running:
  31. for event in pygame.event.get():
  32. if event.type == pygame.QUIT:
  33. running = False
  34. screen.fill((0, 0, 0)) # 清屏
  35. for snowflake in snowflakes:
  36. snowflake.move() # 移动雪花
  37. snowflake.draw() # 绘制雪花
  38. pygame.display.flip() # 更新屏幕显示
  39. pygame.time.wait(10) # 控制帧率,使动画更流畅
  40. pygame.quit()

#上述代码为修正后的结果,错误的原文代码就不贴了(报错:AttributeError: module 'pygame.math' has no attribute 'pi')。

效果:

备注:百度是唯一一个报了语法问题的,用了智谱AI修正后的效果

2.通义千问

( IDE插件名称:TONGYI Lingma)

生成代码:

  1. import pygame
  2. import random
  3. # 初始化pygame
  4. pygame.init()
  5. # 设置窗口大小
  6. screen = pygame.display.set_mode((800, 600))
  7. # 雪花类
  8. class Snowflake:
  9. def __init__(self):
  10. self.x = random.randint(0, 800)
  11. self.y = random.randint(0, 100)
  12. self.size = random.randint(5, 20)
  13. self.speed = random.randint(1, 3)
  14. def fall(self):
  15. self.y += self.speed
  16. if self.y > 600:
  17. self.y = 0
  18. def draw(self):
  19. pygame.draw.circle(screen, (255, 255, 255), (int(self.x), int(self.y)), self.size)
  20. # 创建雪花列表
  21. snowflakes = [Snowflake() for _ in range(100)]
  22. # 游戏主循环
  23. running = True
  24. while running:
  25. for event in pygame.event.get():
  26. if event.type == pygame.QUIT:
  27. running = False
  28. # 填充背景色
  29. screen.fill((0, 0, 128))
  30. # 让雪花下落并绘制
  31. for snowflake in snowflakes:
  32. snowflake.fall()
  33. snowflake.draw()
  34. # 更新屏幕
  35. pygame.display.flip()
  36. # 控制帧率
  37. pygame.time.Clock().tick(60)
  38. # 退出pygame
  39. pygame.quit()

生成效果:

3.智谱AI

( IDE插件名称:CodeGeeX)

生成代码:

  1. import pygame
  2. import random
  3. # 初始化pygame
  4. pygame.init()
  5. # 设置窗口大小
  6. screen = pygame.display.set_mode((800, 600))
  7. # 雪花类
  8. class Snowflake:
  9. def __init__(self):
  10. self.x = random.randint(0, 800)
  11. self.y = random.randint(0, 100)
  12. self.size = random.randint(5, 20)
  13. self.speed = random.randint(1, 3)
  14. def fall(self):
  15. self.y += self.speed
  16. if self.y > 600:
  17. self.y = 0
  18. def draw(self):
  19. pygame.draw.circle(screen, (255, 255, 255), (int(self.x), int(self.y)), self.size)
  20. # 创建雪花列表
  21. snowflakes = [Snowflake() for _ in range(100)]
  22. # 游戏主循环
  23. running = True
  24. while running:
  25. for event in pygame.event.get():
  26. if event.type == pygame.QUIT:
  27. running = False
  28. # 填充背景色
  29. screen.fill((0, 0, 128))
  30. # 让雪花下落并绘制
  31. for snowflake in snowflakes:
  32. snowflake.fall()
  33. snowflake.draw()
  34. # 更新屏幕
  35. pygame.display.flip()
  36. # 控制帧率
  37. pygame.time.Clock().tick(60)
  38. # 退出pygame
  39. pygame.quit()

生成效果:(你没看错,居然和通义千问生成的一模一样)

4.讯飞星火

( IDE插件名称:iFlyCode)

生成代码:

  1. import pygame
  2. import random
  3. # 初始化pygame
  4. pygame.init()
  5. # 设置屏幕大小
  6. screen_width = 800
  7. screen_height = 600
  8. screen = pygame.display.set_mode((screen_width, screen_height))
  9. # 设置标题
  10. pygame.display.set_caption("雪花纷飞")
  11. # 定义雪花类
  12. class Snowflake:
  13. def __init__(self, x, y):
  14. self.x = x
  15. self.y = y
  16. self.speed = random.randint(1, 3)
  17. def move(self):
  18. self.y += self.speed
  19. if self.y > screen_height:
  20. self.y = -10
  21. self.x = random.randint(0, screen_width)
  22. def draw(self, screen):
  23. pygame.draw.circle(screen, (255, 255, 255), (self.x, self.y), 2)
  24. # 创建雪花列表
  25. snowflakes = [Snowflake(random.randint(0, screen_width), random.randint(0, screen_height)) for _ in range(200)]
  26. # 游戏主循环
  27. running = True
  28. while running:
  29. for event in pygame.event.get():
  30. if event.type == pygame.QUIT:
  31. running = False
  32. screen.fill((0, 0, 0))
  33. for snowflake in snowflakes:
  34. snowflake.move()
  35. snowflake.draw(screen)
  36. pygame.display.flip()
  37. pygame.quit()

生成效果:

5.Kimi

( IDE插件名称:目前还未推出)

生成代码:

  1. import pygame
  2. import random
  3. # 初始化pygame
  4. pygame.init()
  5. # 设置窗口大小
  6. screen_width = 800
  7. screen_height = 600
  8. screen = pygame.display.set_mode((screen_width, screen_height))
  9. # 设置标题和帧率
  10. pygame.display.set_caption("Snowfall")
  11. clock = pygame.time.Clock()
  12. frame_rate = 60
  13. # 雪花类
  14. class Snowflake:
  15. def __init__(self, x, y, size, speed):
  16. self.x = x
  17. self.y = y
  18. self.size = size
  19. self.speed = speed
  20. def draw(self, surface):
  21. pygame.draw.circle(surface, (255, 255, 255), (self.x, self.y), self.size)
  22. def update(self):
  23. # 雪花下落
  24. self.y += self.speed
  25. # 如果雪花飞出屏幕,重新生成在屏幕顶部
  26. if self.y > screen_height:
  27. self.y = random.randint(-50, -20)
  28. self.x = random.randint(0, screen_width)
  29. # 创建雪花列表
  30. snowflakes = []
  31. for i in range(200):
  32. x = random.randint(0, screen_width)
  33. y = random.randint(-50, -20)
  34. size = random.randint(1, 4)
  35. speed = random.randint(1, 3)
  36. snowflake = Snowflake(x, y, size, speed)
  37. snowflakes.append(snowflake)
  38. # 游戏主循环
  39. running = True
  40. while running:
  41. for event in pygame.event.get():
  42. if event.type == pygame.QUIT:
  43. running = False
  44. # 填充背景色
  45. screen.fill((0, 0, 0))
  46. # 绘制并更新雪花
  47. for snowflake in snowflakes:
  48. snowflake.draw(screen)
  49. snowflake.update()
  50. # 更新显示
  51. pygame.display.flip()
  52. # 控制帧率
  53. clock.tick(frame_rate)
  54. # 退出pygame
  55. pygame.quit()

生成效果:

通过可选范围内的简单对比,我个人还是喜欢Kimi的“雪花纷飞”的风格,无奈Kimi暂时还没有推出IDE插件,遗憾用不了。那就暂时还是先用zhipuAI吧(之前安装试用过一小段时间)。

这个大模型对比其实并不全面也不客观,仅为个人的选择。如果大家有推荐更好的,欢迎留言,谢谢。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/535861
推荐阅读
相关标签
  

闽ICP备14008679号